Dnia 29.05.2024 o 8:26 PM, María_Amieva napisał:Hi.
I have a similar problema. On product page I want to show the reference and the supplier reference, I have achieved this
{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} {if isset($product.supplier_reference) && $product.supplier_reference != ''} <div class="product-supplier-reference"> <label class="label">{l s='Referencia del fabricante' d='Shop.Theme.Catalog'} </label> <span itemprop="sku">{$product.supplier_reference}</span> </div> {/if}but when a product has combinations and you change to another combination, the page refreshes, but it continues to show the references of the product, not the combination
I have tried with the code that WissQQ says by overriding the ProductController.php, but in product.tpl when I do a var_dump of the $group variable it returns null, so I don't know what I'm doing wrong, nor if exactly this code will change me references when changing to another combination.
Can anybody help me?
Thanks
Edit: I'm using prestashop 8.1.3
Problem is you are showing default attribute on page load. Once you change combination it will reload parts of template using Ajax request.
To do what you want, you will have to return new option with ajax response. You can either override AjaxRefresh action inside ProductController and add new template to be returned or do it using Javascript after new tempaltes are returned just call your own module Controler that will return this value.
Another way you could simply add your code to template that is returned with ajax response and it should include proper reference.