Opencart (www.opencart.com) is an open source PHP-based online e-commerce solution that has powerful features and a lot of extension for customization.

Today i would like to share how you can add ckeditor feature to the Catalog > Reviews “Text” field (textarea). This tips you can apply too for your extension development.

Step 1

Open review_form.tpl from ‘/admin/view/template/catalog’


You can find the code where show textarea code:

<td><textarea name="text" cols="60" rows="8"><?php echo $text; ?></textarea>

Add id=”description1″ to the textarea, new updated code is shown as below:

<td><textarea name="text" cols="60" rows="8" id="description1"><?php echo $text; ?></textarea>


Step 2

Put extra code at the bottom before <?php echo $footer; ?>

<script type="text/javascript" src="view/javascript/ckeditor/ckeditor.js"></script>
<script type="text/javascript"><!--
CKEDITOR.replace('description1', {
 filebrowserBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
 filebrowserImageBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
 filebrowserFlashBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
 filebrowserUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
 filebrowserImageUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
 filebrowserFlashUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>'
});
//--></script>
<?php echo $footer; ?>

Step 3

Save the file and reload the page, done!

For more my extension, you can go to this LINK. Cheers!