Here is the result displaying shipping price on pestashop 1.6 product page.
How to display shipping price on your prestashop 1.6 product page ? Here is how.
1. Back up original files.2. Open file controllers/front/ProductController.php
3. Find the following code
4. Above that piece of code, add the following code :$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,
5. On the same file find the following code :$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';
'currencyRate' => $this->context->currency->conversion_rate,6. Please notice, that i add the following code next to the ('PS_ORDER_OUT_OF_STOCK')
'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!8. Final code is like this (red new code, black original code)
'delivery_price' => $delivery_price
9. In themes/<your theme folder>product.tpl, add this code wherever you need to display it$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));
{if $delivery_price}<div class = "estimated_delivery_price">{l s='Initial delivery costs estimate :'}{convertPrice price=$delivery_price}</div>{/if}
Thats a wrap, now you have shipping price on your product page.