Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

CKEditor install instructions wrong.


JustinS

Recommended Posts

I'm just wanting to install CKEditor. I've had it before and ran in to this problem, and don't remember where I obtained the correct instructions for 2.3.1.

 

Here's the instructions I have:

 

Step 1

-------

Go to ckeditor.com and download the latest Editor Release (CK Editor, which has superseded FCK Editor)...

_______

Step 2.

-------

Unzip it all, then upload the fckeditor folder and all it's contents to your admin directory.

_______

Step 3.

-------

Amend /public_html/admin/includes/template_top.php

__________

FIND THIS:

----------

<script language="javascript" src="includes/general.js"></script>

_____________

ADD AFTER IT:

-------------

<script type="text/javascript" src="ckeditor/ckeditor.js"></script>

_______

Step 4.

-------

Amend /public_html/admin/categories.php

__________

FIND THIS:

----------

tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : tep_get_products_description($pInfo->products_id, $languages[$i]['id'])));

___________

CHANGE FOR

-----------

tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : tep_get_products_description($pInfo->products_id, $languages[$i]['id'])),' class="ckeditor"');

_______

Step 5.

-------

Upload it and refresh the category (prodcut adding/editing) page. You should see the newly installed Editor. Enjoy!

 

 

Neither of the codes it tells you to find to replace exist in either of those files. Anyone have the correct install for this?

Addon is here:

http://addons.oscommerce.com/info/7112

Edited by JustinS
Link to comment
Share on other sites

@@JustinS

 

I found the two lines no problem. The template_top.php HAS to have the line. It will be before the </head> tag.

 

If your categories.php file doesn't have the reference line, then you will have to manually integrate the editor code.

 

 

 

 

Chris

Link to comment
Share on other sites

@@Chris

 

This is the closest thing to the first code given:

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

 

It's script type though instead of script language...

 

The second piece it asks you to change is no where near anywhere in my admin/categories.php... it doesn't even have anything that has tep_draw_textarea_field in the entire file

Link to comment
Share on other sites

Hmm okay I think i found it, I added the

 

<script type="text/javascript" src="ckeditor/ckeditor.js"></script>

after

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

 

 

 

And then I found what I'm supposed to look for here in categories.php:

 

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

 

If I replace it with

 

tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : tep_get_products_description($pInfo->products_id, $languages[$i]['id'])),' class="ckeditor"');

 

It gives an error in my /admin/categories side. How can I integrate?

Edited by JustinS
Link to comment
Share on other sites

Hi,

 

The easiest way to integrate ckeditor is is................

 

1. Download the latest CKEditor from http://ckeditor.com/download and unpack to catalog/admin/ext/ckeditor - ckeditor.js should now be in the top level of this folder. CKeditor 3.5 (released December 17th, 2010) is included in this zip but please check for a newer version before install.

 

2. Open /catalog/admin/includes/functions/html_output.php and change the tep_draw_textarea_field (around line 252) to read:

 

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

 

3. Open /catalog/admin/includes/template_top.php and add the following before the </head> tag:

 

<?php

if (!defined('USE_CKEDITOR_ADMIN_TEXTAREA')) {

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, set_function) values ('', 'Use CKEditor', 'USE_CKEDITOR_ADMIN_TEXTAREA','true','Use CKEditor for WYSIWYG editing of textarea fields in admin',1,99,now(),'tep_cfg_select_option(array(\'true\', \'false\'),' )");

define ('USE_CKEDITOR_ADMIN_TEXTAREA','true');

}

if (USE_CKEDITOR_ADMIN_TEXTAREA == "true") {

?>

<script type="text/javascript" src="<?php echo tep_href_link('ext/ckeditor/ckeditor.js'); ?>"></script>

<script type="text/javascript" src="<?php echo tep_href_link('ext/ckeditor/adapters/jquery.js'); ?>"></script>

<script type="text/javascript">

$(function() {

var $editors = $('textarea');

if ($editors.length) {

$editors.each(function() {

var editorID = $(this).attr("id");

var instance = CKEDITOR.instances[editorID];

if (instance) { CKEDITOR.remove(instance); }

CKEDITOR.replace(editorID);

});

}

});

</script>

<?php

}

?>

 

4. All installed - just visit your admin site.

To improve is to change; to be perfect is to change often.

 

Link to comment
Share on other sites

@@joli1811

 

Ok I just tried it. I will link my changes.

 

In template_top.php

added:

<?php

if (!defined('USE_CKEDITOR_ADMIN_TEXTAREA')) {

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, set_function) values ('', 'Use CKEditor', 'USE_CKEDITOR_ADMIN_TEXTAREA','true','Use CKEditor for WYSIWYG editing of textarea fields in admin',1,99,now(),'tep_cfg_select_option(array(\'true\', \'false\'),' )");

define ('USE_CKEDITOR_ADMIN_TEXTAREA','true');

}

if (USE_CKEDITOR_ADMIN_TEXTAREA == "true") {

?>

<script type="text/javascript" src="<?php echo tep_href_link('ext/ckeditor/ckeditor.js'); ?>"></script>

<script type="text/javascript" src="<?php echo tep_href_link('ext/ckeditor/adapters/jquery.js'); ?>"></script>

<script type="text/javascript">

$(function() {

var $editors = $('textarea');

if ($editors.length) {

$editors.each(function() {

var editorID = $(this).attr("id");

var instance = CKEDITOR.instances[editorID];

if (instance) { CKEDITOR.remove(instance); }

CKEDITOR.replace(editorID);

});

}

});

</script>

<?php

}

