Page 7 of 7 FirstFirst ... 567
Results 61 to 67 of 67
  1. #61
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,221
    Plugin Contributions
    1

    Default Re: Order Comments Status/Update Boilerplate

    Quote Originally Posted by simon1066 View Post
    Thank you for updating this mod @swguy.

    Fresh install of this mod on an existing ZC v1.57c store. HTML tags don't seem to be carried over to the comments field on the order details page.

    I can for instance wrap some boilerplate comment text in <b></b>, this shows as bold in the order_comment_boilerplate page. Not so if I add the Predefined Comments to the order details page.

    (I can successfully add HTML tagged text to the order details comments field, manually)

    Edit: I am not using CKEditor
    This seems to be caused by the introduction of this new code in Admin/orders.php

    Code:
    $(document).ready(function() {
          $('#predefined_comments').change(function(){
            val = $(":selected", this).index();
            <?php if ($editor_handler !== '') { ?>
            $('textarea[name="comments"]').val(commentsArray[val].comment); 
            <?php } else { ?>
            var html_comment = $.parseHTML(commentsArray[val].comment);
            var text = $(html_comment).text(); 
            $('textarea[name="comments"]').html(text); 
            <?php } ?>
          });
        });
        </script>
    <?php /* EOF Zen4All Order Comment 2 of 3 */ ?>
    as opposed to the previous code, which worked, of

    Code:
    $(document).ready(function() {
          $('#predefined_comments').change(function(){
            val = $(":selected", this).index();											  
            $('textarea[name="comments"]').val(commentsArray[val].comment);	
          });
        });
        </script>
    <?php /* EOF Zen4All Order Comment 2 of 3 */ ?>
    Simon

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

    Default Re: Order Comments Status/Update Boilerplate

    Quote Originally Posted by swguy View Post
    Simon: if you want to use HTML in your predefined comments, use CKEditor on the order details page. (You may need to make the change below.)

    @n8pbm: Please replace the ready() function in orders.php (around line 481) with the following:

    Code:
        $(document).ready(function() {
          $('#predefined_comments').change(function(){
            val = $(":selected", this).index();
            <?php if ($editor_handler !== '') { ?>
            CKEDITOR.instances['comments'].setData(commentsArray[val].comment); 
            <?php } else { ?>
            var html_comment = $.parseHTML(commentsArray[val].comment);
            var text = $(html_comment).text(); 
            $('#comments').val(text); 
            <?php } ?>
          });
        });
    Thank you, styling the comments with CKEDITOR has worked - once I enabled it. I've never liked using the editor, I might have to configure the way it wraps everything in <p> tags and how it handles new lines/carriage returns.
    Simon

  3. #63
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,622
    Plugin Contributions
    123

    Default Re: Order Comments Status/Update Boilerplate

    If you really want to type HTML into the non-CKEditor textarea block, you can do that if you tweak the else branch of the ready() function. Right now, it strips out any HTML. This was a guess as to correct behavior on my part - please feel free to customize to your own taste.
    That Software Guy. My Store: Zen Cart Modifications
    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. #64
    Join Date
    Mar 2005
    Posts
    107
    Plugin Contributions
    0

    Default Re: Order Comments Status/Update Boilerplate

    I did not type anything in the comments section before selecting from the dropdown. I just opened the order and then select from the dropdown and nothing happens.

    I will give the code you provided as soon as I can.

    Thank you

  5. #65
    Join Date
    Mar 2005
    Posts
    107
    Plugin Contributions
    0

    Default Re: Order Comments Status/Update Boilerplate

    I updated the file with the new code and everything appears to be working.

    Thank you for taking the time to work on this. I really appreciate it.

  6. #66
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,622
    Plugin Contributions
    123

    Default Re: Order Comments Status/Update Boilerplate

    I'm going to update the mod to use this new code for CKEditor but the old code for plain text - I think this is the best compromise. I have my updated code for plain text in there and commented out in case someone prefers that behavior.
    That Software Guy. My Store: Zen Cart Modifications
    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.

  7. #67
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,221
    Plugin Contributions
    1

    Default Re: Order Comments Status/Update Boilerplate

    As designed, adding a second boilerplate entry to the order comments box replaces the first. I have occasion to add more than one boilerplate comment at a time. With a bit of help from Stackoverflow I made a stab at it:

    Note: this only works if, like me, you don't use ckeditor and are adding HTML code manually to the boilerplate comments.

    The new line is in red and replaces the line above it,

    admin/orders.php

    Code:
    $(document).ready(function() {
          $('#predefined_comments').change(function(){
            val = $(":selected", this).index();
            <?php if ($editor_handler !== '') { ?>
            CKEDITOR.instances['comments'].setData(commentsArray[val].comment); 
            <?php } else { ?>
               /*  Use this instead if you want to strip out HTML
            var html_comment = $.parseHTML(commentsArray[val].comment);
            var text = $(html_comment).text(); 
            $('#comments').val(text); 
                */
           // $('textarea[name="comments"]').val(commentsArray[val].comment);
    	  $('textarea[name="comments"]').val($('textarea[name="comments"]').val() +(commentsArray[val].comment) + "\n");
            <?php } ?>
          });
        });
    Last edited by simon1066; 25 May 2021 at 05:42 PM.
    Simon

 

 
Page 7 of 7 FirstFirst ... 567

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

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR