Wigbert Posted December 22, 2013 Share Posted December 22, 2013 Hi, in my front office, I want to display the EAN13 number. To do this, it worked fine just adding the line: {if !empty($product->ean13)}<p>{l s='EAN:'} {$product->ean13}</p>{/if} into the file "products.tpl". Now I have introduced colors as attributes and try to reduce the number of products in the shop. For my product with let's say 6 colors, I do have 6 different EAN numbers. However, the change above will always point to the same product EAN (the one inserted in BO in the product information tab). Is there any way to dynamically show the EAN entered in the combinations tab of BO? I have tried to use the $combination variable, put this doesn't provide the ean13 member. Thanks for your help Link to comment Share on other sites More sharing options...
doekia Posted December 22, 2013 Share Posted December 22, 2013 You need to change the function updateDisplay in product.js, recover the EAN you have associated with the product_attribute ... Link to comment Share on other sites More sharing options...
Wigbert Posted December 23, 2013 Author Share Posted December 23, 2013 Hi doekia, thank your for your reply. Could you give me some more details about it? Also I'm an IT specialist, I'm pretty new to Prestashop and have yet no overview about which file is doing what. The product.js contains large pieces of script code, but where do they end? Wouldn't it be also a good idea to change product.tpl as I already did to show the EAN? The only think is that the $combination variable (array) misses the ean13 field (there are pretty much all other combination data available there). My idea was adding the ean13 field to the $combination(s) variable, so that the product.tpl can show it. Best regards Link to comment Share on other sites More sharing options...
doekia Posted December 23, 2013 Share Posted December 23, 2013 Absolutlty, if you need EAN per combinations you need off cause to collect ean and populate the javascript array to be able to achieve what you want.Most code is in js/product.js inside your themeYou basically need to either change the addCombination() and the updateDisplay()Or make some sort of <script> var fullCombs = {$combinations|@json_encode} </script> and adapt the updateDisplay() or implement some external change handler Choose whatever fits best to you PS: <pre>{$combinations|@print_r:1}</pre> can helps figuring out the structure of the combinations array Link to comment Share on other sites More sharing options...
Wigbert Posted December 27, 2013 Author Share Posted December 27, 2013 OK, I see your point. I'm using almost the default theme, where the addCombination() method in js/prodcut.js is called only from product.tpl with all the variables but not the EAN. I believe it makes sense to query the DB only once an retrieve all the fields. But I couldn't figure out where the actual SQL query to ps_product_attribute is executed. Could you give me an hint on this? Link to comment Share on other sites More sharing options...
Daenu Posted October 19, 2015 Share Posted October 19, 2015 Hi there I have the same problem with ean13. Did you find a solution? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now