I changed the function and it works. For those who need it, the code is not perfect but it works for the product list.
For prestashop 1.7.6.5 and a shop without tax (adapt for tax).
Create an override "Product.php" in /override/classes and copy this code :
<?php class Product extends ProductCore { public static function getMinSpecificPrice($id_product, $product_ratio) { $discount = DB::getInstance()->ExecuteS(' SELECT MIN(price) AS min_price, from_quantity AS quantity FROM `'._DB_PREFIX_.'specific_price` WHERE id_product = '.$id_product.''); foreach ($discount as $data) { $counter = $data['quantity']; if ($counter > 1) { $specificPrice = $data['min_price']; $specificPrice = round($specificPrice, 2); if ($product_ratio != 0) { $specificPrice = ($specificPrice / $product_ratio); return $specificPrice; } } } } public static function getUnitPrice($product_price_tax_exc, $product_ratio) { if ($product_ratio != 0) { $unitPrice = $product_price_tax_exc / $product_ratio; return $unitPrice; } } }
getMinSpecificPrice() will find out if a specific price exists and recover the lowest price.
getUnitPrice() will calculate and display the price per unit in the event that you sell a product by package.
Next in yourtheme\templates\catalog\_partials\miniatures\product.tpl, copy this code in the block 'product_price_and_shipping' :
{assign var=specificPrice value=Product::getMinSpecificPrice($product.id_product, $product.unit_price_ratio)} {assign var=unitPrice value=Product::getUnitPrice($product.price_tax_exc, $product.unit_price_ratio)} {if $specificPrice} <span itemprop="price" class="price">A partir de {$specificPrice|string_format:"%.2f"|replace:'.':','} €</span> {else if $unitPrice} <span itemprop="price" class="price">{$unitPrice|string_format:"%.2f"|replace:'.':','} €</span> {else} <span itemprop="price" class="price">{$product.price}</span> {/if}
Result :