Piceno Posted April 23, 2014 Share Posted April 23, 2014 Hello, I need to insert a array javascript in order-confirmation.tpl that have how variable the list of products in the order completed. The array is: var products = { "ID_product", "amount", "quantity" } Can anyone give me some idea? Thanks Link to comment Share on other sites More sharing options...
vekia Posted April 23, 2014 Share Posted April 23, 2014 and if order contains several products ? how to include several products to "var products" ? Link to comment Share on other sites More sharing options...
Piceno Posted April 23, 2014 Author Share Posted April 23, 2014 With a foreach of product like this: {foreach from=$cart->getProducts() item=product name=productLoop} Link to comment Share on other sites More sharing options...
vekia Posted April 24, 2014 Share Posted April 24, 2014 i know how to use smarty code, but i don't know how to implement it in tracking code. there is only simple code: var products = { "ID_product", "amount", "quantity" } as you can see it's an example of pattern for only one product. what if cart will contain more products? Link to comment Share on other sites More sharing options...
jarega88 Posted May 9, 2014 Share Posted May 9, 2014 (edited) I also need to put this code in order-confirmation. To give you an idea, I had to put one like in shopping-cart.tpl and was as follows: {literal} <script type="text/javascript"> var aux = { "productBrand": "{/literal}{Manufacturer::getNameById((int)$product.id_manufacturer)}{literal}", "orderProducts": [ {"id": "{/literal}{$product.id_product}{literal}", "price": "{/literal}{$product.price_wt}{literal}", "qty": "{/literal}{$product.cart_quantity}{literal}"} ] }; </script> {/literal} Edited May 9, 2014 by jarega88 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts