Ah ah tu as testé plus rapidement que moi, j'allais te dire qu'avec le thème classic que tout fonctionnait correctement.
Pour info j'ai utilisé ton hook : displayLinovCalculateur que j'ai rajouté au sein du thème classic dans le fichier : product-variants.tpl et cela fonctionne très bien.
{** * Copyright since 2007 PrestaShop SA and Contributors * PrestaShop is an International Registered Trademark & Property of PrestaShop SA * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License 3.0 (AFL-3.0) * that is bundled with this package in the file LICENSE.md. * It is also available through the world-wide-web at this URL: * https://opensource.org/licenses/AFL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to https://devdocs.prestashop.com/ for more information. * * @author PrestaShop SA and Contributors <contact@prestashop.com> * @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) *} <div class="product-variants js-product-variants"> {hook h='displayLinovCalculateur' product=$product} {foreach from=$groups key=id_attribute_group item=group} {if !empty($group.attributes)} <div class="clearfix product-variants-item"> <span class="control-label">{$group.name}{l s=': ' d='Shop.Theme.Catalog'} {foreach from=$group.attributes key=id_attribute item=group_attribute} {if $group_attribute.selected}{$group_attribute.name}{/if} {/foreach} </span> {if $group.group_type == 'select'} <select class="form-control form-control-select" id="group_{$id_attribute_group}" aria-label="{$group.name}" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]"> {foreach from=$group.attributes key=id_attribute item=group_attribute} <option value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} selected="selected"{/if}>{$group_attribute.name}</option> {/foreach} </select> {elseif $group.group_type == 'color'} <ul id="group_{$id_attribute_group}"> {foreach from=$group.attributes key=id_attribute item=group_attribute} <li class="float-xs-left input-container"> <label aria-label="{$group_attribute.name}"> <input class="input-color" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} checked="checked"{/if}> <span {if $group_attribute.texture} class="color texture" style="background-image: url({$group_attribute.texture})" {elseif $group_attribute.html_color_code} class="color" style="background-color: {$group_attribute.html_color_code}" {/if} ><span class="attribute-name sr-only">{$group_attribute.name}</span></span> </label> </li> {/foreach} </ul> {elseif $group.group_type == 'radio'} <ul id="group_{$id_attribute_group}"> {foreach from=$group.attributes key=id_attribute item=group_attribute} <li class="input-container float-xs-left"> <label> <input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} checked="checked"{/if}> <span class="radio-label">{$group_attribute.name}</span> </label> </li> {/foreach} </ul> {/if} </div> {/if} {/foreach} </div>
Et j'ai légèrement modifié le code de ton hook :
public function hookDisplayLinovCalculateur(array $params) { $idProduct = $params['product']->id ?? null; $idProductAttribute = $params['product']->id_product_attribute ?? null; $ratio = null; $perte = 0; $displayPrice = null; if (null === $idProduct) { return; } if ($idProductAttribute >= 1) { // Produit avec déclinaisons : chercher dans linovcalculateur_attribute $sql = 'SELECT ratio, perte, active FROM ' . _DB_PREFIX_ . 'linovcalculateur_attribute WHERE id_product_attribute = ' . (int) $idProductAttribute; $result = Db::getInstance()->getRow($sql); } else { // Produit sans déclinaisons : chercher dans linovcalculateur_product $sql = 'SELECT ratio, perte, active FROM ' . _DB_PREFIX_ . 'linovcalculateur_product WHERE id_product = ' . (int) $idProduct; $result = Db::getInstance()->getRow($sql); } if ($result && (int) $result['active'] === 1) { $ratio = (int) $result['ratio']; $perte = (int) $result['perte']; if ($ratio !== null && $ratio > 0) { $priceTTC = Product::getPriceStatic($idProduct, true, $idProductAttribute, 6, null, false, true, 1, false, null, null, true); $displayPrice = $priceTTC / $ratio; } $this->context->smarty->assign([ 'ratio' => $ratio, 'price' => $priceTTC, 'perte' => $perte, 'display_price' => $displayPrice !== null ? number_format($displayPrice, 2, ',', ' ') . '€' : null, ]); return $this->display($this->_path, 'views/templates/front/calculator_product.tpl'); }else{ return $this->display($this->_path, 'views/templates/front/cart_product_basic.tpl'); }