Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Nov 2015
    Location
    New Jersey USA
    Posts
    64
    Plugin Contributions
    0

    help question Unwanted characters showing up in Comments section of Admin - Orders

    Have latest Edit Orders, Easy Populate, Image Handler4, Zen Lightbox installed.

    Updating my site to be responsive and in final stages of testing. Made up test customer and placed some orders, made up invoices, emailed, etc. All looks ready to go except I see this in my Comments section of Order Status History & Comments:

    Click image for larger version. 

Name:	1.jpg 
Views:	140 
Size:	71.9 KB 
ID:	16022

    The customer receives email that looks fine:

    Click image for larger version. 

Name:	2.jpg 
Views:	112 
Size:	44.6 KB 
ID:	16023

    But if he logs into his account and looks online he sees the extra characters in comments instead of neatly formatted message.

    In the past my Admin comments section looked just the same as the email looks- correctly formatted and without the "\r\n\r\nJoe,\r\n\r\n" characters. Not sure what I did but think it might have something to do with updating database tables.

    Looking for advice on how to correct the formatting issues and get everything looking normal again in the Admin comments order section and for the customer who checks comments online.

    Thanks, Ed

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Unwanted characters showing up in Comments section of Admin - Orders

    I assume that you are using ZenCart v1.5.4 but from what version did you upgrade?

    Use phpmyadmin and check what collation your tables are
    latin or utf8

    If the former use this to change them
    https://www.zen-cart.com/downloads.php?do=file&id=1318
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Nov 2015
    Location
    New Jersey USA
    Posts
    64
    Plugin Contributions
    0

    Default Re: Unwanted characters showing up in Comments section of Admin - Orders

    Kobra thanks for the reply.

    Yes the new responsive test site is v1.5.4. Version info:

    Database Patch Level: 1.5.4
    v1.5.4 [2016-01-22 15:08:29] (Version Update 1.5.3->1.5.4)
    v1.5.3 [2016-01-22 15:08:29] (Version Update 1.5.2->1.5.3)
    v1.5.2 [2016-01-22 15:08:28] (Version Update 1.5.1->1.5.2)
    v1.5.1 [2016-01-22 15:08:22] (Version Update 1.5.0->1.5.1)
    v1.5.0 [2016-01-20 17:39:37] (Fresh Installation)

    Both old and new site databases say Server charset: UTF-8 Unicode (utf8).

    The site that is soon to be replaced is v1.5.1. I copied some database tables over from it's MySQL5.1 database into the new database which is 5.5.47-cll . The only issues have observed so far in testing is this Comments text issue, fingers crossed.

    Ted

  4. #4
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: Unwanted characters showing up in Comments section of Admin - Orders

    That character sequence is a carriage return with a line feed... Is a windows system involved somehow in all this?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Nov 2015
    Location
    New Jersey USA
    Posts
    64
    Plugin Contributions
    0

    Default Re: Unwanted characters showing up in Comments section of Admin - Orders

    No Windows system involved except on my PC at home. Here is server info:



    Server Host: xxxxxxx.com (xxx.xx.20.51) Database Host: localhost (127.0.0.1)

    Server OS: Linux 2.6.32-604.30.3.lve1.3.63.el6.x86_64 Database: MySQL 5.5.47-cll

    Server Date: 02/06/2016 18:38:33 Database Date: 02/06/2016 18:38:33

    Server Up Time: 18:38:33 up 15 days, 4:22, 0 users, load average: 1.15, 1.29, 1.64 HTTP Server: Apache

    PHP Version: 5.5.31 (Zend: 2.5.0) PHP Memory Limit: 128M PHP Safe Mode: Off

    PHP File Uploads: On Max Size: 2M POST Max Size: 8M

    Database Data Size: 7,518 kB Database Index Size: 1,969 kB

    Ted

  6. #6
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Unwanted characters showing up in Comments section of Admin - Orders

    Both old and new site databases say Server charset: UTF-8 Unicode (utf8).
    Actually, what is the collation of the tables - use phpmyadmin and look at the right of each table
    Zen-Venom Get Bitten

  7. #7
    Join Date
    Nov 2015
    Location
    New Jersey USA
    Posts
    64
    Plugin Contributions
    0

    Default Re: Unwanted characters showing up in Comments section of Admin - Orders

    OK. The 96 Zen-Cart specific tables all have "utf8_general_ci" under Collation column.

    The responsive template I am using adds a 97th table and it has "latin1_swedish_ci" under Collation. Another difference with that table is that it has "InnoDB" under Type column where all the other tables have "MyISAM" under Type.

    The info in this table adds Settings under Admin>Tools and lets me change the color scheme of site, tagline, logo image, and a couple other things easily. It's been working fine as far as I can tell.

    At the bottom in phpMyAdmin I see this text: " 97 tables | Sum | 24,903 | MyISAM | latin1_swedish_ci | 9.3 Mib | 9.9 KiB "

    Thanks, Ted
    Last edited by Ted Grapler; 7 Feb 2016 at 04:25 AM. Reason: typo

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,401
    Plugin Contributions
    87

    Default Re: Unwanted characters showing up in Comments section of Admin - Orders

    It's got nothing to do with the CHARSET (or DB_CHARSET used). It's the fact that the information, upon recording in the database, was over-prepared.

    If you look at the orders_history record for the order in question, you'll see data like
    Code:
    \\r\\n\\r\\n
    See those additional slashes, that's what's causing the CRLF (\r\n) to display as \r\n ... the data with the backslashes have been run through zen_db_input and then inserted into the database using zen_db_perform.

  9. #9
    Join Date
    Nov 2015
    Location
    New Jersey USA
    Posts
    64
    Plugin Contributions
    0

    Default Re: Unwanted characters showing up in Comments section of Admin - Orders

    Thanks.

    I checked order #518 in the database table orders_status_history and under "comments" it shows

    -\r\n\r\nJoe,\r\n\r\nHave received your payment, thank you. The TEST ITEM will be shipping out tomorrow. The tracking number is sdfgskldfjsdlkfjsdlkfjsd654684.\r\n\r\nLook forward to doing more business.\r\n\r\nThanks, Ted

    Checked out the link- Zen Cart Rule #3: Don’t Over-Prepare . Not sure how well I understand but did use info to do a search using Developer's Tools and came up with some things to check under ADMIN/orders.php:

    Line #184 : '" . zen_db_input($comments) . "')");

    And this under ADMIN/edit_orders.php:

    Line #224 : 'comments' => zen_db_input($comments),

    Looked for stray single- (‘) or double-quotes (“) . Tried changing a things but just came up with blank pages in Admin when I tried to click on the orders page.

  10. #10
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,401
    Plugin Contributions
    87

    Default Re: Unwanted characters showing up in Comments section of Admin - Orders

    Right, I misspoke regarding the extra backslashes in the data. What you should be seeing in the comments field is:
    Code:
    Joe,
    
    Have received your payment, thank you. The TEST ITEM will be shipping out tomorrow. The tracking number is sdfgskldfjsdlkfjsdlkfjsd654684.
    
    Look forward to doing more business.
    
    Thanks, Ted
    where those \r\n sequences were converted to their CRLF equivalents.

    I'm pretty sure that it's the edit_orders processing, as the built-in orders.php handling performs the database insert "directly" (i.e. using the $db->Execute function) while edit_orders uses the zen_db_perform function.

    You might try editing your copy of edit_orders.php, changing this block:
    Code:
          $sql_data_array = array(
            'orders_id' => (int)$oID,
            'orders_status_id' => zen_db_input($status),
            'date_added' => 'now()',
            'customer_notified' => zen_db_input($customer_notified),
            'comments' => zen_db_input($comments),
          );
          // BEGIN TY TRACKER 3 - INCLUDE DATABASE FIELDS IN STATUS UPDATE
          foreach($track_id as $id => $track) {
            $sql_data_array['track_id' . $id] = zen_db_input($track);
          }
          unset($id); unset($track);
          // END TY TRACKER 3 - INCLUDE DATABASE FIELDS IN STATUS UPDATE
          zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
    removing the calls to zen_db_input, as follows:
    Code:
          $sql_data_array = array(
            'orders_id' => (int)$oID,
            'orders_status_id' => $status,
            'date_added' => 'now()',
            'customer_notified' => $customer_notified,
            'comments' => $comments,
          );
          // BEGIN TY TRACKER 3 - INCLUDE DATABASE FIELDS IN STATUS UPDATE
          foreach($track_id as $id => $track) {
            $sql_data_array['track_id' . $id] = $track;
          }
          unset($id); unset($track);
          // END TY TRACKER 3 - INCLUDE DATABASE FIELDS IN STATUS UPDATE
          zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v139h Scandinavian characters not showing in order comments in admin
    By Dexter71 in forum General Questions
    Replies: 0
    Last Post: 7 May 2014, 02:17 PM
  2. v151 Orders placed on new ZC Store Coming up on OSC Max Admin Orders Section
    By acrenshaw in forum Managing Customers and Orders
    Replies: 1
    Last Post: 18 Jan 2013, 02:08 AM
  3. Orders are showing only in English section
    By Franck69 in forum Managing Customers and Orders
    Replies: 2
    Last Post: 14 Jul 2008, 05:02 PM
  4. Customer Comments section missing from my admin?
    By McGill in forum General Questions
    Replies: 2
    Last Post: 20 May 2008, 04:42 PM

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