Jump to content

Display Product Options on Confirmation Emails


Recommended Posts

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.




Peter Ward

Link to comment
Share on other sites

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}-->
                {$product.name}<br />
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.)
Link to comment
Share on other sites

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:  


Customer Comments:&nbsp;{$DATA.customer_comments}</p>
But if I remove that it still doesn't work!!!
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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";}

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...