Message-ID: <1587634688.375726.1710810365058.JavaMail.root@confluence-doc2-production> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_375725_1266361504.1710810365052" ------=_Part_375725_1266361504.1710810365052 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Table of content
A lot has changed between the Theme API in PrestaShop 1.4 and the one av= ailable in version 1.5. Wholes sections have been rewritten while others ha= ve 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.<= /p>
But in general, it is highly advisable not to adapt a 1.4 theme to Prest= aShop, 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 Prest= aShop 1.5 will be included in your theme out of the box.
The way getPageLink()
works has been changed. The first par=
ameter should no longer be the controller's file, but instead the controlle=
r name.
In 1.4:
{$link-&= gt;getPageLink('order-slip.php', true)}=20
In 1.5:
{$link-&= gt;getPageLink('order-slip', true)}=20
New fields are now available for the sign-up page. See authenticat=
ion.tpl
in the default theme.
{if $b2b= _enable} <fieldset class=3D"account_creation"> =09<h3>{l s=3D'Your company information'}</h3> =09<p class=3D"text"> =09=09<label for=3D"">{l s=3D'Company'}</label> =09=09<input type=3D"text" class=3D"text" id=3D"company" name=3D"company= " value=3D"{if isset($smarty.post.company)}{$smarty.post.company}{/if}" /&g= t; =09</p> =09<p class=3D"text"> =09=09<label for=3D"siret">{l s=3D'SIRET'}</label> =09=09<input type=3D"text" class=3D"text" id=3D"siret" name=3D"siret" va= lue=3D"{if isset($smarty.post.siret)}{$smarty.post.siret}{/if}" /> =09</p> =09<p class=3D"text"> =09=09<label for=3D"ape">{l s=3D'APE'}</label> =09=09<input type=3D"text" class=3D"text" id=3D"ape" name=3D"ape" value= =3D"{if isset($smarty.post.ape)}{$smarty.post.ape}{/if}" /> =09</p> =09<p class=3D"text"> =09=09<label for=3D"website">{l s=3D'Website'}</label> =09=09<input type=3D"text" class=3D"text" id=3D"website" name=3D"website= " value=3D"{if isset($smarty.post.website)}{$smarty.post.website}{/if}" /&g= t; =09</p> </fieldset> {/if}=20
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:
You can fix these by following the following steps.
In the category.tpl
template file, you must add the $=
categoryNameComplement
variable after the category name:
{$catego= ry->name|escape:'htmlall':'UTF-8'} ...becomes... {$category->name|escape:'htmlall':'UTF-8'} {$categoryNameComplement|esca= pe:'htmlall':'UTF-8'}=20
Still in category.tpl
, you must remove the section displayi=
ng the number of products, and put it in a new template, named catego=
ry-count.tpl
.
For instance, with the default PrestaShop tempalte:
<h1&g= t; {strip} {$category->name|escape:'htmlall':'UTF-8'} {$categoryNameComplement|= escape:'htmlall':'UTF-8'} <span class=3D"category-product-count"> {if $category->id =3D=3D 1 OR $nb_products =3D=3D 0}{l s=3D'There = are no products.'} {else} {if $nb_products =3D=3D 1}{l s=3D'There is'}{else}{l s=3D'There are= '}{/if} {$nb_products} {if $nb_products =3D=3D 1}{l s=3D'product.'}{else}{l s=3D'products.= '}{/if} {/if} </span> {/strip} </h1>=20
...becomes...
<h1&g= t; {strip} {$category->name|escape:'htmlall':'UTF-8'} {$categoryNameComplement|= escape:'htmlall':'UTF-8'} <span class=3D"category-product-count"> {include file=3D"$tpl_dir./category-count.tpl"} </span> {/strip} </h1>=20
The new category-count.tpl
template file contains the lines=
that were removed from category.tpl
:
{if $cat= egory->id =3D=3D 1 OR $nb_products =3D=3D 0}{l s=3D'There are no product= s.'} {else} {if $nb_products =3D=3D 1}{l s=3D'There is'}{else}{l s=3D'There are'}{/if= } {$nb_products} {if $nb_products =3D=3D 1}{l s=3D'product.'}{else}{l s=3D'products.'}{/if= } {/if}=20
Attribute types are now generic. Therefore, the way they are displayed h=
as been changed in product.tpl
.
In 1.4:
{if isse= t($groups)} =09<!-- attributes --> =09<div id=3D"attributes"> =09{foreach from=3D$groups key=3Did_attribute_group item=3Dgroup} =09{if $group.attributes|@count} =09<p> =09=09<label for=3D"group_{$id_attribute_group|intval}">{$group.name|= escape:'htmlall':'UTF-8'} :</label> =09=09{assign var=3D"groupName" value=3D"group_$id_attribute_group"} =09=09<select name=3D"{$groupName}" id=3D"group_{$id_attribute_group|int= val}" onchange=3D"javascript:findCombination();{if $colors|@count > 0}$(= '#wrapResetImages').show('slow');{/if};"> =09=09=09{foreach from=3D$group.attributes key=3Did_attribute item=3Dgroup_= attribute} =09=09=09=09<option value=3D"{$id_attribute|intval}"{if (isset($smarty.g= et.$groupName) && $smarty.get.$groupName|intval =3D=3D $id_attribut= e) || $group.default =3D=3D $id_attribute} selected=3D"selected"{/if} title= =3D"{$group_attribute|escape:'htmlall':'UTF-8'}">{$group_attribute|escap= e:'htmlall':'UTF-8'}</option> =09=09=09{/foreach} =09=09</select> =09</p> =09{/if} =09{/foreach} =09</div> {/if}=20
In 1.5:
{if isse= t($groups)} =09<!-- attributes --> =09<div id=3D"attributes"> =09{foreach from=3D$groups key=3Did_attribute_group item=3Dgroup} =09=09{if $group.attributes|@count} =09=09=09<fieldset class=3D"attribute_fieldset"> =09=09=09=09<label class=3D"attribute_label" for=3D"group_{$id_attribute= _group|intval}">{$group.name|escape:'htmlall':'UTF-8'} :</label> =09=09=09=09{assign var=3D"groupName" value=3D"group_$id_attribute_group"} =09=09=09=09<div class=3D"attribute_list"> =09=09=09=09{if ($group.group_type =3D=3D 'select')} =09=09=09=09=09<select name=3D"{$groupName}" id=3D"group_{$id_attribute_= group|intval}" class=3D"attribute_select" onchange=3D"findCombination();get= ProductAttribute();{if $colors|@count > 0}$('#wrapResetImages').show('sl= ow');{/if};"> =09=09=09=09=09=09{foreach from=3D$group.attributes key=3Did_attribute item= =3Dgroup_attribute} =09=09=09=09=09=09=09<option value=3D"{$id_attribute|intval}"{if (isset(= $smarty.get.$groupName) && $smarty.get.$groupName|intval =3D=3D $id= _attribute) || $group.default =3D=3D $id_attribute} selected=3D"selected"{/= if} title=3D"{$group_attribute|escape:'htmlall':'UTF-8'}">{$group_attrib= ute|escape:'htmlall':'UTF-8'}</option> =09=09=09=09=09=09{/foreach} =09=09=09=09=09</select> =09=09=09=09{elseif ($group.group_type =3D=3D 'color')} =09=09=09=09=09<ul id=3D"color_to_pick_list" class=3D"clearfix"> =09=09=09=09=09=09{assign var=3D"default_colorpicker" value=3D""} =09=09=09=09=09=09{foreach from=3D$group.attributes key=3Did_attribute item= =3Dgroup_attribute} =09=09=09=09=09=09<li> =09=09=09=09=09=09=09<a id=3D"color_{$id_attribute|intval}" class=3D"col= or_pick{if ($group.default =3D=3D $id_attribute)} selected{/if}" style=3D"b= ackground: {$colors.$id_attribute.value};" title=3D"{$colors.$id_attribute.= name}" onclick=3D"colorPickerClick(this);getProductAttribute();{if $colors|= @count > 0}$('#wrapResetImages').show('slow');{/if}"> =09=09=09=09=09=09=09=09{if file_exists($col_img_dir|cat:$id_attribute|cat:= '.jpg')} =09=09=09=09=09=09=09=09=09<img src=3D"{$img_col_dir}{$id_attribute}.jpg= " alt=3D"{$colors.$id_attribute.name}" width=3D"20" height=3D"20" /><= br> =09=09=09=09=09=09=09=09{/if} =09=09=09=09=09=09=09</a> =09=09=09=09=09=09</li> =09=09=09=09=09=09{if ($group.default =3D=3D $id_attribute)} =09=09=09=09=09=09=09{$default_colorpicker =3D $id_attribute} =09=09=09=09=09=09{/if} =09=09=09=09=09=09{/foreach} =09=09=09=09=09</ul> =09=09=09=09=09<input type=3D"hidden" id=3D"color_pick_hidden" name=3D"{= $groupName}" value=3D"{$default_colorpicker}" /> =09=09=09=09{elseif ($group.group_type =3D=3D 'radio')} =09=09=09=09=09{foreach from=3D$group.attributes key=3Did_attribute item=3D= group_attribute} =09=09=09=09=09=09<input type=3D"radio" class=3D"attribute_radio" name= =3D"{$groupName}" value=3D"{$id_attribute}" {if ($group.default =3D=3D $id_= attribute)} checked=3D"checked"{/if} onclick=3D"findCombination();getProduc= tAttribute();{if $colors|@count > 0}$('#wrapResetImages').show('slow');{= /if}"> =09=09=09=09=09=09{$group_attribute|escape:'htmlall':'UTF-8'}<br/> =09=09=09=09=09{/foreach} =09=09=09=09{/if} =09=09=09=09</div> =09=09=09</fieldset> =09=09{/if} =09{/foreach} =09</div> {/if}=20
There are only a couple of changes to apply, but they take quite a bit c= ode. Fortunately, it is mostly copy/pasting of code we provide.
The product.tpl
has some changes that are need in its JavaS=
cript code.
First, you have to add a call to the getProductAttribute()
=
method on the onClick
event of any input
tag targ=
eting attributes (select, radio or color). This method will be defined in t=
he section.
You also need to add the following code this file's JavaScript section:<= /p>
{if isse= t($attributesCombinations)} // Combinations attributes informations var attributesCombinations =3D new Array(); {foreach from=3D$attributesCombinations key=3Did item=3DaC} tabInfos =3D new Array(); tabInfos['id_attribute'] =3D '{$aC.id_attribute|intval}'; tabInfos['attribute'] =3D '{$aC.attribute}'; tabInfos['group'] =3D '{$aC.group}'; tabInfos['id_attribute_group'] =3D '{$aC.id_attribute_group|intval}= '; attributesCombinations.push(tabInfos); {/foreach} {/if}=20
Here you should put the new getProductAttribute()
method:=
p>
function= getProductAttribute(){ // get product attribute id product_attribute_id =3D $('#idCombination').val(); product_id =3D $('#product_page_product_id').val(); =20 // get every attributes values request =3D ''; //create a temporary 'tab_attributes' array containing the choices of t= he customer var tab_attributes =3D new Array(); $('div#attributes select, div#attributes input[type=3Dhidden], div#attr= ibutes input[type=3Dradio]:checked').each(function(){ tab_attributes.push($(this).val()); }); =20 // build new request for (i in attributesCombinations) for (a in tab_attributes) if (attributesCombinations[i]['id_attribute'] =3D=3D tab_attrib= utes[a]) request +=3D '&'+attributesCombinations[i]['group']+'= =3D'+attributesCombinations[i]['attribute']; request =3D request.replace(request.substring(0, 1), '#'); url =3D window.location+''; =20 // redirection if (url.indexOf('#') !=3D -1) url =3D url.substring(0, url.indexOf('#')); window.location =3D url+request; } =20 $(document).ready(function(){ url =3D window.location+''; // if we need to load a specific combination if (url.indexOf('#') !=3D -1) { // get the params to fill params =3D url.substring(url.indexOf('#') + 1, url.length); tabParams =3D params.split('&'); tabValues =3D new Array(); for (i in tabParams) tabValues.push(tabParams[i].split('=3D')); product_id =3D $('#product_page_product_id').val(); // fill html with values $('.color_pick').removeClass('selected'); count =3D 0; for (z in tabValues) for (a in attributesCombinations) if (attributesCombinations[a]['group'] =3D=3D tabValues[z][= 0] && attributesCombinations[a]['attribute'] =3D= =3D tabValues[z][1]) { count++; // add class 'selected' to the selected color $('#color_'+attributesCombinations[a]['id_attribute']).= addClass('selected'); $('input:radio[value=3D'+attributesCombinations[a]['id_= attribute']+']').attr('checked', 'checked'); $('input:hidden[name=3Dgroup_'+attributesCombinations[a= ]['id_attribute_group']+']').val(attributesCombinations[a]['id_attribute'])= ; $('select[name=3Dgroup_'+attributesCombinations[a]['id_= attribute_group']+']').val(attributesCombinations[a]['id_attribute']); } // find combination if (count =3D=3D tabValues.length) findCombination(); // no combination found =3D removing attributes from url else window.location =3D url.substring(0, url.indexOf('#')); } });=20
This is a new addition to order-payment.tpl
. See the origin=
al file from the default theme.
{if !$op= c} <div id=3D"order-detail-content" class=3D"table_block"> =09<table id=3D"cart_summary" class=3D"std"> =09=09<thead> =09=09=09<tr> =09=09=09=09<th class=3D"cart_product first_item">{l s=3D'Product'}&l= t;/th> =09=09=09=09<th class=3D"cart_description item">{l s=3D'Description'}= </th> =09=09=09=09<th class=3D"cart_availability item">{l s=3D'Avail.'}<= /th> =09=09=09=09<th class=3D"cart_unit item">{l s=3D'Unit price'}</th&= gt; =09=09=09=09<th class=3D"cart_quantity item">{l s=3D'Qty'}</th> =09=09=09=09<th class=3D"cart_total last_item">{l s=3D'Total'}</th= > =09=09=09</tr> =09=09</thead> =09=09<tfoot> =09=09=09{if $use_taxes} =09=09=09=09{if $priceDisplay} =09=09=09=09=09<tr class=3D"cart_total_price"> =09=09=09=09=09=09<td colspan=3D"5">{if $display_tax_label}{l s=3D'To= tal products (tax excl.):'}{else}{l s=3D'Total products:'}{/if}</td> =09=09=09=09=09=09<td class=3D"price" id=3D"total_product">{displayPr= ice price=3D$total_products}</td> =09=09=09=09=09</tr> =09=09=09=09{else} =09=09=09=09=09<tr class=3D"cart_total_price"> =09=09=09=09=09=09<td colspan=3D"5">{if $display_tax_label}{l s=3D'To= tal products (tax incl.):'}{else}{l s=3D'Total products:'}{/if}</td> =09=09=09=09=09=09<td class=3D"price" id=3D"total_product">{displayPr= ice price=3D$total_products_wt}</td> =09=09=09=09=09</tr> =09=09=09=09{/if} =09=09=09{else} =09=09=09=09<tr class=3D"cart_total_price"> =09=09=09=09=09<td colspan=3D"5">{l s=3D'Total products:'}</td> =09=09=09=09=09<td class=3D"price" id=3D"total_product">{displayPrice= price=3D$total_products}</td> =09=09=09=09</tr> =09=09=09{/if} =09=09=09<tr class=3D"cart_total_voucher" {if $total_discounts =3D=3D 0}= style=3D"display: none;"{/if}> =09=09=09=09<td colspan=3D"5"> =09=09=09=09{if $use_taxes} =09=09=09=09=09{if $priceDisplay} =09=09=09=09=09=09{if $display_tax_label}{l s=3D'Total vouchers (tax excl.)= :'}{else}{l s=3D'Total vouchers:'}{/if} =09=09=09=09=09{else} =09=09=09=09=09=09{if $display_tax_label}{l s=3D'Total vouchers (tax incl.)= :'}{else}{l s=3D'Total vouchers:'}{/if} =09=09=09=09=09{/if} =09=09=09=09{else} =09=09=09=09=09{l s=3D'Total vouchers:'} =09=09=09=09{/if} =09=09=09=09</td> =09=09=09=09<td class=3D"price-discount price" id=3D"total_discount"> =09=09=09=09{if $use_taxes} =09=09=09=09=09{if $priceDisplay} =09=09=09=09=09=09{displayPrice price=3D$total_discounts_tax_exc} =09=09=09=09=09{else} =09=09=09=09=09=09{displayPrice price=3D$total_discounts} =09=09=09=09=09{/if} =09=09=09=09{else} =09=09=09=09=09{displayPrice price=3D$total_discounts_tax_exc} =09=09=09=09{/if} =09=09=09=09</td> =09=09=09</tr> =09=09=09<tr class=3D"cart_total_voucher" {if $total_wrapping =3D=3D 0}s= tyle=3D"display: none;"{/if}> =09=09=09=09<td colspan=3D"5"> =09=09=09=09{if $use_taxes} =09=09=09=09=09{if $priceDisplay} =09=09=09=09=09=09{if $display_tax_label}{l s=3D'Total gift-wrapping (tax e= xcl.):'}{else}{l s=3D'Total gift-wrapping:'}{/if} =09=09=09=09=09{else} =09=09=09=09=09=09{if $display_tax_label}{l s=3D'Total gift-wrapping (tax i= ncl.):'}{else}{l s=3D'Total gift-wrapping:'}{/if} =09=09=09=09=09{/if} =09=09=09=09{else} =09=09=09=09=09{l s=3D'Total gift-wrapping:'} =09=09=09=09{/if} =09=09=09=09</td> =09=09=09=09<td class=3D"price-discount price" id=3D"total_wrapping"> =09=09=09=09{if $use_taxes} =09=09=09=09=09{if $priceDisplay} =09=09=09=09=09=09{displayPrice price=3D$total_wrapping_tax_exc} =09=09=09=09=09{else} =09=09=09=09=09=09{displayPrice price=3D$total_wrapping} =09=09=09=09=09{/if} =09=09=09=09{else} =09=09=09=09=09{displayPrice price=3D$total_wrapping_tax_exc} =09=09=09=09{/if} =09=09=09=09</td> =09=09=09</tr> =09=09=09{if $total_shipping_tax_exc <=3D 0 && !isset($virtualCa= rt)} =09=09=09=09<tr class=3D"cart_total_delivery"> =09=09=09=09=09<td colspan=3D"5">{l s=3D'Shipping:'}</td> =09=09=09=09=09<td class=3D"price" id=3D"total_shipping">{l s=3D'Free= Shipping!'}</td> =09=09=09=09</tr> =09=09=09{else} =09=09=09=09{if $use_taxes} =09=09=09=09=09{if $priceDisplay} =09=09=09=09=09=09<tr class=3D"cart_total_delivery" {if $shippingCost &l= t;=3D 0} style=3D"display:none;"{/if}> =09=09=09=09=09=09=09<td colspan=3D"5">{if $display_tax_label}{l s=3D= 'Total shipping (tax excl.):'}{else}{l s=3D'Total shipping:'}{/if}}</td&= gt; =09=09=09=09=09=09=09<td class=3D"price" id=3D"total_shipping">{displ= ayPrice price=3D$shippingCostTaxExc}</td> =09=09=09=09=09=09</tr> =09=09=09=09=09{else} =09=09=09=09=09=09<tr class=3D"cart_total_delivery"{if $shippingCost <= ;=3D 0} style=3D"display:none;"{/if}> =09=09=09=09=09=09=09<td colspan=3D"5">{if $display_tax_label}{l s=3D= 'Total shipping (tax incl.):'}{else}{l s=3D'Total shipping:'}{/if}</td&g= t; =09=09=09=09=09=09=09<td class=3D"price" id=3D"total_shipping" >{disp= layPrice price=3D$shippingCost}</td> =09=09=09=09=09=09</tr> =09=09=09=09=09{/if} =09=09=09=09{else} =09=09=09=09=09<tr class=3D"cart_total_delivery"{if $shippingCost <= =3D 0} style=3D"display:none;"{/if}> =09=09=09=09=09=09<td colspan=3D"5">{l s=3D'Total shipping:'}</td&= gt; =09=09=09=09=09=09<td class=3D"price" id=3D"total_shipping" >{display= Price price=3D$shippingCostTaxExc}</td> =09=09=09=09=09</tr> =09=09=09=09{/if} =09=09=09{/if} =09=09=09{if $use_taxes} =09=09=09<tr class=3D"cart_total_price"> =09=09=09=09<td colspan=3D"5" id=3D"cart_voucher" class=3D"cart_voucher"= > =09=09=09=09{if $voucherAllowed} =09=09=09=09=09{if isset($errors_discount) && $errors_discount} =09=09=09=09=09=09<ul class=3D"error"> =09=09=09=09=09=09{foreach from=3D$errors_discount key=3Dk item=3Derror} =09=09=09=09=09=09=09<li>{$error|escape:'htmlall':'UTF-8'}</li> =09=09=09=09=09=09{/foreach} =09=09=09=09=09=09</ul> =09=09=09=09=09{/if} =09=09=09=09{/if} =09=09=09=09</td> =09=09=09=09<td colspan=3D"2" class=3D"price total_price_container" id= =3D"total_price_container"> =09=09=09=09=09<p>{l s=3D'Total:'}</p> =09=09=09=09=09<span>{displayPrice price=3D$total_price}</span> =09=09=09=09</td> =09=09=09</tr> =09=09=09{else} =09=09=09<tr class=3D"cart_total_price"> =09=09=09=09<td colspan=3D"5" id=3D"cart_voucher" class=3D"cart_voucher"= > =09=09=09=09{if $voucherAllowed} =09=09=09=09<div id=3D"cart_voucher" class=3D"table_block"> =09=09=09=09=09{if isset($errors_discount) && $errors_discount} =09=09=09=09=09=09<ul class=3D"error"> =09=09=09=09=09=09{foreach from=3D$errors_discount key=3Dk item=3Derror} =09=09=09=09=09=09=09<li>{$error|escape:'htmlall':'UTF-8'}</li> =09=09=09=09=09=09{/foreach} =09=09=09=09=09=09</ul> =09=09=09=09=09{/if} =09=09=09=09=09{if $voucherAllowed} =09=09=09=09=09<form action=3D"{if $opc}{$link->getPageLink('order-op= c.php', true)}{else}{$link->getPageLink('order.php', true)}{/if}" method= =3D"post" id=3D"voucher"> =09=09=09=09=09=09<fieldset> =09=09=09=09=09=09=09<h4><label for=3D"discount_name">{l s=3D'V= ouchers'}</label></h4> =09=09=09=09=09=09=09<p> =09=09=09=09=09=09=09=09<input type=3D"text" id=3D"discount_name" name= =3D"discount_name" value=3D"{if isset($discount_name) && $discount_= name}{$discount_name}{/if}" /> =09=09=09=09=09=09=09</p> =09=09=09=09=09=09=09<p class=3D"submit"><input type=3D"hidden" na= me=3D"submitDiscount" /><input type=3D"submit" name=3D"submitAddDisco= unt" value=3D"{l s=3D'ok'}" class=3D"button" /></p> =09=09=09=09=09=09{if $displayVouchers} =09=09=09=09=09=09=09<h4 class=3D"title_offers">{l s=3D'Take advantag= e of our offers:'}</h4> =09=09=09=09=09=09=09<div id=3D"display_cart_vouchers"> =09=09=09=09=09=09=09{foreach from=3D$displayVouchers item=3Dvoucher} =09=09=09=09=09=09=09=09<span onclick=3D"$('#discount_name').val('{$vouc= her.name}');return false;" class=3D"voucher_name">{$voucher.name}</sp= an> - {$voucher.description} <br /> =09=09=09=09=09=09=09{/foreach} =09=09=09=09=09=09=09</div> =09=09=09=09=09=09{/if} =09=09=09=09=09=09</fieldset> =09=09=09=09=09</form> =09=09=09=09=09{/if} =09=09=09=09</div> =09=09=09=09{/if} =09=09=09=09</td> =09=09=09=09<td colspan=3D"2" class=3D"price total_price_container" id= =3D"total_price_container"> =09=09=09=09=09<p>{l s=3D'Total:'}</p> =09=09=09=09=09<span id=3D"total_price">{displayPrice price=3D$total_= price_without_tax}</span> =09=09=09=09</td> =09=09=09</tr> =09=09=09{/if} =09=09</tfoot> =09=09<tbody> =09=09{foreach from=3D$products item=3Dproduct name=3DproductLoop} =09=09=09{assign var=3D'productId' value=3D$product.id_product} =09=09=09{assign var=3D'productAttributeId' value=3D$product.id_product_att= ribute} =09=09=09{assign var=3D'quantityDisplayed' value=3D0} =09=09=09{assign var=3D'cannotModify' value=3D1} =09=09=09{assign var=3D'odd' value=3D$product@iteration%2} =09=09=09{assign var=3D'noDeleteButton' value=3D1} =09=09=09{* Display the product line *} =09=09=09{include file=3D"$tpl_dir./shopping-cart-product-line.tpl"} =09=09=09{* Then the customized datas ones*} =09=09=09{if isset($customizedDatas.$productId.$productAttributeId)} =09=09=09=09{foreach from=3D$customizedDatas.$productId.$productAttributeId= [$product.id_address_delivery] key=3D'id_customization' item=3D'customizati= on'} =09=09=09=09=09<tr id=3D"product_{$product.id_product}_{$product.id_prod= uct_attribute}_{$id_customization}" class=3D"alternate_item cart_item"> =09=09=09=09=09=09<td colspan=3D"4"> =09=09=09=09=09=09=09{foreach from=3D$customization.datas key=3D'type' item= =3D'datas'} =09=09=09=09=09=09=09=09{if $type =3D=3D $CUSTOMIZE_FILE} =09=09=09=09=09=09=09=09=09<div class=3D"customizationUploaded"> =09=09=09=09=09=09=09=09=09=09<ul class=3D"customizationUploaded"> =09=09=09=09=09=09=09=09=09=09=09{foreach from=3D$datas item=3D'picture'} =09=09=09=09=09=09=09=09=09=09=09=09<li> =09=09=09=09=09=09=09=09=09=09=09=09=09<img src=3D"{$pic_dir}{$picture.v= alue}_small" alt=3D"" class=3D"customizationUploaded" /> =09=09=09=09=09=09=09=09=09=09=09=09</li> =09=09=09=09=09=09=09=09=09=09=09{/foreach} =09=09=09=09=09=09=09=09=09=09</ul> =09=09=09=09=09=09=09=09=09</div> =09=09=09=09=09=09=09=09{elseif $type =3D=3D $CUSTOMIZE_TEXTFIELD} =09=09=09=09=09=09=09=09=09<ul class=3D"typedText"> =09=09=09=09=09=09=09=09=09=09{foreach from=3D$datas item=3D'textField' nam= e=3D'typedText'} =09=09=09=09=09=09=09=09=09=09=09<li> =09=09=09=09=09=09=09=09=09=09=09=09{if $textField.name} =09=09=09=09=09=09=09=09=09=09=09=09=09{l s=3D'%s:' sprintf=3D$textField.na= me} =09=09=09=09=09=09=09=09=09=09=09=09{else} =09=09=09=09=09=09=09=09=09=09=09=09=09{l s=3D'Text #%s:' sprintf=3D$smarty= .foreach.typedText.index+1} =09=09=09=09=09=09=09=09=09=09=09=09{/if} =09=09=09=09=09=09=09=09=09=09=09=09{$textField.value} =09=09=09=09=09=09=09=09=09=09=09</li> =09=09=09=09=09=09=09=09=09=09{/foreach} =09=09=09=09=09=09=09=09=09</ul> =09=09=09=09=09=09=09=09{/if} =09=09=09=09=09=09=09{/foreach} =09=09=09=09=09=09</td> =09=09=09=09=09=09<td class=3D"cart_quantity"> =09=09=09=09=09=09=09{if isset($cannotModify) AND $cannotModify =3D=3D 1} =09=09=09=09=09=09=09=09<span style=3D"float:left">{if $quantityDispl= ayed =3D=3D 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$= customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_= quantity-$quantityDisplayed}{/if}</span> =09=09=09=09=09=09=09{else} =09=09=09=09=09=09=09=09<div style=3D"float:right"> =09=09=09=09=09=09=09=09=09<a rel=3D"nofollow" class=3D"cart_quantity_de= lete" id=3D"{$product.id_product}_{$product.id_product_attribute}_{$id_cust= omization}" href=3D"{$link->getPageLink('cart', true, NULL, "delete&= amp;id_product=3D{$product.id_product|intval}&ipa=3D{$product.id_pr= oduct_attribute|intval}&id_customization=3D{$id_customization}&= amp;token=3D{$token_cart}")}"><img src=3D"{$img_dir}icon/delete.gif" = alt=3D"{l s=3D'Delete'}" title=3D"{l s=3D'Delete this customization'}" widt= h=3D"11" height=3D"13" class=3D"icon" /></a> =09=09=09=09=09=09=09=09</div> =09=09=09=09=09=09=09=09<div id=3D"cart_quantity_button" style=3D"float:= left"> =09=09=09=09=09=09=09=09<a rel=3D"nofollow" class=3D"cart_quantity_up" i= d=3D"cart_quantity_up_{$product.id_product}_{$product.id_product_attribute}= _{$id_customization}" href=3D"{$link->getPageLink('cart', true, NULL, "a= dd&id_product=3D{$product.id_product|intval}&ipa=3D{$produc= t.id_product_attribute|intval}&id_customization=3D{$id_customizatio= n}&token=3D{$token_cart}")}" title=3D"{l s=3D'Add'}"><img src= =3D"{$img_dir}icon/quantity_up.gif" alt=3D"{l s=3D'Add'}" width=3D"14" heig= ht=3D"9" /></a><br /> =09=09=09=09=09=09=09=09{if $product.minimal_quantity < ($customization.= quantity -$quantityDisplayed) OR $product.minimal_quantity <=3D 1} =09=09=09=09=09=09=09=09<a rel=3D"nofollow" class=3D"cart_quantity_down"= id=3D"cart_quantity_down_{$product.id_product}_{$product.id_product_attrib= ute}_{$id_customization}" href=3D"{$link->getPageLink('cart', true, NULL= , "add&id_product=3D{$product.id_product|intval}&ipa=3D{$pr= oduct.id_product_attribute|intval}&id_customization=3D{$id_customiz= ation}&op=3Ddown&token=3D{$token_cart}")}" title=3D"{l s=3D= 'Subtract'}"> =09=09=09=09=09=09=09=09=09<img src=3D"{$img_dir}icon/quantity_down.gif"= alt=3D"{l s=3D'Subtract'}" width=3D"14" height=3D"9" /> =09=09=09=09=09=09=09=09</a> =09=09=09=09=09=09=09=09{else} =09=09=09=09=09=09=09=09<a class=3D"cart_quantity_down" style=3D"opacity= : 0.3;" id=3D"cart_quantity_down_{$product.id_product}_{$product.id_product= _attribute}_{$id_customization}" href=3D"#" title=3D"{l s=3D'Subtract'}">= ; =09=09=09=09=09=09=09=09=09<img src=3D"{$img_dir}icon/quantity_down.gif"= alt=3D"{l s=3D'Subtract'}" width=3D"14" height=3D"9" /> =09=09=09=09=09=09=09=09</a> =09=09=09=09=09=09=09=09{/if} =09=09=09=09=09=09=09=09</div> =09=09=09=09=09=09=09=09<input type=3D"hidden" value=3D"{$customization.= quantity}" name=3D"quantity_{$product.id_product}_{$product.id_product_attr= ibute}_{$id_customization}_hidden"/> =09=09=09=09=09=09=09=09<input size=3D"2" type=3D"text" value=3D"{$custo= mization.quantity}" class=3D"cart_quantity_input" name=3D"quantity_{$produc= t.id_product}_{$product.id_product_attribute}_{$id_customization}"/> =09=09=09=09=09=09=09{/if} =09=09=09=09=09=09</td> =09=09=09=09=09=09<td class=3D"cart_total"></td> =09=09=09=09=09</tr> =09=09=09=09=09{assign var=3D'quantityDisplayed' value=3D$quantityDisplayed= +$customization.quantity} =09=09=09=09{/foreach} =09=09=09=09{* If it exists also some uncustomized products *} =09=09=09=09{if $product.quantity-$quantityDisplayed > 0}{include file= =3D"$tpl_dir./shopping-cart-product-line.tpl"}{/if} =09=09=09{/if} =09=09{/foreach} =09=09{assign var=3D'last_was_odd' value=3D$product@iteration%2} =09=09{foreach $gift_products as $product} =09=09=09{assign var=3D'productId' value=3D$product.id_product} =09=09=09{assign var=3D'productAttributeId' value=3D$product.id_product_att= ribute} =09=09=09{assign var=3D'quantityDisplayed' value=3D0} =09=09=09{assign var=3D'odd' value=3D($product@iteration+$last_was_odd)%2} =09=09=09{assign var=3D'ignoreProductLast' value=3Disset($customizedDatas.$= productId.$productAttributeId)} =09=09=09{assign var=3D'cannotModify' value=3D1} =09=09=09{* Display the gift product line *} =09=09=09{include file=3D"./shopping-cart-product-line.tpl" productLast=3D$= product@last productFirst=3D$product@first} =09=09{/foreach} =09=09</tbody> =09{if count($discounts)} =09=09<tbody> =09=09{foreach from=3D$discounts item=3Ddiscount name=3DdiscountLoop} =09=09=09<tr class=3D"cart_discount {if $smarty.foreach.discountLoop.las= t}last_item{elseif $smarty.foreach.discountLoop.first}first_item{else}item{= /if}" id=3D"cart_discount_{$discount.id_discount}"> =09=09=09=09<td class=3D"cart_discount_name" colspan=3D"2">{$discount= .name}</td> =09=09=09=09<td class=3D"cart_discount_description" colspan=3D"3">{$d= iscount.description}</td> =09=09=09=09<td class=3D"cart_discount_price"> =09=09=09=09=09<span class=3D"price-discount"> =09=09=09=09=09=09{if $discount.value_real > 0} =09=09=09=09=09=09=09{if !$priceDisplay} =09=09=09=09=09=09=09=09{displayPrice price=3D$discount.value_real*-1} =09=09=09=09=09=09=09{else} =09=09=09=09=09=09=09=09{displayPrice price=3D$discount.value_tax_exc*-1} =09=09=09=09=09=09=09{/if} =09=09=09=09=09=09{/if} =09=09=09=09=09</span> =09=09=09=09</td> =09=09=09</tr> =09=09{/foreach} =09=09</tbody> =09{/if} =09</table> </div> {/if}=20
Social titles, such as Mr or Ms, are now generic in PrestaShop 1.5. The =
authentication.tpl
and identity.tpl
files have be=
en changed to take this into account.
In 1.4:
<inpu= t type=3D"radio" name=3D"id_gender" id=3D"id_gender1" value=3D"1"=20 {if isset($smarty.post.id_gender) && $smarty.post.id_gender =3D= =3D 1}checked=3D"checked"{/if} /> <label for=3D"id_gender1" class=3D"top">{l s=3D'Mr.'}</label> <input type=3D"radio" name=3D"id_gender" id=3D"id_gender2" value=3D"2"= =20 {if isset($smarty.post.id_gender) && $smarty.post.id_gender =3D= =3D 2}checked=3D"checked"{/if} /> <label for=3D"id_gender2" class=3D"top">{l s=3D'Ms.'}</label>=20
In 1.5:
{foreach= from=3D$genders key=3Dk item=3Dgender} <input type=3D"radio" name=3D"id_gender" id=3D"id_gender{$gender->i= d}" value=3D"{$gender->id}"=20 {if isset($smarty.post.id_gender) && $smarty.post.id_gender =3D= =3D $gender->id}checked=3D"checked"{/if} /> <label for=3D"id_gender{$gender->id}" class=3D"top">{$gender->= ;name}</label> {/foreach}=20
The file layout.tpl
should be taken into account.
This file is defined (by default= span>) as follows:
You can modify the contents of this file based on an entity type
Type<= /span> of entity
When you want to change the layout as an entity type such as categories, you can define a file layout-
{if !emp= ty($display_header)} {include file=3D'../header.tpl' HOOK_HEADER=3D$HOOK_HEADER} {/if} {* Your template start here *} {if !empty($display_footer)} {include file=3D'../footer.tpl'} {/if} {if !empty($live_edit)} {$live_edit} {/if}=20
This file will be placed in: /themes/defaul= t/override/layout-category.tpl (For the category entity )
N.B.<=
/strong>: a controller is an entity type. This means that you can=
use this feature for the supplier, stores, product, category, and many oth=
ers 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 de=
fine a file-layout-EntityType-ID.tpl defined as:<=
/span>
{if !emp= ty($display_header)} {include file=3D'../header.tpl' HOOK_HEADER=3D$HOOK_HEADER} {/if} {* Your template start here *} {if !empty($display_footer)} {include file=3D'../footer.tpl'} {/if} {if !empty($live_edit)} {$live_edit} {/if}=20
This file will be placed in: /themes/defaul= t/override/layout-product-1.tpl (For the product entity with ID 1)=
It's possible to override the getOverrideTe= mplate from a FrontCo= ntroller to dynamically change the template.
Many template files have been modified in the default theme in order to = make use of the new feature of 1.5:
cart-summary.js
abo=
ve.getProductAttribute()
,=
colorPickerClick(elt)
or checkUrl()
cart-summary.js
above.<=
/li>
Two new variables:
var addr= essMultishippingUrl =3D "{$link->getPageLink('address', true, NULL, "bac= k=3D{$back_order_page}?step=3D1{'&multi-shipping=3D1'|urlencode}{if $ba= ck}&mod=3D{$back|urlencode}{/if}")}"; var addressUrl =3D "{$link->getPageLink('address', true, NULL, "back=3D{= $back_order_page}?step=3D1{if $back}&mod=3D{$back}{/if}")}";=20
End of main code block in 1.4:
{else} <div id=3D"opc_account" class=3D"opc-main-block"> <div id=3D"opc_account-overlay" class=3D"opc-overlay" style=3D"displ= ay:none;"></div> {/if}=20
End of main code block in 1.5:
{else} {if {Configuration::get('PS_ALLOW_MULTISHIPPING')} && !$cart->is= VirtualCart()} <div class=3D"address-form-multishipping"> <div class=3D"button_multishipping_mode" id=3D"multishipping_mode_box"= > <div class=3D"title">{l s=3D'Multi-shipping'}</div> <div class=3D"description"> =09 <input type=3D"checkbox" id=3D"multishipping_mode_checkbox" onchang= e=3D"multishippingMode(this); return false;"/><label for=3D"multiship= ping_mode_checkbox">{l s=3D'I want to specify a delivery address for eac= h product I order.'}</label> </div> <div class=3D"description_off"> =09 <a href=3D"{$link->getPageLink('order-opc', true, NULL, 'ajax=3D= 1&multi-shipping=3D1&method=3Dmultishipping')}" id=3D"link_multishi= pping_form" title=3D"{l s=3D'Choose the delivery addresses'}"> =09 {l s=3D'Specify a delivery address for each product.'} </a> </div> </div> <script type=3D"text/javascript"> {if $is_multi_address_delivery} =09var multishipping_mode =3D true; {else} =09var multishipping_mode =3D false; {/if} var open_multishipping_fancybox =3D {$open_multishipping_fancybox|intva= l}; </script> </div> {/if} <div id=3D"opc_account" class=3D"opc-main-block"> <div id=3D"opc_account-overlay" class=3D"opc-overlay" style=3D"display: = none;"></div> {/if}=20
The main data table has been heavily reworked, see the corresponding fil= e 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/= a>.
Note that the HOOK_EXTRACARRIER
hook can now be used multip=
le times when multiple shipping is used:
In 1.4:
... <tr id=3D"HOOK_EXTRACARRIER">{$HOOK_EXTRACARRIER}</tr> ...=20
In 1.5:
... <div class=3D"hook_extracarrier" id=3D"HOOK_EXTRACARRIER_{$id_address}"&= gt;{if isset($HOOK_EXTRACARRIER_ADDR) && isset($HOOK_EXTRACARRIER_A= DDR.$id_address)}{$HOOK_EXTRACARRIER_ADDR.$id_address}{/if}</div> {foreachelse} <p class=3D"warning" id=3D"noCarrierWarning"> {foreach $cart->getDeliveryAddressesWithoutCarriers(true) as $address} {if empty($address->alias)} {l s=3D'No carriers available.'} {else} {l s=3D'No carriers available for the address "%s".' sprintf=3D$addre= ss->alias} {/if} {if !$address@last} <br /> {/if} {/foreach} </p> {/foreach} ...=20
The following lines have been added in v1.5 in order to enable displayin= g the number of returned products directly in the order summary (order deta= ils):
{if $ord= er->hasProductReturned()} <th class=3D"item"> {l s=3D'Returned'} </th> {/if} {if $order->hasProductReturned()} <td> {$product['qty_returned']} </td> {/if}=20
The following new lines make it possible for your shop to give the custo= mers details about the delivery, for instance its tracking number which can= prove invaluable when multishipping is used.
<div = class=3D"table_block"> {if $order->getShipping()|count > 0} <table class=3D"std"> <thead> <tr> <th class=3D"first_item">{l s=3D'Date'}</th> <th class=3D"item">{l s=3D'Carrier'}</th> <th class=3D"item">{l s=3D'Weight'}</th> <th class=3D"item">{l s=3D'Shipping cost'}</th> <th class=3D"last_item">{l s=3D'Tracking number'}</th>= ; </tr> </thead> <tbody> {foreach from=3D$order->getShipping() item=3Dline} <tr class=3D"item"> <td>{$line.date_add}</td> <td>{$line.state_name}</td> <td>{if $line.weight > 0}{$line.weight|string_format:"%.= 3f"} {Configuration::get('PS_WEIGHT_UNIT')}{else}-{/if}</td> <td>{if $order->getTaxCalculationMethod() =3D=3D $smarty= .const.PS_TAX_INC}{displayPrice price=3D$line.shipping_cost_tax_incl curren= cy=3D$currency->id}{else}{displayPrice price=3D$line.shipping_cost_tax_e= xcl currency=3D$currency->id}{/if}</td> <td> <span id=3D"shipping_number_show">{if $line.tracking_numb= er}{if $line.url && $line.tracking_number}<a href=3D"{$line.url|= replace:'@':$line.tracking_number}">{$line.tracking_number}</a>{el= se}{$line.tracking_number}{/if}{else}-{/if}</span> </td> </tr> {/foreach} </tbody> </table> {/if} </div>=20
New 'back' parameter added to addressUrl
JavaScript variabl=
e:
{if $opc= } {assign var=3D"back_order_page" value=3D"order-opc.php"} {else} {assign var=3D"back_order_page" value=3D"order.php"} {/if} ...then in the JavaScript code: var addressUrl =3D '{$link->getPageLink("address", true, NULL, "back=3D{= $back_order_page}")}';=20
Also, the file has a new JavaScript variable:
var txtS= electAnAddressFirst =3D "{l s=3D'Please start by selecting an address'}";=20