Forums / All Other Contributions/Addons / Using TinyMCE Editor with Zen Cart

Using TinyMCE Editor with Zen Cart

Locked

Views: 37,670

Results 1 to 20 of 40
This thread is locked. New replies are disabled.
26 May 2006, 8:17 PM
#1
flambeau avatar

flambeau

New Zenner

Join Date:
May 2006
Posts:
5
Plugin Contributions:
0

Using TinyMCE Editor with Zen Cart

I don't really consider this a formal contribution...but rather, just an explanation on how I managed to get TinyMCE working with my Zen Cart install. It was surprisingly very easy and, aside from the time it took to ftp the TinyMCE files to my server, I had this implemented in about five minutes.

I can't guarantee that it will work for you and, being new to zen cart, I have no business offering any reliable support - but will certainly try if you have problems.

I've used TinyMCE quite a bit for other CMS solutions and it is my preferred open source WYSIWYG editor for clients. If you have no experience with it, you can test drive it from their website.

Anyways - so this is more of a hack in that you aren't really modifying any of the core files, but rather...just adding one block of javascript to those pages that you want to use the TinyMCE editor on. In my case, it was product.php and ezpages.php - the only pages my client will need access to a WYSIWYG editor.

I liked doing it this way because:

  1. It was easy to implement
  2. It doesn't remove any original code from the core files - only adds to it
  3. It is easy to reverse if it doesn't work
  4. TinyMCE rocks over HTMLArea.

What could be problematic:

  1. If your client gets a whim to go back into the configuration area and turn HTMLArea back on.

So with that said...here is how I did it:

Step 1: Back-up Database. The excellent backup tool I use is the one contributed by DrByte.

Step 2: Go into your Zen Cart Admin area and turn off HTMLArea in the following areas:

  • Configuration > My Store > HTMLArea > Choose Edit > Choose NONE
  • Catalog > Categories/Products > Next to the 'Text Editor' drop down in the corner - make sure NONE is selected
  • Tools > EZ-Pages > Next to the 'Text Editor' drop down in the corner - make sure NONE is selected

