Bonjour,
j'ai besoin d'afficher les frais de livraison le moins cher sur la fiche produit, y aurait-il une solution simple sur prestashop 1.6?
Dans l'exemple: Livraison à partir de ... €
Aurez-vous une piste?
J'ai trouvé cela sur le forum en
Ajouter dans le controllers/front/ProductController.php:
ajouter le code en gras:
$default_carrier =new Carrier((int)Configuration::get('PS_CARRIER_DEFAULT'));
$carrier_zones = $default_carrier->getZones();
if (isset($carrier_zones) && !empty($carrier_zones)) {
$first_carrier_zone = $carrier_zones[0]['id_zone'];
$delivery_price = $default_carrier->getDeliveryPriceByWeight($this->product->weight, $first_carrier_zone);
}
else
$delivery_price = 'not found';
$this->context->smarty->assign(array(
'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'),
'customizationFields' => ($this->product->customizable) ? $this->product->getCustomizationFields($this->context->language->id) : false,
'accessories' => $this->product->getAccessories($this->context->language->id),
'return_link' => $return_link,
'product' => $this->product,
'product_manufacturer' => new Manufacturer((int)$this->product->id_manufacturer, $this->context->language->id),
'token' => Tools::getToken(false),
'features' => $this->product->getFrontFeatures($this->context->language->id),
'attachments' => (($this->product->cache_has_attachments) ? $this->product->getAttachments($this->context->language->id) : array()),
'allow_oosp' => $this->product->isAvailableWhenOutOfStock((int)$this->product->out_of_stock),
'last_qties' => (int)Configuration::get('PS_LAST_QTIES'),
'HOOK_EXTRA_LEFT' => Hook::exec('displayLeftColumnProduct'),
'HOOK_EXTRA_RIGHT' => Hook::exec('displayRightColumnProduct'),
'HOOK_PRODUCT_OOS' => Hook::exec('actionProductOutOfStock', array('product' => $this->product)),
'HOOK_PRODUCT_ACTIONS' => Hook::exec('displayProductButtons', array('product' => $this->product)),
'HOOK_PRODUCT_TAB' => Hook::exec('displayProductTab', array('product' => $this->product)),
'HOOK_PRODUCT_TAB_CONTENT' => Hook::exec('displayProductTabContent', array('product' => $this->product)),
'display_qties' => (int)Configuration::get('PS_DISPLAY_QTIES'),
'display_ht' => !Tax::excludeTaxeOption(),
'currencySign' => $this->context->currency->sign,
'currencyRate' => $this->context->currency->conversion_rate,
'currencyFormat' => $this->context->currency->format,
'currencyBlank' => $this->context->currency->blank,
'jqZoomEnabled' => Configuration::get('PS_DISPLAY_JQZOOM'),
'ENT_NOQUOTES' => ENT_NOQUOTES,
'outOfStockAllowed' => (int)Configuration::get('PS_ORDER_OUT_OF_STOCK') , // <- add comma here!
'delivery_price' => $delivery_price
));
Then, in themes/<your theme folder>product.tpl, add this code wherever you need it:
{if $delivery_price}
<div class = "estimated_delivery_price">
{l s='Initial delivery costs estimate :'}{convertPrice price=$delivery_price}
</div>
{/if}
mais ca ne fonctionne pas, je n'ai pas l'affichage du prix.
lien:
merci pour votre aide