bigpedro Posted December 16, 2013 Share Posted December 16, 2013 Hi All We are using CC 5.2.4 and we need to display product options selected on the admin order email and also the customer confirmation email. Looking at the admin:orderreceived email template I can see that there is an entry there for {$product.product_options} which I am assuming is what I am looking for. However the selected product options are not shown. Is this code incorrect? Or am I missing something. any help would be appreciated. Regards Peter Ward Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 16, 2013 Share Posted December 16, 2013 Would you confirm that you can see the chosen product options in the admin Order Summary screen for that order? I am not finding any problems with the code that fetches and loads the email template with the product options. This anomaly has been known to occur if the email template was edited. If these templates were edited, go back to editing the Admin: Order Received template, and choose to view the HTML in Source mode. The code must look like this: <!--{foreach from=$PRODUCTS item=product}--> <tr> <td> {$product.name}<br /> {$product.product_options}</td> <td> {$product.quantity}</td> <td> {$product.price}</td> </tr> <!--{/foreach}--> Note that the {foreach} and {/foreach} are enclosed with HTML comment tags. (A bug fix included in CC523 corrected the templates for the NL email language file.) Quote Link to comment Share on other sites More sharing options...
bigpedro Posted December 16, 2013 Author Share Posted December 16, 2013 Thanks for your reply. I can indeed see the selected options in the admin order screen, they just don't show on the email. The code you have given is perfect and yet the options are still not displayed! The only edit to the email so far is the addition of this: <p> Customer Comments: {$DATA.customer_comments}</p> But if I remove that it still doesn't work!!! Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 16, 2013 Share Posted December 16, 2013 So the {foreach} is, in fact, still enclosed in HTML comment tags. That's good. (Editing the templates in WYSIWYG mode sometimes removes those comment tags, and that messes up the iteration through the list of items.) Still looking at the code. Do you have the admin setting of Notify Admin of New Orders at Pending or Processing? Quote Link to comment Share on other sites More sharing options...
bigpedro Posted December 16, 2013 Author Share Posted December 16, 2013 It was set to processing, but for the purpose of testing this I've changed it to Pending!!!! Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 16, 2013 Share Posted December 16, 2013 Well, I must have fixed something in CC524, as I get the product options listed in my Admin: Order Received message. If you are looking at the email with your email reader set to HTML mode, please try to view the "Plain Text" version of the email. (CubeCart emails are sent in plain text and the HTML variant is like an attachment.) Does the plain text have the product options? Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 16, 2013 Share Posted December 16, 2013 Nothing I could detect in comparing stock CC524 code against the modified code I currently have that would explain your problem. Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 17, 2013 Share Posted December 17, 2013 If possible, please reply with the contents of the product_options column for the table record holding the subject order's specific inventory item that should have options, from the CubeCart_order_inventory table. It's a 'blob'-type column, so you may have to get phpMyAdmin (for example) to show the contents in a blob viewer. The contents will look basically like: a:2{i:0;s:11:"Option1: Val1";i:1;s:11:"Option2: Val2";} Quote Link to comment Share on other sites More sharing options...
bigpedro Posted December 17, 2013 Author Share Posted December 17, 2013 Thanks Brian. If I look at the email as plain text it still doesn't show. I have looked in the database and found the cubecart_order_inventory and then product_options. Each one just says something like [bLOB - 244 B] for example. If I click the link it opens up the entry as a .bin file. Below is an example of the content a:4:{i:0;s:40:"Add HD rear support brg: Yes (+£160.00)";i:1;s:37:"Serial Number of Existing Unit: 12345";i:2;s:66:"Return Carriage Option for Mainland UK Only: Yes Please (+£30.00)";i:3;s:50:"Core Deposit: Required On This Product (+£350.00)";} Thank you for your assistance with this by the way. It is appreciated! Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted December 17, 2013 Share Posted December 17, 2013 I think this issue can be down to encoding or characters in the serialized array. Please check the database, table and all column encoding is utf-8-unicode. New orders should then be fine. Please submit a suport ticket with phpMyAdmin access if you would like us to check this for you. Quote Link to comment Share on other sites More sharing options...
bigpedro Posted December 17, 2013 Author Share Posted December 17, 2013 Thanks Al. That was indeed the problem. All working now thanks to you and support. BSmither - thank you for your assistance also. Much appreciated. Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 17, 2013 Share Posted December 17, 2013 Character encoding? I think I see the likely problem. It's probably the reason why /includes/functions.inc.php, the cc_unserialize() function was created. In /admin/sources/orders.index.inc.php, somewhere near line 425, cc_unserialize() is used to make sure product options are expanded correctly -- should the serialized data have a certain quality to it. (Is there a cc_serialize() needed?) But in the file order.class.php, the PHP function unserialize() is used directly (_retrieveOrder, orderStatus, placeOrder, and getOrderDetails) and it is likely in getOrderDetails() where the unserialize() function is returning false. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.