Changes in version 1.5 which impact theme development
Table of content
/*<![CDATA[*/ div.rbtoc1597308501610 {padding: 0px;} div.rbtoc1597308501610 ul {list-style: disc;margin-left: 0px;} div.rbtoc1597308501610 li {margin-left: 0px;padding-left: 0px;} /*]]>*/
Changes in version 1.5 which impact theme development
Foreword
A lot has changed between the Theme API in PrestaShop 1.4 and the one available in version 1.5. Wholes sections have been rewritten while others have been added, mostly to take into account new features from PrestaShop 1.5, such as the cart rules system et the partial delivery/multishipping one.
But in general, it is highly advisable not to adapt a 1.4 theme to PrestaShop, but rather start with the default theme and adapt your HTML and CSS files to it. This way, you will ensure that all the new features from PrestaShop 1.5 will be included in your theme out of the box.
getPageLink
The way getPageLink() works has been changed. The first parameter should no longer be the controller's file, but instead the controller name.
In 1.4:
In 1.5:
B2B
New fields are now available for the sign-up page. See authentication.tpl in the default theme.
Layered navigation
Whenever possible, you should use the TPL files from the default theme, and refrain from editing them. This is true for all modules, but doubly so for the layered navigation one.
When adding layered navigation to a non-official theme, two things tend to break:
The H1 tag update.
The "available quantities" update.
You can fix these by following the following steps.
The H1 tag
In the category.tpl template file, you must add the $categoryNameComplement variable after the category name:
Available quantities
Still in category.tpl, you must remove the section displaying the number of products, and put it in a new template, named category-count.tpl.
For instance, with the default PrestaShop tempalte:
...becomes...
The new category-count.tpl template file contains the lines that were removed from category.tpl:
Product attributes
Attribute types are now generic. Therefore, the way they are displayed has been changed in product.tpl.
In 1.4:
In 1.5:
Changes to be applied to a 1.4 theme in order use per-combination unique product URLs
There are only a couple of changes to apply, but they take quite a bit code. Fortunately, it is mostly copy/pasting of code we provide.
In product.tpl
The product.tpl has some changes that are need in its JavaScript code.
First, you have to add a call to the getProductAttribute() method on the onClick event of any input tag targeting attributes (select, radio or color). This method will be defined in the section.
You also need to add the following code this file's JavaScript section:
In js/product.js
Here you should put the new getProductAttribute() method:
New cart summary
This is a new addition to order-payment.tpl. See the original file from the default theme.
Social titles
Social titles, such as Mr or Ms, are now generic in PrestaShop 1.5. The authentication.tpl and identity.tpl files have been changed to take this into account.
In 1.4:
In 1.5:
New template
The file layout.tpl should be taken into account.
This file is defined (by default) as follows:
Include header.tpl file (if we display the contents)
Include the desired template file
Include footer.tpl file (if we display the contents)
Include "Live Edit"
You can modify the contents of this file based on an entity type or entity itself.
Type of entity
When you want to change the layout as an entity type such as categories, you can define a file layout-EntityType.tpl defined as follows:
This file will be placed in: /themes/default/override/layout-category.tpl (For the category entity )
N.B.: a controller is an entity type. This means that you can use this feature for the supplier, stores, product, category, and many others entities.
By entity
When you want to change the layout according to a particular entity (e.g. for the product entity with ID 1) you can define a file-layout-EntityType-ID.tpl defined as:
This file will be placed in: /themes/default/override/layout-product-1.tpl (For the product entity with ID 1)
Dynamic template
It's possible to override the getOverrideTemplate from a FrontController to dynamically change the template.
General considerations theme URLs and form action
Many template files have been modified in the default theme in order to make use of the new feature of 1.5:
shopping-cart-product-line.tpl. Many modifications in order to integrate multishipping and cart rules.
shopping-cart.tpl. Many modification in order to integrate multishipping and cart rules.
order-address-multishipping-products.tpl. Whole new template (multishipping).
order-address-multishipping.tpl. Whole new template (multishipping).
order-address-product-line.tpl. Whole new template (multishipping).
order-confirmation.tpl. Links have been changed.
order-follow.tpl. Links have been changed.
order-payment.tpl. Added the cart summary.
order-return.tpl. Various changes.
order-slip.tpl. Links have been changed.
order-steps.tpl. Links have been changed.
cart-summary.js. the whole file has been rewritten. If you intend to update a 1.4 theme, you should directly use the 1.5 version.
order-opt.js. Same as
cart-summary.jsabove.product.js. Some ne JavaScript functions, such as
displayDiscounts(combination),getProductAttribute(),colorPickerClick(elt)orcheckUrl()tools.js. Same as
cart-summary.jsabove.order-address.js. Reworked to make use of multishipping.
order-address.tpl
Two new variables:
End of main code block in 1.4:
End of main code block in 1.5:
order-carrier.tpl
The main data table has been heavily reworked, see the corresponding file in the default theme. You could also perfom a diff on this file in its 1.4 and 1.5 incarnations, for instance using http://www.quickdiff.com/.
Note that the HOOK_EXTRACARRIER hook can now be used multiple times when multiple shipping is used:
In 1.4:Extract from order-carrier.tpl in v1.4
In 1.5:Extract from order-carrier.tpl in v1.5
order-detail.tpl
The following lines have been added in v1.5 in order to enable displaying the number of returned products directly in the order summary (order details):
The following new lines make it possible for your shop to give the customers details about the delivery, for instance its tracking number which can prove invaluable when multishipping is used.
order-opc.tpl
New 'back' parameter added to addressUrl JavaScript variable:
Also, the file has a new JavaScript variable:
Last updated
Was this helpful?
