Cpup Posted September 19, 2020 Share Posted September 19, 2020 Hi, I want to add the EAN Code to the customer's order summary. It shows in 'content.product.php' as {$PRODUCT.ean}, but don't know how to call it up in 'content.receipt.php'? Thanks Chris Link to comment Share on other sites More sharing options...
bsmither Posted September 19, 2020 Share Posted September 19, 2020 These details about the product are not saved with the Order Inventory. We will need to fetch them. Fortunately, there is a hook we can use. So, in admin, Manage Hooks, Code Snippets tab, click Add Snippet. On the form shown, below the list of existing snippets: Enabled: Checked Unique ID: addean2receipt@cc62+ Execution Order: 1 Description: Adds the EAN code from Inventory to the Customer Receipt at CubeCart->_complete(). Trigger: class.cubecart.order_summary Version 1.0 Author: https://forums.cubecart.com/topic/56300-order-summary/ PHP Code: <?php // Adds the EAN code from Inventory to the Customer Receipt at CubeCart->_complete(). if(isset($vars['items']) && !empty($vars['items'])){ foreach($vars['items'] as &$addean2receipt_item){ $addean2receipt_item['ean'] = $GLOBALS['db']->select('CubeCart_inventory','ean',array('product_id'=>$addean2receipt_item['product_id']))[0]['ean']; } $GLOBALS['smarty']->assign('ITEMS', $vars['items']); } Save. Then, in the template code, where $ITEMS (the items purchased) are getting listed, use {$item.ean}. Link to comment Share on other sites More sharing options...
Cpup Posted September 19, 2020 Author Share Posted September 19, 2020 Nice one, thanks! it works perfectly!! Chris Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.