
The final version 1.4 of our software, available in a few weeks, is already expected to be a huge success for PrestaShop. You, too, can take advantage of our success by updating your modules and themes sold on PrestaShop Addons and expand your sales!
Thanks to a revision of module categories in the Back Office, fixed from now on, merchants can now easily find the modules that they’re looking for. Update your Addons contributions for version 1.4 to attract new customers and increase your sales on PrestaShop Addons.
Below, you will find all of the information you’ll need to easily adapt your modules and themes to PrestaShop 1.4.
PrestaShop 1.4 now implements a fixed list of module categories, in order to help merchants find something among the large quantity of modules available in the back office.
The categories now appear as follows:
PrestaShop 1.4 implements an optional feature for the modules: you can use an XML file in order to describe the meta data. This file is not mandatory, but enables PrestaShop to avoid the inclusion and instantiation of the module, which is required to get basic information like its name or its version. It is strongly advised to add this file in each module directory, using the native modules as examples.
PrestaShop 1.4 evolved in terms of new features, but also optimized former ones. Thus, several methods are now outdated and mustn’t be used:
Address::getManufacturerIdByAddress()
The most impacted modules are those related to shipping (In particular, the zones and ranges have changed in PrestaShop 1.4), and to prices and taxes (the whole tax system has been recreated to offer more flexibility).
A large amount of features have been included in PrestaShop 1.4. The default template now includes more pages, which will have to be taken into account when you develop new themes or update old ones.
Beyond the miscellaneous improvements added to each page of the shop, four new features now appear:
Smarty, the template engine used by PrestaShop, has been updated in PrestaShop 1.4 and is now in its 3rd version. Most of the features are backward compatible, but we advise everyone to double check every page just to be sure.
In addition, Smarty 3 is stricter than Smarty 2, and a great part of the source code of our default theme has been rewritten. We advise you to check every page with the error display enabled.
PrestaShop developed a template installer, which enables merchants to change their themes in just a few clicks without having to read a whole document about module management, their position, or the size of the thumbnails. It is available on PrestaShop Addons: http://addons.prestashop.com/en/1713-installeur-de-themes.html.
This installer is included in PrestaShop 1.4 and will be mandatory for all template developers. It also enables the creation of packages that export themes installed in the right format.
Open product.tpl available at the root directory of your theme. At the beginning of the file, you will find a lot of declared variables.
var id_product = '{$product->id|intval}';
var productHasAttributes = {if isset($groups)}true{else}false{/if};
var quantitiesDisplayAllowed = {if $display_qties == 1}true{else}false{/if};
For each variable below:
<script type="text/javascript"> tag at the beginning of the file.
var reduction_percent = {if $product->specificPrice AND $product->specificPrice.reduction AND $product->specificPrice.reduction_type == 'percentage'}{$product->specificPrice.reduction*100}{else}0{/if};
var reduction_price = {if $product->specificPrice AND $product->specificPrice.reduction AND $product->specificPrice.reduction_type == 'amount'}{$product->specificPrice.reduction}{else}0{/if};
var productAvailableForOrder = {if (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}'0'{else}'{$product->available_for_order}'{/if};
var productReference = '{$product->reference|escape:'htmlall':'UTF-8'}';
var productShowPrice = '{if !$PS_CATALOG_MODE}{$product->show_price}{else}0{/if}';
var specific_price = {if $product->specificPrice AND $product->specificPrice.price}{$product->specificPrice.price}{else}0{/if};
var productPriceTaxExcluded = {$product->getPriceWithoutReduct(true)|default:'null'} - {$product->ecotax};
var ecotaxTax_rate = {$ecotaxTax_rate};
var productUnitPriceRatio = '{$product->unit_price_ratio}';
var idDefaultImage = {if isset($cover.id_image_only)}{$cover.id_image_only}{else}0{/if};
var specific_currency = {if $product->specificPrice AND $product->specificPrice.id_currency}true{else}false{/if}; Please double check that there isn't any variable declared twice.
Farther in the source code, replace the block <!-- prices --> by the code below. For example in the default theme in 1.3.7:
<!-- prices -->{/if}
{if isset($groups)}
<!-- attributes -->
<!-- prices -->
{if $product->show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
<p class="price">
{if !$priceDisplay || $priceDisplay == 2}
{assign var='productPrice' value=$product->getPrice(true, $smarty.const.NULL)}
{assign var='productPriceWithoutRedution' value=$product->getPriceWithoutReduct(false, $smarty.const.NULL)}
{elseif $priceDisplay == 1}
{assign var='productPrice' value=$product->getPrice(false, $smarty.const.NULL)}
{assign var='productPriceWithoutRedution' value=$product->getPriceWithoutReduct(true, $smarty.const.NULL)}
{/if}
{if $product->on_sale}
<img src="{$img_dir}onsale_{$lang_iso}.gif" alt="{l s='On sale'}" class="on_sale_img" />
<span class="on_sale">{l s='On sale!'}</span>
{elseif $product->specificPrice AND $product->specificPrice.reduction AND $productPriceWithoutRedution > $productPrice}
<span class="discount">{l s='Reduced price!'}</span>
{/if}
<br/>
<span class="our_price_display">
{if $priceDisplay >= 0 && $priceDisplay <= 2}
<span id="our_price_display">{convertPrice price=$productPrice}</span>
{if $tax_enabled && ((isset($display_tax_label) && $display_tax_label == 1) OR !isset($display_tax_label))}
{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
{/if}
{/if}
</span>
{if $priceDisplay == 2}
<br/>
<span id="pretaxe_price"><span id="pretaxe_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}</span> {l s='tax excl.'}</span>
{/if}
<br/>
</p>
{if $product->specificPrice AND $product->specificPrice.reduction}
<p id="old_price">
<span class="bold">
{if $priceDisplay >= 0 && $priceDisplay <= 2}
{if $productPriceWithoutRedution > $productPrice}
<span id="old_price_display">{convertPrice price=$productPriceWithoutRedution}</span>
{if $tax_enabled && $display_tax_label == 1}
{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
{/if}
{/if}
{/if}
</span>
</p>
{/if}
{if $product->specificPrice AND $product->specificPrice.reduction_type == 'percentage'}
<p id="reduction_percent">{l s='(price reduced by'} <span id="reduction_percent_display">{$product->specificPrice.reduction*100}</span> %{l s=')'}</p>
{/if}
{if $packItems|@count}
<p class="pack_price">{l s='instead of'} <span style="text-decoration: line-through;">{convertPrice price=$product->getNoPackPrice()}</span></p>
<br class="clear" />
{/if}
{if $product->ecotax != 0}
<p class="price-ecotax">{l s='include'} <span id="ecotax_price_display">{if $priceDisplay == 2}{$ecotax_tax_exc|convertAndFormatPrice}{else}{$ecotax_tax_inc|convertAndFormatPrice}{/if}</span> {l s='for green tax'}
{if $product->specificPrice AND $product->specificPrice.reduction}
<br/>{l s='(not impacted by the discount)'}
{/if}
</p>
{/if}
{if !empty($product->unity) && $product->unit_price_ratio > 0.000000}
{math equation="pprice / punit_price" pprice=$productPrice punit_price=$product->unit_price_ratio assign=unit_price}
<p class="unit-price"><span id="unit_price_display">{convertPrice price=$unit_price}</span> {l s='per'} {$product->unity|escape:'htmlall':'UTF-8'}</p>
{/if}
{*close if for show price*}
{/if}