Results 1 to 10 of 83

Hybrid View

  1. #1
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,303
    Plugin Contributions
    1

    Default Re: Order Comments Status/Update Boilerplate

    Quote Originally Posted by apollowilcox View Post
    Just updated the CKEditor and now this Boilerplate comments will not copy into the comments box. The editor seems to work fine, and i've re-installed the OC Boilerplate plug-in just cause. No change. Feels like something simple but I can't find it. No error logfile being created.

    Can someone send me a hint? Thanks,
    I've tested this by upgrading to ckeditor5 on ZC v1.5.8a. The appropriate lines of code on my install of this plugin is as folllows, with the line that gives an error in browser dev console highlighted in red.

    Code:
        $(document).ready(function() {
          $('#predefined_comments').change(function(){
            val = $(":selected", this).index();
            <?php if ($editor_handler !== '') { ?>
            CKEDITOR.instances['comments'].insertHtml((commentsArray[val].comment) + '<br>'); 
            <?php } else { ?>
            /* Using Plain Text Editor */
            $('textarea[name="comments"]').val($('textarea[name="comments"]').val() +(commentsArray[val].comment) + '\n');
            /*  Use this instead of above line if you want to strip out HTML 
            var html_comment = $.parseHTML(commentsArray[val].comment);
            var text = $(html_comment).text(); 
            $('#comments').val($('#comments').val() +(text) + '\n'); 
            */
            <?php } ?>
          });
        });
    I haven't much time at the moment to debug this or compare it with the latest plugin code - so your code might be different.
    Simon

  2. #2
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,303
    Plugin Contributions
    1

    Default Re: Order Comments Status/Update Boilerplate

    Quote Originally Posted by simon1066 View Post
    I've tested this by upgrading to ckeditor5 on ZC v1.5.8a. The appropriate lines of code on my install of this plugin is as folllows, with the line that gives an error in browser dev console highlighted in red.

    Code:
        $(document).ready(function() {
          $('#predefined_comments').change(function(){
            val = $(":selected", this).index();
            <?php if ($editor_handler !== '') { ?>
            CKEDITOR.instances['comments'].insertHtml((commentsArray[val].comment) + '<br>'); 
            <?php } else { ?>
            /* Using Plain Text Editor */
            $('textarea[name="comments"]').val($('textarea[name="comments"]').val() +(commentsArray[val].comment) + '\n');
            /*  Use this instead of above line if you want to strip out HTML 
            var html_comment = $.parseHTML(commentsArray[val].comment);
            var text = $(html_comment).text(); 
            $('#comments').val($('#comments').val() +(text) + '\n'); 
            */
            <?php } ?>
          });
        });
    I haven't much time at the moment to debug this or compare it with the latest plugin code - so your code might be different.
    Edit: relevant file is admin/orders.php
    Simon

  3. #3
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,544
    Plugin Contributions
    127

    Default Re: Order Comments Status/Update Boilerplate

    Referencing CKEditor no longer works in CKEditor 5.
    Here are some details on how to fix this:

    https://stackoverflow.com/questions/...tor-5-instance
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  4. #4
    Join Date
    Sep 2014
    Location
    Indiana
    Posts
    123
    Plugin Contributions
    0

    Default Re: Order Comments Status/Update Boilerplate

    Lol... Thanks, but well over my head.

    My code does look like what Simon offered. Guess I'll wait for the update to the order-comments-boilerplate plug-in.
    Last edited by apollowilcox; 9 Sep 2024 at 03:28 PM.

  5. #5
    Join Date
    Sep 2014
    Location
    Indiana
    Posts
    123
    Plugin Contributions
    0

    Default Re: Order Comments Status/Update Boilerplate

    Using the developer tools in the browser, I get this comment when attempting to insert a comment from the Order-comments-boilerplate at the customer order screen:

    index.php?cmd=orders&oID=335750&action=edit:753

    Uncaught ReferenceError: CKEDITOR is not defined
    at HTMLSelectElement.<anonymous> (index.php?cmd=orders&oID=335750&action=edit:753:3)
    at HTMLSelectElement.dispatch (jquery-3.6.1.min.js:2:43064)
    at y.handle (jquery-3.6.1.min.js:2:41048)


    Does that lead anyone to any specific suggestions?

    Thank you!

    ZC 1.5.8a; PHP 8.2.23

  6. #6
    Join Date
    Jan 2007
    Location
    Illinois, USA
    Posts
    329
    Plugin Contributions
    0

    Default Re: Order Comments Status/Update Boilerplate

    I got Boiler plate to work on 2.1 editing the orders.php file

    • CKEditor 5’s visible editor is not updating at all because CKEditor 5 ignores direct DOM updates (innerHTML) and will immediately revert to its internal model.
    • The only reliable way to update CKEditor 5 is via its editor instance API: editor.setData(...).

    So I rebuilt the handler to find the CKEditor 5 editor instance (even if Zen Cart stores it in a non-obvious place) and then insert using:

    • editor.getData() + editor.setData(current + comment)
    NTO: building a better network thru collaboration
    www.needtoorder.com | www.coffeewitheinstein.com

  7. #7
    Join Date
    Sep 2014
    Location
    Indiana
    Posts
    123
    Plugin Contributions
    0

    Default Re: Order Comments Status/Update Boilerplate

    Thanks Carbonless.

    We really miss using this plug-in and would love to see it back in action. Is your comment addressing that fact that it will not function when the ZC editor is using CKEditor vs Plain text?

    If so, can you help me with where you placed that line - or what line you replaced?

    Thank you.

 

 

Similar Threads

  1. Replies: 0
    Last Post: 17 Oct 2013, 04:32 PM
  2. v151 Order Status Update / Append Comments & Noitify Customer
    By Brent in forum Managing Customers and Orders
    Replies: 4
    Last Post: 16 Oct 2013, 07:57 PM
  3. Change Email Subject of Status Update Messages e.g. Order Update XXXX
    By apemusic in forum Managing Customers and Orders
    Replies: 4
    Last Post: 13 Oct 2010, 08:42 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