Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2008
    Posts
    99
    Plugin Contributions
    0

    Default Adding a richtext editor to edit product descriptions

    Hi all
    I added a WYSIWYG editor in a custom page to amend the product descriptions (products_description.products_description) more easily. It also lets me add color and change text size. Hope it's of some use

    Download the WYSIWYG editor from openwebware.com
    and make a donation to say thanks to the guy that wrote this (not me, honest)

    Upload the files to your includes/js/ directory into a new folder. eg openwysiwyg_v147 as below

    Add these lines to your custom page tpl_mypage_DEFAULT.php after the require ($define_page);

    <!--INCLUDES FOR WYSIWYG EDITOR-->
    <script language="JavaScript" type="text/javascript" src="includes/js/openwysiwyg_v147/scripts/wysiwyg-popup.js"></script>
    <script language="JavaScript" type="text/javascript" src="includes/js/openwysiwyg_v147/scripts/wysiwyg-color.js"></script>
    <script language="JavaScript" type="text/javascript" src="includes/js/openwysiwyg_v147/scripts/wysiwyg.js"></script>
    <script language="JavaScript" type="text/javascript" src="includes/js/openwysiwyg_v147/scripts/wysiwyg-settings.js"></script>

    Immediately after you create the form eg

    echo zen_draw_form('productsEditForm', zen_href_link(FILENAME_PRODUCTS_EDIT, '','SSL'),'POST'); ?>

    add
    <script language="javascript1.2">
    // attach the editor to the textarea with a matching identifier'.
    WYSIWYG.attach('products_description');
    </script>

    Now create a textarea. Note that the id of the textarea must match the above WYSIWYG.attach call

    <textarea rows="15" name="products_description" id="products_description">db_text</textarea>
    Click when finished &nbsp;<input type="submit" name='submit' value="Done">

    and close the form...

    </form>

    The form handler takes the contents, in my example, from $_POST['products_description].

    Hope that's all clear and correct. If you want to pre-populate the textarea with your products_description insert the query result where I've written db_text.

    The editor has a few non-funky features such as opening new windows to handle text color and it flags a couple of deprecated command errors in firebug. If anyone wants to provide feedback on how these can be tidied up I'd be grateful as the openwebware page doesn't seem to have a forum to discuss this. Similarly with any security issues the code might raise. Credit should go to the openwebware guy for the editor code, I've only shoehorned it into zencart.
    Steve
    Attached Images Attached Images  

  2. #2
    Join Date
    Jul 2009
    Posts
    1
    Plugin Contributions
    0

    Default Re: Adding a richtext editor to edit product descriptions

    looks good but were is Add these lines to your custom page tpl_mypage_DEFAULT.php after the require ($define_page);and were do i put all this > <!--INCLUDES FOR WYSIWYG EDITOR-->
    <script language="JavaScript" type="text/javascript" src="includes/js/openwysiwyg_v147/scripts/wysiwyg-popup.js"></script>
    <script language="JavaScript" type="text/javascript" src="includes/js/openwysiwyg_v147/scripts/wysiwyg-color.js"></script>
    <script language="JavaScript" type="text/javascript" src="includes/js/openwysiwyg_v147/scripts/wysiwyg.js"></script>
    <script language="JavaScript" type="text/javascript" src="includes/js/openwysiwyg_v147/scripts/wysiwyg-settings.js"></script>

    Immediately after you create the form eg

    echo zen_draw_form('productsEditForm', zen_href_link(FILENAME_PRODUCTS_EDIT, '','SSL'),'POST'); ?>

    add

    <script language="javascript1.2">
    // attach the editor to the textarea with a matching identifier'.
    WYSIWYG.attach('products_description');
    </script>

    Now create a textarea. Note that the id of the textarea must match the above WYSIWYG.attach call

    <textarea rows="15" name="products_description" id="products_description">db_text</textarea>
    Click when finished &nbsp;<input type="submit" name='submit' value="Done">

    and close the form...

    </form>

 

 

Similar Threads

  1. v139h Bulk Edit Product Names & Descriptions
    By pinksparklegirl in forum General Questions
    Replies: 15
    Last Post: 17 Mar 2015, 12:44 PM
  2. v151 I suddenly cannot add or edit Product Descriptions!
    By Crummler in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 24 Jul 2013, 06:41 PM
  3. v151 Edit html within product descriptions
    By thornhillguy in forum General Questions
    Replies: 1
    Last Post: 29 Mar 2013, 06:34 PM
  4. v150 HTML Editor for product descriptions all show blank
    By laydback in forum Upgrading to 1.5.x
    Replies: 6
    Last Post: 14 Jun 2012, 04:02 AM
  5. suddenly can't edit product descriptions!
    By p m in forum General Questions
    Replies: 3
    Last Post: 23 Oct 2006, 03:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg