Prestashop 1.6 How to Code Custom Product Page Templates

I had to code some custom product pages for a web shop I created using Prestashop 1.6. It involved creating a custom product template showing product combination tables. It turned out to be pretty difficult to find out how to do this in Prestashop so there is a lot of code below which is patched from many searches online sorry about that. Should be helpful though to anyone trying to create custom product templates.

Here is a list of things which I had to do:

  • creating a new product template and enable only for that product id
  • edit the javascript to enable mutiple add to cart buttons per combination (and quantity)
  • looping through the product data and extracting the combination data and output to table (and sort)

This is what the finished custom Product Page look like:

anyridge abutment temporary

Coding a custom product template for Prestashop.

here we go…


This is the product array provided by default to the smarty template.

This it the combinations array

combinations array

and this code can display it in dev tools so you can read it.

{html_table loop=$combinations}

html table loop

Also the combinations are stored in the javascript


Output a table of specific combinations


output a table of specific combinations

Create an add to cart button for each row?

ajax request add to cart combo 19
ajax combo 19

ajax request add to cart combo 24
ajax combo 24

to get the ajax request to pick out the correct combination id you must update the js



Quantity up and down updating all but needs to be per combination
quantity up and down

update code in:



add to cart

Then update the ajax-cart.js as per before to pass the correct number to back-end.


So now the following code and output table:

fixture diameter

Sort the products by size and then by length

this code works for sort… not sure if it will have a big impact on page speed as you should probably be doing the sorting at controller/db level not in templates.


fixture diameter 2

The function outputs a 1 so to prevent that do this:

{$tmp = ksort($combinations)}

Custom product template for specific product ids only (or categories?)

include this code in product.tpl

{if isset($product) && isset($product->id) && $product->id == 2}
{include file=”./product-2.tpl”}
{include file=”./product-default.tpl”}

Different product template for a specific category


Debugging use this:

[email protected]_r}

[email protected]_r}
{html_table loop=$data}

Now need to get the reference code per combination
“prestashop 1.6 get reference code combination smarty”
“prestashop 1.6 smarty get all product reference codes for all combinations”
“prestashop 1.6 smarty get all product reference codes for attributes”

Outputting dynamically the product attributes and displaying a color column

product attributes

First add to cart row being hidden (display none)

add to cart2

To fix it check this in the back-end


or edit javascript product.js

of turn off stick management completely

products stock

Sam Deering is a web developer from England (currently living in Australia). In his spare time he enjoys coding, playing chess, reading and investing.

Leave a Reply

Your email address will not be published. Required fields are marked *