AETtec Posted March 19, 2020 Share Posted March 19, 2020 (edited) Hello. Im so newbie at php and i want show the reference of each product on a near/visible place around button add to cart and price. So so i did the next modification: My version of PS is 1.7.6.1 1) File "only-reference.tpl" created on next location: /themes/newyork_home1/templates/catalog/_partials/only-reference.tpl and writed the next code inside the file: {if isset($product.reference_to_display)} <div class="product-reference"> <label class="label">{l s='Reference' d='Shop.Theme.Catalog'} </label> <span itemprop="sku">{$product.reference_to_display}</span> </div> {/if} 2) Modify the next file: /themes/newyork_home1/templates/catalog/product.tpl and insert this code: {block name='only-reference'} {include file='catalog/_partials/only-reference.tpl'} {/block} The result...? yes the reference is on the correct place now, but it doesnt refresh when i change to other combination of the product, so i need help to fix it. Please! Edited July 20, 2020 by AETtec edit title and adding more info (see edit history) Link to comment Share on other sites More sharing options...
AETtec Posted March 23, 2020 Author Share Posted March 23, 2020 should i post it on other place? i didnt get help pls =( Link to comment Share on other sites More sharing options...
Juan-Shunfa Posted July 17, 2020 Share Posted July 17, 2020 Im interested on it, but didnt know how to refresh the Reference when the client clic on other variation of the product. Help us! Link to comment Share on other sites More sharing options...
AETtec Posted July 20, 2020 Author Share Posted July 20, 2020 I edit the title of the post right now , i still having this issue. Link to comment Share on other sites More sharing options...
Guest Posted July 20, 2020 Share Posted July 20, 2020 Simple solution. Create a minimodule and use hookHeader in it. Probably like this. public function hookHeader($params) { if(Tools::getValue('id_product')) { $product_reference= $this->context->product->reference_to_display; $this->context->smarty->assign(array( 'my_reference_to_display' => product_reference, )); } } tpl: <span itemprop="sku">{$my_reference_to_display}</span> Link to comment Share on other sites More sharing options...
Guest Posted July 20, 2020 Share Posted July 20, 2020 Or add your tpl var_dump and show variables {$product|@var_dump} Link to comment Share on other sites More sharing options...
AETtec Posted July 20, 2020 Author Share Posted July 20, 2020 1 hour ago, Guest said: Simple solution. Create a minimodule and use hookHeader in it. Probably like this. public function hookHeader($params) { if(Tools::getValue('id_product')) { $product_reference= $this->context->product->reference_to_display; $this->context->smarty->assign(array( 'my_reference_to_display' => product_reference, )); } } tpl: <span itemprop="sku">{$my_reference_to_display}</span> Thank you for the answer, but i dont know how to create a minimodule, i saw this tool : https://validator.prestashop.com/generator But i dont know nothing about php, i tried creating one with the tool and editing the php file with the 1º code you shared, then tried to install but it give me an error. 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