Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

TinyMCE problem


pafranklin

Recommended Posts

Hi there, I have installed the TinyMCE editor in order to simply be able to use this within the Product description area. However, when I now click on a product from the admin area to edit it the short description and header tage fields are all appearing to be empty.

 

This seems to indicate that when I edit a product, I will have to re-enter the header tags and product short description. This cannot be right and any suggestion would be helpful please.

 

The install was easy with amends to the admin/categories.php and the admin/includes/functions/html_output.php.

 

The instructions for this install were...........

 

Installation

- Download TinyMCE from http://tinymce.moxiecode.com/

 

- Upload tiny_mce/*.* (found in /jscripts/ in tar-file/zip-file) into your osC admin catalog (catalog/admin/includes/javascript/)

or to where you prefer, just remember to alter the src-property below.

 

==========

Files to be backed up and changed:

admin/categories.php

admin/includes/functions/html_output.php

=========

 

- In admin/categories.php

Find:

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

 

After add:

<script language="javascript" type="text/javascript" src="includes/javascript/tiny_mce/tiny_mce.js"></script>

<script language="javascript" type="text/javascript">

tinyMCE.init({

mode : "textareas",

editor_selector : "mceEditor",

theme : "advanced",

theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,jus

tifyright, justifyfull,bullist,numlist,undo,redo,link,unlink",

theme_advanced_buttons2 : "",

theme_advanced_buttons3 : "",

theme_advanced_toolbar_location : "top",

theme_advanced_toolbar_align : "left",

theme_advanced_path_location : "bottom",

extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|v

space|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade

],font[face|size|color|style],span[class|align|style]"

});

</script>

 

 

Find:

 

<tr>

<td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_DESCRIPTION; ?></td>

<td><table border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>

<td class="main"><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>

</tr>

 

Replace with:

 

<tr>

<td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_DESCRIPTION; ?></td>

<td><table border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>

<td class="main"><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', 'mceEditor', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>

</tr>

 

UPDATE:

The descriptions were not showing up in the textarea boxes of the Header Tags when editing a page.

The fix is do a search of >> textarea << in the admin/categories.php page.

For every instance of a textarea, add >> '', << after the last number, in the same place where >> 'mceEditor', << is located in the code above.

 

=====

 

- In admin/includes/functions/html_output.php

Find:

 

// Output a form textarea field

function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {

$field = '<textarea name="' . tep_output_string($name) . '" wrap="' . tep_output_string($wrap) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';

if (tep_not_null($parameters)) $field .= ' ' . $parameters;

$field .= '>';

 

Replace with:

 

// Output a form textarea field

function tep_draw_textarea_field($name, $wrap, $width, $height, $class, $text = '', $parameters = '', $reinsert_value = true) {

$field = '<textarea name="' . tep_output_string($name) . '" wrap="' . tep_output_string($wrap) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';

if (tep_not_null($class)) $field .= ' ' . 'class="' . tep_output_string($class) . '"';

if (tep_not_null($parameters)) $field .= ' ' . $parameters;

$field .= '>';

 

 

=====

To add tinymce to another textarea besides product description, just add the javascript to the relevant page. Then find the textarea code and add >>> 'mceEditor', <<< to it in the same order as shown above in the products_description field.

======

 

Thats it!

Now you can customize your editor according to the documentation on http://tinymce.moxiecode.com/.

(The above given parameter list is just an example.)

 

Please can you suggest what I need to do to ensure that I do not loose the contents of the short description and header tag areas? Should I add TinyMCE to these as well (although I do not really want to)?

 

Many thanks.

 

Paul.

You will never learn if you don't try. And boy am I trying....!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...