?>

 

</head>

 

notice its right above the </head>

 

Then in html_output.php

 

changed:

 

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

global $HTTP_GET_VARS, $HTTP_POST_VARS;

to:

 

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

global $HTTP_GET_VARS, $HTTP_POST_VARS;

 

Is that the correct way to add that in the html_output.php file?

 

If so, I have an error when I go to my /admin and try to edit a product. it shows:

 

Products Description:

Fatal error: Call to undefined function tep_draw_textarea_field() in/home/content/example/example/html/mystore/admin/categories.php on line 573

 

I think I am adding it wrong in the template_top, when I replace the code with the original, I don't get any error.

Also, on categories.php on line 573, the line only has a } on it. Thanks again.

Edited by JustinS
Link to comment
Share on other sites

@@joli1811

Now I have it added, with ckeditor turned on in "my store" in the administration side and there's no error, but nothing is changed. It's still default. Here is my code.

nothing changed in template_top.php:

 

<?php

if (!defined('USE_CKEDITOR_ADMIN_TEXTAREA')) {

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, set_function) values ('', 'Use CKEditor', 'USE_CKEDITOR_ADMIN_TEXTAREA','true','Use CKEditor for WYSIWYG editing of textarea fields in admin',1,99,now(),'tep_cfg_select_option(array(\'true\', \'false\'),' )");

define ('USE_CKEDITOR_ADMIN_TEXTAREA','true');

}

if (USE_CKEDITOR_ADMIN_TEXTAREA == "true") {

?>

<script type="text/javascript" src="<?php echo tep_href_link('ext/ckeditor/ckeditor.js'); ?>"></script>

<script type="text/javascript" src="<?php echo tep_href_link('ext/ckeditor/adapters/jquery.js'); ?>"></script>

<script type="text/javascript">

$(function() {

var $editors = $('textarea');

if ($editors.length) {

$editors.each(function() {

var editorID = $(this).attr("id");

var instance = CKEDITOR.instances[editorID];

if (instance) { CKEDITOR.remove(instance); }

CKEDITOR.replace(editorID);

});

}

});

</script>

<?php

}

?>

</head>

 

and changes to html_output.php:

 

 

////

// Output a form textarea field

// The $wrap parameter is no longer used in the core xhtml template

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

global $HTTP_GET_VARS, $HTTP_POST_VARS;

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

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

$field .= '>';

if ( ($reinsert_value == true) && ( (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) || (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) ) ) {

if (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) {

$field .= tep_output_string_protected(stripslashes($HTTP_GET_VARS[$name]));

} elseif (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) {

$field .= tep_output_string_protected(stripslashes($HTTP_POST_VARS[$name]));

}

} elseif (tep_not_null($text)) {

$field .= tep_output_string_protected($text);

}

$field .= '</textarea>';

return $field;

}

 

 

Gosh I need to get this added so bad =X I'm out of ideas to make it work personally

Link to comment
Share on other sites

Hi,

are you sure you uploaded to correct directory

admin/ext/ckeditor

 

Looks to me you have a mistake in the categories.php here is a snippet of what it should look like line 557 to 574 original file.

 

<script type="text/javascript"><!--

updateGross();

//--></script>

<?php

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

<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', (empty($pInfo->products_id) ? '' : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>

</tr>

</table></td>

</tr>

<?php

}

?>

Edited by joli1811
To improve is to change; to be perfect is to change often.

 

Link to comment
Share on other sites

Sure didn't, I had it in /admin only, someone told me that admin/ext is if you want your customers to be able to use it, is that wrong? I'll try to install again for like the 10th time with it in ext... think I've already tried though.

Link to comment
Share on other sites

Oh my God I'm such a retard. That was it. LOL

 

Copying these instructions for the next site so I don't derp again.

 

Thanks a lot. You're always super helpful and the input you provide on threads here is greatly appreciated - not only by me I'm sure, many others as well.

 

@@joli1811

Link to comment
Share on other sites

  • 3 months later...

Hi guys.

 

Got this working for editing products. However when I go into Define Languages to edit the privacy text for example it doesnt work correctly.

 

The CKeditor field shows but the file that it outputs messes up and the text displays in the top of the page instead of in the privacy section.

 

Ive tried edditing the privacy.php to include a privacy_text.php but get the same result.

 

Anyone had this issue and got a workaround?

Link to comment
Share on other sites

Hi Nick,

 

Yes it is a bit buggy on the Define languages the easiest is to click view source on the top left side of the ckeditor here you will then see

 

define('TEXT_INFORMATION', 'Put here your Privacy Notice information.');

 

the text must go in between the single quotes it is a bug with the editor who puts the text where he wants.

 

you can still use html text if you want but you would need to create the html text first and then by viewing source copy just the new text between the single quotes.

If using html best create it it on a product page or something so you do not damage the privacy.php / language files

 

Regards

Joli

Edited by joli1811
To improve is to change; to be perfect is to change often.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...