(the last two may be overkill, as I'm not sure if turning it off in the config area overrides those settings - but that is just what I did)

Step 3: Download and Unzip this TinyMCE package which includes the iBrowser Plugin (these instructions are also in that zip file).

**Step 4: Upload/FTP the entire tiny_mce folder and generic.css to your admin directory. ** The generic.css file simply controls how text, links, etc look while you are editing. This has nothing to do with the actual content and won't affect your existing stylesheets. You can modify this however you like. I like using it so my clients are editing in the same style of text as the rest of their site is using.

**Step 5: You need to set up a few things for the iBrowser plugin, which allows you to easily upload, insert and manage images directly from the TinyMCE editor window. ** Although it can be configured to upload to whatever directories you specify within the ibrowser config file, it is currently set to handle two directories: 'images' and 'uploads' (both which need to be located in your zen cart root directory - not the admin directory).

So to make all this happen, you need to set write permissions on a few folders. I had to use 777, but maybe you can get away with 755 or 775.

  1. You should already have an images folder in your zen cart root directory. If you don't, create one and Chmod (set permissions) to 777.

  2. Create another folder called 'uploads' in your zen cart root directory. Chmod it to 777

  3. Browse to the following two folders and Chmod to 777

/admin/tiny_mce/plugins/ibrowser/temp
/admin/tiny_mce/plugins/ibrowser/scripts/phpThumb/cache

(note: the 'uploads' and 'images' folders are the ones I like using for the ibrowser tool. If you want to use something different, or add more folders, navigate to the config.inc.php file in tiny_mce\plugins\ibrowser\config\ and edit the directories around line 93. Just make sure that whatever folders you use have the proper write permissions.)

**Step 6: The last step is inserting the one block of javascript code in the core files you want the TinyMCE editor to appear on. ** These instructions assume that you only want the editor for adding/editing EZ Pages and Products. If you want to use it in other areas, follow the same steps for that particular core file.

  1. Open ezpages.php and product.php from the admin directory.

  2. Go to line 207 in ezpages.php or 112 in product.php (or thereabouts) and locate this block code:

	<script type="text/javascript">
	  <!--
	  function init()
	  {
	    cssjsmenu('navbar');
	    if (document.getElementById)
	    {
	      var kill = document.getElementById('hoverJS');
	      kill.disabled = true;
	    }
	  if (typeof _editor_url == "string") HTMLArea.replaceAll();
	  }
	  // -->
	</script>
  1. Paste the following code just above that:
	<script language="javascript" type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
	<script language="javascript" type="text/javascript">
		tinyMCE.init({
		mode : "textareas",
		theme : "advanced",
		width : "100%",
		height : "460",
		relative_urls : false,
		remove_script_host : true,
		document_base_url : "http://www.yourdomain.com/",
		plugins : "ibrowser,table,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,searchreplace,print,paste,directionality,fullscreen,noneditable,contextmenu",
		theme_advanced_buttons1_add : "fontselect,fontsizeselect,forecolor,ibrowser",
		theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,backcolor,liststyle",
		theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
		theme_advanced_buttons3_add_before : "tablecontrols,separator",
		theme_advanced_buttons3_add : "emotions,iespell,advhr,separator,print,separator,ltr,rtl,separator,fullscreen",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "center",
		theme_advanced_disable : "image",
		theme_advanced_statusbar_location : "bottom",
		content_css : "generic.css",
		plugin_insertdate_dateFormat : "%Y-%m-%d",
		plugin_insertdate_timeFormat : "%H:%M:%S",
		extended_valid_elements : "hr[class|width|size|noshade]",
		file_browser_callback : "fileBrowserCallBack",
		custom_undo_redo_levels : 10,
		paste_use_dialog : false

	});
	</script>
  1. (this is Important): Change the document_base_url to the url that your zen cart is installed to.

Example:
If zen cart is installed in your domain root directory:
document_base_url : "http://www.yourname.com/",

If zen cart is installed in a sub-directory on your domain (replace foldername with the sub-direcotry):
document_base_url : "http://www.yourname.com/foldername/",

And that's it. Test it out by going to the admin area and opening one of your EZ pages or by trying to add a new product.

This loads TinyMCE with almost all of the available plugins (which slows the initial page load time). You can configure the editor to only load those plugins you need. You can also customize the toolbar itself (especially nice if you don't want your clients messing with fonts, sizes, etc)....but I don't have the energy to get into how to do all that right now. Instead, feel free to peruse the TinyMCE Website, Forum and User Manual. Their FAQ page is also helpful.

You'll notice the editor pages will be slower to open than they were with HTMLArea....but again, this is partly due to so many plugins being loaded. If it bothers you, you can also search through the TinyMCE forums to some other solutions...one of which is calling to a gzip version of the .js code....but again, that goes beyond these instructions... :)

You'll probably want to configure the TinyMCE configuration (the block of javascript you added to the core files) to suit your own needs. The way it is now is just how I usually have it.

Good luck...

11 Aug 2006, 1:50 AM
#2
knewbill avatar

knewbill

New Zenner

Join Date:
Aug 2006
Posts:
4
Plugin Contributions:
0

Re: Using TinyMCE Editor with Zen Cart

Excellent. Thanks for the info. I have very little knowledge of html, but I noticed in the ez page.php that there is a reference to fckeditor. Will that be a problem?

Also, is there a way to simply make tinymce the default html editor instead of htmlarea?

12 Aug 2006, 9:24 PM
#3
romanus avatar

romanus

Zen Follower

Join Date:
Feb 2004
Location:
portsmouth, nh us
Posts:
101
Plugin Contributions:
3

Re: Using TinyMCE Editor with Zen Cart

Very Nice. I installed this on two other php files for the defined pages and categories with no problems.

Thanks for this

"You must be the change you wish to see in the world" - Ghandi

16 Aug 2006, 3:35 PM
#4
gblu avatar

gblu

New Zenner

Join Date:
Aug 2006
Posts:
3
Plugin Contributions:
0

Re: Using TinyMCE Editor with Zen Cart

Hi Folks,

I have installed this to the letter and i am not getting any of it to work.

I still have HTML editor and cant find any mention of TinyMCE

Really frustrating as this is my third attempt at doing this and dont understand what on earth i am doing wrong!?

Please please help.:shocking:

Thanks

16 Aug 2006, 4:04 PM
#5
romanus avatar

romanus

Zen Follower

Join Date:
Feb 2004
Location:
portsmouth, nh us
Posts:
101
Plugin Contributions:
3

Re: Using TinyMCE Editor with Zen Cart

That is all you will have. Make sure that the editor drop down is set to --none-- and no editor is set in configuration>>mystore>>html editor

"You must be the change you wish to see in the world" - Ghandi

16 Aug 2006, 5:07 PM
#6
gblu avatar

gblu

New Zenner

Join Date:
Aug 2006
Posts:
3
Plugin Contributions:
0

Re: Using TinyMCE Editor with Zen Cart

Hi and Thanks for the reply...

I have done the all of what is said in the instructions.

I have it set to none as required in config etc. However on selecting non i get the standard html editor(not HTML Area).

??????

Bonkers!

16 Aug 2006, 7:45 PM
#7
romanus avatar

romanus

Zen Follower

Join Date:
Feb 2004
Location:
portsmouth, nh us
Posts:
101
Plugin Contributions:
3

Re: Using TinyMCE Editor with Zen Cart

check in the upper right hand corner of the product pages and see if it says htmlarea

"You must be the change you wish to see in the world" - Ghandi

17 Aug 2006, 9:09 AM
#8
gblu avatar

gblu

New Zenner

Join Date:
Aug 2006
Posts:
3
Plugin Contributions:
0

Re: Using TinyMCE Editor with Zen Cart

hi,

I have checked that already and it has none selected. Same as every where.

I really dont know what an earth to do to get it working...

I tried it again last night as a clean install and still not working.

Nevermind, just have to make do with HTML area.
:cry:

23 Aug 2006, 1:18 PM
#9
longstockings avatar

longstockings

Zen Follower

Join Date:
Jul 2004
Posts:
198
Plugin Contributions:
0

Re: Using TinyMCE Editor with Zen Cart

I'm using this to edit everything I can and it kicks the crap out of htmlarea

This is fantastic and installation is really straight forward.
Does take ages to upload though so if you know how, I would recommend uploading a compressed tiny_mce and extract it onto the server.

Good work

UK based Zen Cart Web Designer here https://www.handcoded.co.uk

19 Sep 2006, 5:05 PM
#10
oceano avatar

oceano

New Zenner

Join Date:
Aug 2006
Posts:
50
Plugin Contributions:
0

Re: Using TinyMCE Editor with Zen Cart

Hi I'm using this for the first time. Just installed it into a fresh v135 - there was no installation text with the download it that mentions adding the javascript patch outlined above - IS THIS STILL NECESSARY WITH 135 - ??

The install went smooth and it seems to be fine, but I wanted to check on the above info (including the permissions info) and confirm that it still relevant. Most mods include an installation text file...

thanks /mark

19 Sep 2006, 5:10 PM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Using TinyMCE Editor with Zen Cart

The content described earlier is not required while using the v1.3.5 contribution

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

19 Sep 2006, 6:10 PM
#12
oceano avatar

oceano

New Zenner

Join Date:
Aug 2006
Posts:
50
Plugin Contributions:
0

Re: Using TinyMCE Editor with Zen Cart

Thanks doc!

It loads very fast even w/the glut of plugins. Seems nice but...

My main interest is in getting an easy to use editor to permit my client to use STYLES with text - but the documentation at moxiecode on setting this up is a major pain to understand. As I would assume everyone wants this minimum ability could someone please spell this out.

To make this request here simpler - I need help!

How does one get this style's plugin to work. Could we even get the download to have this functioning with some styles and a simple explanation for adding styles?

I know everyone is very busy, but this seems to be the solution mod that loads fast, and adds XHTML controls in a clean fashion. If someone could stremline this it would be amazingly helpful for thousands of ZC users. :D

kind regards /mark

20 Sep 2006, 12:22 PM
#13
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

Re: Using TinyMCE Editor with Zen Cart

Any tricks needed to be done? What are the settings for the editor in admin?
I just downloaded the files in right folders in my server but I can't see any Tiny, tinyMCE anywhere... maybe it is too tiny.

Elli

I may be blond but at least I found Zen.

20 Sep 2006, 8:44 PM
#14
oceano avatar

oceano

New Zenner

Join Date:
Aug 2006
Posts:
50
Plugin Contributions:
0

Re: Using TinyMCE Editor with Zen Cart

elli

go into admin > catalog > categories/products

you should see a dropdown top right. use it to select tinymce. if you don't see it there then try reinstalling the files.

there are no real settings - it seems to just be up and running.

THE BRICK WALL - IS HOW TO GET SOME STYLES IN THE DROPDOWN SELECTOR ON THE CONTROL PANEL...??

anyone.....?

It would also be nice to change the font sizes from pt values to em's or px ---------

16 Oct 2006, 1:21 PM
#15
100asa avatar

100asa

Totally Zenned

Join Date:
Oct 2006
Location:
Italy
Posts:
636
Plugin Contributions:
0

Re: Using TinyMCE Editor with Zen Cart

Thnak's a lot, flambeau!
This is the only one way to solve the problem of editors!

7 Nov 2006, 4:20 PM
#16
valbate avatar

valbate

New Zenner

Join Date:
Nov 2005
Posts:
18
Plugin Contributions:
0

Re: Using TinyMCE Editor with Zen Cart

After days of scouring html area info and getting nowhere in my efforts to make this work in my ssl spce I read flambeau - re tiny

I have now uploaded and appear to have working Tiny MCE thanks to you

I still don't know why HTMLAREA won't work but it's no longer an issue

many thanks flambeau

Val :-)

14 Dec 2006, 2:50 PM
#17
rami avatar

rami

New Zenner

Join Date:
Jan 2006
Location:
Finland
Posts:
10
Plugin Contributions:
0

Re: Using TinyMCE Editor with Zen Cart

TinyMCE works just fine but uploading images still causes headache. There is all CHMods triple checked and so on but still when I try upload new image through ibrowser i get error message: "Error occurred while handling file upload. Please try again."

Has anyone faced same problem than me?

Already so thankful and sincerely Yours,

Rami

20 Dec 2006, 2:22 PM
#18
masilon avatar

masilon

New Zenner

Join Date:
Dec 2006
Posts:
1
Plugin Contributions:
0

Re: Using TinyMCE Editor with Zen Cart

Yes, I had the same problem. I solved it changing the following folders Chmod to 777:

/admin/tiny_mce/plugins/ibrowser/temp
/admin/tiny_mce/plugins/ibrowser/scripts/phpThumb/cache

20 Dec 2006, 5:44 PM
#19
rami avatar

rami

New Zenner

Join Date:
Jan 2006
Location:
Finland
Posts:
10
Plugin Contributions:
0

Re: Using TinyMCE Editor with Zen Cart

Thank for Your answer but I have changed those mode 777 as well... I'm starting to be littlebit desperate with issue... Is it possible that server causes this kind of problem?

13 Jan 2007, 3:26 PM
#20
cerberus avatar

cerberus

New Zenner

Join Date:
Jan 2007
Posts:
7
Plugin Contributions:
0

Re: Using TinyMCE Editor with Zen Cart

Hi...noob zenner here!

Got this working with ezpages and products, but can't seem to get it working for define pages editor. I pasted the same code as I did with the others, can someone help?

Thx/ Doug