<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>NemoPS &#187; Theming</title>
	<atom:link href="http://nemops.com/category/tutorials/theming/feed/" rel="self" type="application/rss+xml" />
	<link>http://nemops.com</link>
	<description>Prestashop Tutorials, Modules and More!</description>
	<lastBuildDate>Wed, 05 Dec 2018 13:25:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.35</generator>
	<item>
		<title>Manufacturers in alphabetical list in PrestaShop 1.7</title>
		<link>http://nemops.com/prestashop-17-alphabetical-manufacturers/</link>
		<comments>http://nemops.com/prestashop-17-alphabetical-manufacturers/#comments</comments>
		<pubDate>Tue, 07 Feb 2017 11:50:04 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Theming]]></category>
		<category><![CDATA[alphabetical]]></category>
		<category><![CDATA[brands]]></category>
		<category><![CDATA[manufacturers]]></category>
		<category><![CDATA[prestashop 1.7]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2975</guid>
		<description><![CDATA[<p>As we did for PrestaShop 1.5, let&#8217;s see how to turn the boring manufacturer list into an alphabetical, fancy one, for PrestaShop 1.7 Full Code to display manufacturers in an alphabetical list</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-17-alphabetical-manufacturers/">Manufacturers in alphabetical list in PrestaShop 1.7</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>As we did for PrestaShop 1.5, let&#8217;s see how to turn the boring manufacturer list into an alphabetical, fancy one, for PrestaShop 1.7</p>
<p><span id="more-2975"></span></p>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/e5jc5Fv64D8" frameborder="0" allowfullscreen></iframe><p><a href="https://www.youtube.com/user/NemoPostScriptum/videos" rel="nofollow" title="Subscribe Post Scriptum's Youtube Channel">Subscribe Post Scriptum's Youtube Channel</a></p>	</div>
<h2>Full Code to display manufacturers in an alphabetical list</h2>
<pre class="brush: php; html-script: true; title: ; notranslate">
 &lt;div class=&quot;all-brands&quot;&gt;
      
      &lt;ul class=&quot;letter-select clearifx&quot;&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_0&quot;&gt;#&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_A&quot;&gt;A&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_B&quot;&gt;B&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_C&quot;&gt;C&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_D&quot;&gt;D&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_E&quot;&gt;E&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_F&quot;&gt;F&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_G&quot;&gt;G&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_H&quot;&gt;H&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_I&quot;&gt;I&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_J&quot;&gt;J&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_K&quot;&gt;K&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_L&quot;&gt;L&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_M&quot;&gt;M&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_N&quot;&gt;N&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_O&quot;&gt;O&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_P&quot;&gt;P&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_Q&quot;&gt;Q&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_R&quot;&gt;R&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_S&quot;&gt;S&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_T&quot;&gt;T&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_U&quot;&gt;U&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_V&quot;&gt;V&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_W&quot;&gt;W&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_X&quot;&gt;X&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_Y&quot;&gt;Y&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#letter_Z&quot;&gt;Z&lt;/a&gt;&lt;/li&gt;        
      &lt;/ul&gt;

  
      &lt;div class=&quot;brands-by-letter&quot;&gt;
          {$current_letter = '#'}
          {foreach from=$brands item=brand}
            {$first_letter = $brand.name|substr:0:1}
            {if $current_letter != $first_letter}
              {if !$first_letter|in_array:['0','1','2','3','4','5','6','7','8','9']}
                {$current_letter = $first_letter|upper}
                &lt;/div&gt;
              &lt;/div&gt;
              {/if}
              
              &lt;div class=&quot;box-letter clearfix&quot; id=&quot;letter_{if $current_letter == '#'}0{else}{$current_letter|upper}{/if}&quot;&gt;
                &lt;div class=&quot;box-title&quot;&gt;{$current_letter|upper}&lt;/div&gt;
                &lt;div class=&quot;letter-content&quot;&gt;
            {/if}
            &lt;p&gt;
              &lt;a href=&quot;{$link-&gt;getManufacturerLink($brand.id_manufacturer)}&quot;&gt;{$brand.name}&lt;/a&gt;
            &lt;/p&gt;
          {/foreach}
        &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;
</pre>
<pre class="brush: css; title: ; notranslate">


.all-brands .letter-select li {
	float:left;
}

.all-brands .letter-select a {
	padding: 11px;
	font-weight: bold;
	font-size: 14px;
	display:block;
}

.all-brands .box-letter .box-title {
	width: 100%;
	display:block;
	background: #ccc;
	font-weight: bold;
	height: 40px;
	line-height: 40px;
	padding-left: 10px
}

.all-brands .box-letter .letter-content {
	line-height: 32px;
	padding-left: 10px
}

.all-brands .box-letter p {
	margin-bottom: 0;
	float: left;
	width: 25%;
}

</pre>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-17-alphabetical-manufacturers/">Manufacturers in alphabetical list in PrestaShop 1.7</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/prestashop-17-alphabetical-manufacturers/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Adding images to the top menu in PrestaShop 1.7</title>
		<link>http://nemops.com/adding-images-top-menu-prestashop-17/</link>
		<comments>http://nemops.com/adding-images-top-menu-prestashop-17/#comments</comments>
		<pubDate>Tue, 17 Jan 2017 11:42:39 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Theming]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[prestashop 1.7]]></category>
		<category><![CDATA[top menu]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2966</guid>
		<description><![CDATA[<p>In this tutorial we will take back images for the PrestaShop top menu, that had been removed in 1.7</p>
<p>The post <a rel="nofollow" href="http://nemops.com/adding-images-top-menu-prestashop-17/">Adding images to the top menu in PrestaShop 1.7</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In this tutorial we will take back images for the PrestaShop top menu, that had been removed in 1.7</p>
<p><span id="more-2966"></span></p>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/1YP1BMCIRPs" frameborder="0" allowfullscreen></iframe><p><a href="https://www.youtube.com/user/NemoPostScriptum/videos" rel="nofollow" title="Subscribe Post Scriptum's Youtube Channel">Subscribe Post Scriptum's Youtube Channel</a></p>	</div>
<p>The post <a rel="nofollow" href="http://nemops.com/adding-images-top-menu-prestashop-17/">Adding images to the top menu in PrestaShop 1.7</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/adding-images-top-menu-prestashop-17/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding subcategories to the category page in PrestaShop 1.7</title>
		<link>http://nemops.com/prestashop-1-7-add-subcategories/</link>
		<comments>http://nemops.com/prestashop-1-7-add-subcategories/#comments</comments>
		<pubDate>Mon, 02 Jan 2017 11:48:34 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Theming]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[prestashop 1.7]]></category>
		<category><![CDATA[subcategories]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2937</guid>
		<description><![CDATA[<p>Have you been troubled by the absence of subcategories, in PrestaShop 1.7&#8217;s category pages? Let&#8217;s take them back in a few, simple steps! Long time PrestaShop users have always been able to display subcategories in category pages, whatever theme they used. However, for some reason PrestaShop 1.7 doesn&#8217;t seem to have any subcategory showing on [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-1-7-add-subcategories/">Adding subcategories to the category page in PrestaShop 1.7</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Have you been troubled by the absence of subcategories, in PrestaShop 1.7&#8217;s category pages? Let&#8217;s take them back in a few, simple steps!</p>
<p><span id="more-2937"></span></p>
<p>Long time PrestaShop users have always been able to display subcategories in category pages, whatever theme they used. However, for some reason PrestaShop 1.7 doesn&#8217;t seem to have any subcategory showing on page with the classic (standard) theme, making it harder for users to navigate through the catalog, if the merchant chose not to use the side category block or layered navigation. Taking them back is fortunately easy enough, and can be done by almost just cloning the code from the 1.6 default-bootstrap template.<br />
The files we need to edit are <strong>category.tpl</strong> and <strong>theme.css</strong>, so let&#8217;s get to it!</p>
<div class="separator"></div>
<h2>Adding the subcategories loop to PrestaShop 1.7&#8217;s category template</h2>
<p>In the classic theme, let&#8217;s open up <strong>category.tpl</strong>, located in <em>themes\classic\templates\catalog\listing</em>, it should look like the following:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{extends file='catalog/listing/product-list.tpl'}

{block name='product_list_header'}
    &lt;div class=&quot;block-category card card-block hidden-sm-down&quot;&gt;
      &lt;h1 class=&quot;h1&quot;&gt;{$category.name}&lt;/h1&gt;
      {if $category.description}
        &lt;div id=&quot;category-description&quot; class=&quot;text-muted&quot;&gt;{$category.description nofilter}&lt;/div&gt;
        &lt;div class=&quot;category-cover&quot;&gt;
          &lt;img src=&quot;{$category.image.large.url}&quot; alt=&quot;{$category.image.legend}&quot;&gt;
        &lt;/div&gt;
      {/if}
    &lt;/div&gt;
    &lt;div class=&quot;text-xs-center hidden-md-up&quot;&gt;
      &lt;h1 class=&quot;h1&quot;&gt;{$category.name}&lt;/h1&gt;
    &lt;/div&gt;
{/block}
</pre>
<p>What we want to do is append the subcategory loop inside the block, just before it closes, so after the div containing the category title. The <strong>$subgcategories</strong> variable is already assigned to the template, much like in PrestaShop 1.6, and it&#8217;s ready to be used:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">

&lt;div id=&quot;subcategories&quot;&gt;
  &lt;p class=&quot;subcategory-heading&quot;&gt;{l s='Subcategories'}&lt;/p&gt;
  &lt;ul class=&quot;clearfix&quot;&gt;
  	{foreach from=$subcategories item=subcategory}
  	&lt;li&gt;{$subcategory.name}&lt;/li&gt;
	{/foreach}
   &lt;/ul&gt;
&lt;/div&gt;
</pre>
<p>The code we just added is pretty much useless at this stage, as it just prints out each subcategory&#8217;s name, but let&#8217;s first see if it works. Save and refresh any category having children, and subcategories should pop up like this:</p>
<p><a href="http://nemops.com/wp-content/uploads/2016/12/subcategories_added.png"><img src="http://nemops.com/wp-content/uploads/2016/12/subcategories_added.png" alt="Adding subcategories to prestashop 1.7" width="485" height="381" class="aligncenter size-full wp-image-2940" /></a></p>
<p>Nice! Let&#8217;s not make our effort useful by linking them to the proper pages</p>
<pre class="brush: php; html-script: true; title: ; notranslate">

&lt;div id=&quot;subcategories&quot;&gt;
  &lt;p class=&quot;subcategory-heading&quot;&gt;{l s='Subcategories'}&lt;/p&gt;
  &lt;ul class=&quot;clearfix&quot;&gt;
  	{foreach from=$subcategories item=subcategory}
  	&lt;li&gt;
  		&lt;h5&gt;&lt;a class=&quot;subcategory-name&quot; href=&quot;{$link-&gt;getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}&quot;&gt;{$subcategory.name|truncate:25:'...'|escape:'html':'UTF-8'}&lt;/a&gt;&lt;/h5&gt;
  	&lt;/li&gt;
	{/foreach}
   &lt;/ul&gt;
&lt;/div&gt;
</pre>
<p><strong>Explanation:</strong> I copied and pasted the code from 1.6 for the category title, simply wrapping the name in an h5 tag, then an anchor pointing to the proper page. To get the url, we can still use the $link class, and its <strong>getCategoryLink</strong> method. I also left in the <strong>truncate</strong> modifier for the name, which cuts it to the length of 25 characters, and lastly escaped it.</p>
<p>At this point they are at least useful! But why don&#8217;t we go ahead and add the image as well? Let&#8217;s do it right before the h5:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">

&lt;div id=&quot;subcategories&quot;&gt;
  &lt;p class=&quot;subcategory-heading&quot;&gt;{l s='Subcategories'}&lt;/p&gt;
  &lt;ul class=&quot;clearfix&quot;&gt;
  	{foreach from=$subcategories item=subcategory}
  	&lt;li&gt;
  		&lt;a href=&quot;{$link-&gt;getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}&quot; title=&quot;{$subcategory.name|escape:'html':'UTF-8'}&quot; class=&quot;img&quot;&gt;
          	&lt;img class=&quot;replace-2x&quot; src=&quot;{$urls.base_url}img/c/{$subcategory.id_category}.jpg&quot; alt=&quot;{$subcategory.name|escape:'html':'UTF-8'}&quot;  /&gt;
        &lt;/a&gt;
  		&lt;h5&gt;&lt;a class=&quot;subcategory-name&quot; href=&quot;{$link-&gt;getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}&quot;&gt;{$subcategory.name|truncate:25:'...'|escape:'html':'UTF-8'}&lt;/a&gt;&lt;/h5&gt;
  	&lt;/li&gt;
	{/foreach}
   &lt;/ul&gt;
&lt;/div&gt;
</pre>
<p><strong>Explanation:</strong> once more, we are using the link class&#8217;s method to get the correct url pointing to the subcategory; then, we simply add an img tag, pointing directly to the category images folder, as each of them has an image named with the corresponding ID. <strong>Careful</strong> though! We have no way to check if the category has an image or not, and since the default method this theme uses is broken (heh.), you might as well get away without images.<br />
At this point you should have something like this, depending on your images&#8217; size:</p>
<p><a href="http://nemops.com/wp-content/uploads/2016/12/added_images.png"><img src="http://nemops.com/wp-content/uploads/2016/12/added_images.png" alt="Adding subcategories with Images to Prestashop 1.7" width="278" height="648" class="aligncenter size-full wp-image-2941" /></a></p>
<p>It needs some styling, so let&#8217;s see what we can do with css!</p>
<div class="separator"></div>
<h2>Styling subcategories in PrestaShop 1.7</h2>
<p>Open up <strong>theme.css</strong>, located in <em>themes\classic\assets\css</em>. At the very end, let&#8217;s append our css code:</p>
<pre class="brush: css; title: ; notranslate">
.subcategory-heading {
  font-weight: bold;
}
#subcategories ul li {
  float: left;
  width: 25%;
  text-align: center;
}
#subcategories ul li img {
  margin-bottom: 10px;
}
</pre>
<p>I preferred staying on a simple styling here, and of course you will need to adapt the width depending on your category image size. Also, you might want to add media queries to make sure it displays well at smaller resolutions.<br />
Save and refresh, we are done!</p>
<p><a href="http://nemops.com/wp-content/uploads/2016/12/end-result.png"><img src="http://nemops.com/wp-content/uploads/2016/12/end-result.png" alt="Adding subcategories with Images to Prestashop 1.7 - End result" width="521" height="382" class="aligncenter size-full wp-image-2942" /></a></p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-1-7-add-subcategories/">Adding subcategories to the category page in PrestaShop 1.7</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/prestashop-1-7-add-subcategories/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Displaying the EAN/JAN barcode in PrestaShop&#8217;s product page</title>
		<link>http://nemops.com/ean-barcode-prestashop-product-page/</link>
		<comments>http://nemops.com/ean-barcode-prestashop-product-page/#comments</comments>
		<pubDate>Thu, 14 Jan 2016 10:49:33 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Theming]]></category>
		<category><![CDATA[barcode]]></category>
		<category><![CDATA[ean]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[products]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2685</guid>
		<description><![CDATA[<p>In this tutorial we will learn how to display the EAN13 or JAN barcode field in product pages in PrestaShop. * You can apply the same process to the UPC barcode, if that is the one you need, just by changing every occurrence of ean13 to upc 1 &#8211; Amending the product.tpl file The first, [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/ean-barcode-prestashop-product-page/">Displaying the EAN/JAN barcode in PrestaShop&#8217;s product page</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In this tutorial we will learn how to display the EAN13 or JAN barcode field in product pages in PrestaShop.</p>
<p><span id="more-2685"></span></p>
<p><span style="color:#e13125"><strong>*</strong> You can apply the same process to the UPC barcode, if that is the one you need, just by changing every occurrence of <strong>ean13 </strong>to <strong>upc</strong></span></p>
<h2>1 &#8211; Amending the product.tpl file</h2>
<p>The first, obvious step is to modify the product page template. <strong>If you are not using Attribute Combinations, this is actually the only step you need to complete!</strong> </p>
<p>Therefore, open up your theme&#8217;s <strong>product.tpl</strong>, and decide where you want to add the field. Above or below the reference (or instead of it) might be a good spot.</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
&lt;p id=&quot;product_ean13&quot;{if empty($product-&gt;ean13) || !$product-&gt;ean13} style=&quot;display: none;&quot;{/if}&gt;
	&lt;label&gt;{l s='Ean13:'} &lt;/label&gt;
	&lt;span {if !empty($product-&gt;ean13) &amp;&amp; $product-&gt;ean13} content=&quot;{$product-&gt;ean13}&quot;{/if}&gt;{$product-&gt;ean13|escape:'html':'UTF-8'}&lt;/span&gt;
&lt;/p&gt;
</pre>
<p>Save and refresh to see the field pop up where you placed it. As mentioned above, if you are not using product combinations, you can stop here. Otherwise, there are a couple of other modifications you need to do.</p>
<div class="separator"></div>
<h2>2 &#8211; Getting the new field for combinations</h2>
<p>In order to display the proper ean when changing attributes, having each combination its own, we need to ensure the field is assigned to the javascript that handles the page update on select. Sadly, PrestaShop only grabs a limited number of fields with the default combinations query, and <strong>we therefore need to override/modify both the Product class and controller.</strong></p>
<h3>Extending the Product Plass in PrestaShop</h3>
<p>Create a new file named <strong>Product.php</strong> inside <em>override/classes</em>, that will serve as Product class override. Begin by writing some standard override code:</p>
<pre class="brush: php; title: ; notranslate">
class Product extends ProductCore
{

}
</pre>
<p>We want to extend the <strong>getAttributesGroups</strong> method. Mine, grabbed from a clean 1.6.1.2 version, looks like this:</p>
<pre class="brush: php; title: ; notranslate">
    public function getAttributesGroups($id_lang)
    {
        if (!Combination::isFeatureActive()) {
            return array();
        }
        $sql = 'SELECT ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name,
					a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, product_attribute_shop.`id_product_attribute`,
					IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`price`, product_attribute_shop.`ecotax`, product_attribute_shop.`weight`,
					product_attribute_shop.`default_on`, pa.`reference`, product_attribute_shop.`unit_price_impact`,
					product_attribute_shop.`minimal_quantity`, product_attribute_shop.`available_date`, ag.`group_type`
				FROM `'._DB_PREFIX_.'product_attribute` pa
				'.Shop::addSqlAssociation('product_attribute', 'pa').'
				'.Product::sqlStock('pa', 'pa').'
				LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
				LEFT JOIN `'._DB_PREFIX_.'attribute` a ON (a.`id_attribute` = pac.`id_attribute`)
				LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON (ag.`id_attribute_group` = a.`id_attribute_group`)
				LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute`)
				LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group`)
				'.Shop::addSqlAssociation('attribute', 'a').'
				WHERE pa.`id_product` = '.(int)$this-&gt;id.'
					AND al.`id_lang` = '.(int)$id_lang.'
					AND agl.`id_lang` = '.(int)$id_lang.'
				GROUP BY id_attribute_group, id_product_attribute
				ORDER BY ag.`position` ASC, a.`position` ASC, agl.`name` ASC';
        return Db::getInstance()-&gt;executeS($sql);
    }
</pre>
<p>Copy and paste your own inside the override, then add another column to the SELECT statement, right after ag.`group_type`: <strong>, pa.`ean13`</strong></p>
<h3>Extending the Product Controller in PrestaShop</h3>
<p>Create and initialize a file called <strong>ProductController.php</strong> inside <em>override/controllers/front</em>.</p>
<pre class="brush: php; title: ; notranslate">
class ProductController extends ProductControllerCore
{

}
</pre>
<p>This time <strong>we have to copy the whole assignAttributesGroups method</strong>, so make sure you really grab yours from the original ProductController.<br />
After pasting it, locate the following snippet</p>
<pre class="brush: php; title: ; notranslate">
$combinations[$row['id_product_attribute']]['reference'] = $row['reference'];
</pre>
<p>Right after it, add</p>
<pre class="brush: php; title: ; notranslate">
$combinations[$row['id_product_attribute']]['ean13'] = $row['ean13'];
</pre>
<p>Save, then reach <em>cache/</em> and erase the class_index.php file, so that the overrides take place</p>
<div class="separator"></div>
<h2>Step 3 &#8211; displaying the EAN 13 field with Javascript</h2>
<p>So far, so good. The very last thing we need to do it modifying <strong>product.js</strong>, located inside the theme folder, /js/, in order for the field to be displayed for the current combination, and to change when selecting attributes. <strong>Make sure the combinations you select have the field filled in; otherwise you might get misleading results.</strong></p>
<p>The first block of code to locate is the following, around line 93 in PrestaShop 1.6.1.2:</p>
<pre class="brush: jscript; title: ; notranslate">
combinationsJS[k]['reference'] = combinations[i]['reference'];
</pre>
<p>I am sure you can already bet what we need to add:</p>
<pre class="brush: jscript; title: ; notranslate">
combinationsJS[k]['ean13'] = combinations[i]['ean13'];
</pre>
<p>Then, around line 427</p>
<pre class="brush: jscript; title: ; notranslate">
selectedCombination['reference'] = combinations[combination]['reference'];
// add the following
selectedCombination['ean13'] = combinations[combination]['ean13'];
</pre>
<p>Lastly, the very code that acts on the switch:</p>
<pre class="brush: jscript; title: ; notranslate">
	if (selectedCombination['reference'] || productReference)
	{
		if (selectedCombination['reference'])
			$('#product_reference span').text(selectedCombination['reference']);
		else if (productReference)
			$('#product_reference span').text(productReference);
		$('#product_reference:hidden').show('slow');
	}
	else
		$('#product_reference:visible').hide('slow');
</pre>
<p>Right after, add</p>
<pre class="brush: jscript; title: ; notranslate">
	if (selectedCombination['ean13'] || productean13)
	{
		if (selectedCombination['ean13'])
			$('#product_ean13 span').text(selectedCombination['ean13']);
		else if (productean13)
			$('#product_ean13 span').text(productean13);
		$('#product_ean13:hidden').show('slow');
	}
	else
		$('#product_reference:visible').hide('slow');
</pre>
<p>We do not obviously have that <strong>productean13</strong> variable. That needs to be added to <strong>product.tpl</strong>. So, back to it, locate</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{addJsDef productReference=$product-&gt;reference|escape:'html':'UTF-8'}
</pre>
<p>And add</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{addJsDef productean13=$product-&gt;ean13|escape:'html':'UTF-8'}
</pre>
<p>Right after that.</p>
<p>Save and refresh, <strong>we are done!</strong></p>
<p>The post <a rel="nofollow" href="http://nemops.com/ean-barcode-prestashop-product-page/">Displaying the EAN/JAN barcode in PrestaShop&#8217;s product page</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/ean-barcode-prestashop-product-page/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Displaying all Categories of a Product in PrestaShop</title>
		<link>http://nemops.com/prestashop-all-product-categories/</link>
		<comments>http://nemops.com/prestashop-all-product-categories/#comments</comments>
		<pubDate>Wed, 16 Dec 2015 13:13:03 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Theming]]></category>
		<category><![CDATA[categories]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[product]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2675</guid>
		<description><![CDATA[<p>In this quick tip we will extend the Product Controller and template, and display all categories a product belongs to, in PrestaShop</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-all-product-categories/">Displaying all Categories of a Product in PrestaShop</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In this quick tip we will extend the Product Controller and template, and display all categories a product belongs to, in PrestaShop.<br />
<span id="more-2675"></span></p>
<h2>Watch the screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/1YDZE9IkA1o" frameborder="0" allowfullscreen></iframe><p><a href="https://www.youtube.com/user/NemoPostScriptum/videos" rel="nofollow" title="Subscribe Post Scriptum's Youtube Channel">Subscribe Post Scriptum's Youtube Channel</a></p>	</div>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-all-product-categories/">Displaying all Categories of a Product in PrestaShop</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/prestashop-all-product-categories/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Displaying more Supplier information on the Product Page in PrestaShop</title>
		<link>http://nemops.com/prestashop-supplier-info-product-page/</link>
		<comments>http://nemops.com/prestashop-supplier-info-product-page/#comments</comments>
		<pubDate>Wed, 18 Nov 2015 10:41:33 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Theming]]></category>
		<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[suppliers]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2602</guid>
		<description><![CDATA[<p>Displaying more information about a product&#8217;s Supplier, directly on the product page, is quite easy in PrestaShop. It only needs an override and a tiny modification to the product template. Overriding the Product Controller Unless you want to hard-modify the original ProductController, you would need an override to assign all the necessary Supplier data to [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-supplier-info-product-page/">Displaying more Supplier information on the Product Page in PrestaShop</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Displaying more information about a product&#8217;s Supplier, directly on the product page, is quite easy in PrestaShop. It only needs an override and a tiny modification to the product template.</p>
<p><span id="more-2602"></span></p>
<h2>Overriding the Product Controller</h2>
<p>Unless you want to hard-modify the original ProductController, you would need an override to assign all the necessary Supplier data to your product page.</p>
<p>Create a new file in <em>override/controllers/front</em>, and name it <strong>ProductController.php</strong>. Open it up and add some generic override code inside php tags:</p>
<pre class="brush: php; title: ; notranslate">
class ProductController extends ProductControllerCore
{

}
</pre>
<p>We have to override the initContentMethod</p>
<pre class="brush: php; title: ; notranslate">
class ProductController extends ProductControllerCore
{
	public function initContent()
	{
		parent::initContent();
	}
}
</pre>
<p>Make sure you call the parent at the very beginning of it, then add the following inside:</p>
<pre class="brush: php; title: ; notranslate">
if($this-&gt;product-&gt;id_supplier)
{
	
	$id_supplier_address = Address::getAddressIdBySupplierId($this-&gt;product-&gt;id_supplier);
	$supplier_address = new Address($id_supplier_address);
}
</pre>
<p>First off, we are checking the current product has a supplier. Then, we need its address id, which we use to instantiate a new Address object that contains all of the information we seek.</p>
<p>At this point, we can simply assign all we want to the template:</p>
<pre class="brush: php; title: ; notranslate">
if (Validate::isLoadedObject($supplier_address))
				{
					$this-&gt;context-&gt;smarty-&gt;assign(array(
						'supplier_country'=&gt;  $supplier_address-&gt;country,
						'supplier_company'=&gt;  $supplier_address-&gt;company,
						'supplier_address1'=&gt;  $supplier_address-&gt;address1,
						'supplier_postcode'=&gt;  $supplier_address-&gt;postcode,
						'supplier_city'=&gt;  $supplier_address-&gt;city,
						'supplier_phone'=&gt;  $supplier_address-&gt;phone,
						'supplier_state' =&gt; State::getNameById($supplier_address-&gt;id_state),
						'supplier_vat_number'=&gt;  $supplier_address-&gt;vat_number,
					));
				}

</pre>
<p>As an extra measure, we make sure the loaded address object is valid and exists</p>
<p>When you&#8217;re done modifying the file, reach the <em>cache/</em> folder and erase <strong>class_index.php</strong></p>
<div class="separator"></div>
<h2>Amending the product template</h2>
<p>Now we are ready to display our data. Open <strong>product.tpl</strong>, located in your theme&#8217;s folder. You can choose any spot, I decided to go for the area below the social links in the center column.</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
			{if $product-&gt;id_supplier}
				&lt;h4&gt;&lt;a href=&quot;{$link-&gt;getSupplierLink($product-&gt;id_supplier)}&quot;&gt;&lt;strong&gt;{$product-&gt;supplier_name}&lt;/strong&gt;&lt;/a&gt;&lt;/h4&gt;
				&lt;ul&gt;
					&lt;li&gt;{$supplier_address1}&lt;/li&gt;
					&lt;li&gt;{$supplier_postcode}&lt;/li&gt;
					&lt;li&gt;{$supplier_city}, {$supplier_state}&lt;/li&gt;
					&lt;li&gt;{$supplier_country}&lt;/li&gt;
					{if $supplier_vat_number}
						&lt;li&gt;{$supplier_vat_number}&lt;/li&gt;
					{/if}
				&lt;/ul&gt;

			{/if}	
</pre>
<p>I am obviously checking if this product has a supplier, otherwise those variables would not be assigned. Save and refresh, you might need to clear cache in the back office (<strong>Advanced Parameters, Performance</strong>). We&#8217;re done!</p>
<p><a href="http://nemops.com/wp-content/uploads/2015/11/supplier_info.png"><img src="http://nemops.com/wp-content/uploads/2015/11/supplier_info.png" alt="Displaying more Supplier information on the Product Page in PrestaShop" width="550" height="366" class="aligncenter size-full wp-image-2604" /></a></p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-supplier-info-product-page/">Displaying more Supplier information on the Product Page in PrestaShop</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/prestashop-supplier-info-product-page/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Product page tabs like 1.5 on Prestashop 1.6</title>
		<link>http://nemops.com/prestashop-1-6-product-page-tabs/</link>
		<comments>http://nemops.com/prestashop-1-6-product-page-tabs/#comments</comments>
		<pubDate>Wed, 15 Jul 2015 09:15:34 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Theming]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[product]]></category>
		<category><![CDATA[tabs]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2478</guid>
		<description><![CDATA[<p>Have you been missing the traditional product page tabs in the new Prestashop 1.6 Template? If so, see how to easily take them back. Let&#8217;s get some Prestashop 1.5 template code To start off, get some 1.5 template code and drop it into our 1.6. I chose 1.5.6.2 as it&#8217;s the latest 1.5 so far. [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-1-6-product-page-tabs/">Product page tabs like 1.5 on Prestashop 1.6</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Have you been missing the traditional product page tabs in the new Prestashop 1.6 Template? If so, see how to easily take them back.</p>
<p><span id="more-2478"></span></p>
<h2>Let&#8217;s get some Prestashop 1.5 template code</h2>
<p>To start off, get some 1.5 template code and drop it into our 1.6. I chose 1.5.6.2 as it&#8217;s the latest 1.5 so far. This is how it looks like, you can simply copy/paste it:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{if (isset($product) &amp;&amp; $product-&gt;description) || (isset($features) &amp;&amp; $features) || (isset($accessories) &amp;&amp; $accessories) || (isset($HOOK_PRODUCT_TAB) &amp;&amp; $HOOK_PRODUCT_TAB) || (isset($attachments) &amp;&amp; $attachments) || isset($product) &amp;&amp; $product-&gt;customizable}
&lt;div id=&quot;more_info_block&quot; class=&quot;clear&quot;&gt;
	&lt;ul id=&quot;more_info_tabs&quot; class=&quot;idTabs idTabsShort clearfix&quot;&gt;
		{if $product-&gt;description}&lt;li&gt;&lt;a id=&quot;more_info_tab_more_info&quot; href=&quot;#idTab1&quot;&gt;{l s='More info'}&lt;/a&gt;&lt;/li&gt;{/if}
		{if $features}&lt;li&gt;&lt;a id=&quot;more_info_tab_data_sheet&quot; href=&quot;#idTab2&quot;&gt;{l s='Data sheet'}&lt;/a&gt;&lt;/li&gt;{/if}
		{if $attachments}&lt;li&gt;&lt;a id=&quot;more_info_tab_attachments&quot; href=&quot;#idTab9&quot;&gt;{l s='Download'}&lt;/a&gt;&lt;/li&gt;{/if}
		{if isset($accessories) AND $accessories}&lt;li&gt;&lt;a href=&quot;#idTab4&quot;&gt;{l s='Accessories'}&lt;/a&gt;&lt;/li&gt;{/if}
		{if isset($product) &amp;&amp; $product-&gt;customizable}&lt;li&gt;&lt;a href=&quot;#idTab10&quot;&gt;{l s='Product customization'}&lt;/a&gt;&lt;/li&gt;{/if}
		{$HOOK_PRODUCT_TAB}
	&lt;/ul&gt;
	&lt;div id=&quot;more_info_sheets&quot; class=&quot;sheets align_justify&quot;&gt;
	{if isset($product) &amp;&amp; $product-&gt;description}
		&lt;!-- full description --&gt;
		&lt;div id=&quot;idTab1&quot; class=&quot;rte&quot;&gt;{$product-&gt;description}&lt;/div&gt;
	{/if}
	{if isset($features) &amp;&amp; $features}
		&lt;!-- product's features --&gt;
		&lt;ul id=&quot;idTab2&quot; class=&quot;bullet&quot;&gt;
		{foreach from=$features item=feature}
            {if isset($feature.value)}
			    &lt;li&gt;&lt;span&gt;{$feature.name|escape:'htmlall':'UTF-8'}&lt;/span&gt; {$feature.value|escape:'htmlall':'UTF-8'}&lt;/li&gt;
            {/if}
		{/foreach}
		&lt;/ul&gt;
	{/if}
	{if isset($attachments) &amp;&amp; $attachments}
		&lt;ul id=&quot;idTab9&quot; class=&quot;bullet&quot;&gt;
		{foreach from=$attachments item=attachment}
			&lt;li&gt;&lt;a href=&quot;{$link-&gt;getPageLink('attachment', true, NULL, &quot;id_attachment={$attachment.id_attachment}&quot;)|escape:'html'}&quot;&gt;{$attachment.name|escape:'htmlall':'UTF-8'}&lt;/a&gt;&lt;br /&gt;{$attachment.description|escape:'htmlall':'UTF-8'}&lt;/li&gt;
		{/foreach}
		&lt;/ul&gt;
	{/if}
	{if isset($accessories) AND $accessories}
		&lt;!-- accessories --&gt;
		&lt;div id=&quot;idTab4&quot; class=&quot;bullet&quot;&gt;
			&lt;div class=&quot;block products_block accessories_block clearfix&quot;&gt;
				&lt;div class=&quot;block_content&quot;&gt;
					&lt;ul&gt;
					{foreach from=$accessories item=accessory name=accessories_list}
						{if ($accessory.allow_oosp || $accessory.quantity_all_versions &gt; 0 || $accessory.quantity &gt; 0) AND $accessory.available_for_order AND !isset($restricted_country_mode)}
							{assign var='accessoryLink' value=$link-&gt;getProductLink($accessory.id_product, $accessory.link_rewrite, $accessory.category)}
							&lt;li class=&quot;ajax_block_product{if $smarty.foreach.accessories_list.first} first_item{elseif $smarty.foreach.accessories_list.last} last_item{else} item{/if} product_accessories_description&quot;&gt;
								&lt;p class=&quot;s_title_block&quot;&gt;
									&lt;a href=&quot;{$accessoryLink|escape:'htmlall':'UTF-8'}&quot;&gt;{$accessory.name|escape:'htmlall':'UTF-8'}&lt;/a&gt;
									{if $accessory.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE} - &lt;span class=&quot;price&quot;&gt;{if $priceDisplay != 1}{displayWtPrice p=$accessory.price}{else}{displayWtPrice p=$accessory.price_tax_exc}{/if}&lt;/span&gt;{/if}
								&lt;/p&gt;
								&lt;div class=&quot;product_desc&quot;&gt;
									&lt;a href=&quot;{$accessoryLink|escape:'htmlall':'UTF-8'}&quot; title=&quot;{$accessory.legend|escape:'htmlall':'UTF-8'}&quot; class=&quot;product_image&quot;&gt;&lt;img src=&quot;{$link-&gt;getImageLink($accessory.link_rewrite, $accessory.id_image, 'medium_default')|escape:'html'}&quot; alt=&quot;{$accessory.legend|escape:'htmlall':'UTF-8'}&quot; width=&quot;{$mediumSize.width}&quot; height=&quot;{$mediumSize.height}&quot; /&gt;&lt;/a&gt;
									&lt;div class=&quot;block_description&quot;&gt;
										&lt;a href=&quot;{$accessoryLink|escape:'htmlall':'UTF-8'}&quot; title=&quot;{l s='More'}&quot; class=&quot;product_description&quot;&gt;{$accessory.description_short|strip_tags|truncate:400:'...'}&lt;/a&gt;
									&lt;/div&gt;
									&lt;div class=&quot;clear_product_desc&quot;&gt;&amp;nbsp;&lt;/div&gt;
								&lt;/div&gt;
								
								&lt;p class=&quot;clearfix&quot; style=&quot;margin-top:5px&quot;&gt;
									&lt;a class=&quot;button&quot; href=&quot;{$accessoryLink|escape:'htmlall':'UTF-8'}&quot; title=&quot;{l s='View'}&quot;&gt;{l s='View'}&lt;/a&gt;
									{if !$PS_CATALOG_MODE &amp;&amp; ($accessory.allow_oosp || $accessory.quantity &gt; 0)}
									&lt;a class=&quot;exclusive button ajax_add_to_cart_button&quot; href=&quot;{$link-&gt;getPageLink('cart', true, NULL, &quot;qty=1&amp;amp;id_product={$accessory.id_product|intval}&amp;amp;token={$static_token}&amp;amp;add&quot;)|escape:'html'}&quot; rel=&quot;ajax_id_product_{$accessory.id_product|intval}&quot; title=&quot;{l s='Add to cart'}&quot;&gt;{l s='Add to cart'}&lt;/a&gt;
									{/if}
								&lt;/p&gt;
								
							&lt;/li&gt;
						{/if}
					{/foreach}
					&lt;/ul&gt;
				&lt;/div&gt;
			&lt;/div&gt;
		&lt;/div&gt;
	{/if}

	&lt;!-- Customizable products --&gt;
	{if isset($product) &amp;&amp; $product-&gt;customizable}
		&lt;div id=&quot;idTab10&quot; class=&quot;bullet customization_block&quot;&gt;
			&lt;form method=&quot;post&quot; action=&quot;{$customizationFormTarget}&quot; enctype=&quot;multipart/form-data&quot; id=&quot;customizationForm&quot; class=&quot;clearfix&quot;&gt;
				&lt;p class=&quot;infoCustomizable&quot;&gt;
					{l s='After saving your customized product, remember to add it to your cart.'}
					{if $product-&gt;uploadable_files}&lt;br /&gt;{l s='Allowed file formats are: GIF, JPG, PNG'}{/if}
				&lt;/p&gt;
				{if $product-&gt;uploadable_files|intval}
				&lt;div class=&quot;customizableProductsFile&quot;&gt;
					&lt;h3&gt;{l s='Pictures'}&lt;/h3&gt;
					&lt;ul id=&quot;uploadable_files&quot; class=&quot;clearfix&quot;&gt;
						{counter start=0 assign='customizationField'}
						{foreach from=$customizationFields item='field' name='customizationFields'}
							{if $field.type == 0}
								&lt;li class=&quot;customizationUploadLine{if $field.required} required{/if}&quot;&gt;{assign var='key' value='pictures_'|cat:$product-&gt;id|cat:'_'|cat:$field.id_customization_field}
									{if isset($pictures.$key)}
									&lt;div class=&quot;customizationUploadBrowse&quot;&gt;
										&lt;img src=&quot;{$pic_dir}{$pictures.$key}_small&quot; alt=&quot;&quot; /&gt;
										&lt;a href=&quot;{$link-&gt;getProductDeletePictureLink($product, $field.id_customization_field)|escape:'html'}&quot; title=&quot;{l s='Delete'}&quot; &gt;
											&lt;img src=&quot;{$img_dir}icon/delete.gif&quot; alt=&quot;{l s='Delete'}&quot; class=&quot;customization_delete_icon&quot; width=&quot;11&quot; height=&quot;13&quot; /&gt;
										&lt;/a&gt;
									&lt;/div&gt;
									{/if}
									&lt;div class=&quot;customizationUploadBrowse&quot;&gt;
										&lt;label class=&quot;customizationUploadBrowseDescription&quot;&gt;{if !empty($field.name)}{$field.name}{else}{l s='Please select an image file from your computer'}{/if}{if $field.required}&lt;sup&gt;*&lt;/sup&gt;{/if}&lt;/label&gt;
										&lt;input type=&quot;file&quot; name=&quot;file{$field.id_customization_field}&quot; id=&quot;img{$customizationField}&quot; class=&quot;customization_block_input {if isset($pictures.$key)}filled{/if}&quot; /&gt;
									&lt;/div&gt;
								&lt;/li&gt;
								{counter}
							{/if}
						{/foreach}
					&lt;/ul&gt;
				&lt;/div&gt;
				{/if}
				{if $product-&gt;text_fields|intval}
				&lt;div class=&quot;customizableProductsText&quot;&gt;
					&lt;h3&gt;{l s='Text'}&lt;/h3&gt;
					&lt;ul id=&quot;text_fields&quot;&gt;
					{counter start=0 assign='customizationField'}
					{foreach from=$customizationFields item='field' name='customizationFields'}
						{if $field.type == 1}
						&lt;li class=&quot;customizationUploadLine{if $field.required} required{/if}&quot;&gt;
							&lt;label for =&quot;textField{$customizationField}&quot;&gt;{assign var='key' value='textFields_'|cat:$product-&gt;id|cat:'_'|cat:$field.id_customization_field} {if !empty($field.name)}{$field.name}{/if}{if $field.required}&lt;sup&gt;*&lt;/sup&gt;{/if}&lt;/label&gt;
							&lt;textarea name=&quot;textField{$field.id_customization_field}&quot; id=&quot;textField{$customizationField}&quot; rows=&quot;1&quot; cols=&quot;40&quot; class=&quot;customization_block_input&quot;&gt;{if isset($textFields.$key)}{$textFields.$key|stripslashes}{/if}&lt;/textarea&gt;
						&lt;/li&gt;
						{counter}
						{/if}
					{/foreach}
					&lt;/ul&gt;
				&lt;/div&gt;
				{/if}
				&lt;p id=&quot;customizedDatas&quot;&gt;
					&lt;input type=&quot;hidden&quot; name=&quot;quantityBackup&quot; id=&quot;quantityBackup&quot; value=&quot;&quot; /&gt;
					&lt;input type=&quot;hidden&quot; name=&quot;submitCustomizedDatas&quot; value=&quot;1&quot; /&gt;
					&lt;input type=&quot;button&quot; class=&quot;button&quot; value=&quot;{l s='Save'}&quot; onclick=&quot;javascript:saveCustomization()&quot; /&gt;
					&lt;span id=&quot;ajax-loader&quot; style=&quot;display:none&quot;&gt;&lt;img src=&quot;{$img_ps_dir}loader.gif&quot; alt=&quot;loader&quot; /&gt;&lt;/span&gt;
				&lt;/p&gt;
			&lt;/form&gt;
			&lt;p class=&quot;clear required&quot;&gt;&lt;sup&gt;*&lt;/sup&gt; {l s='required fields'}&lt;/p&gt;
		&lt;/div&gt;
	{/if}

	{if isset($HOOK_PRODUCT_TAB_CONTENT) &amp;&amp; $HOOK_PRODUCT_TAB_CONTENT}{$HOOK_PRODUCT_TAB_CONTENT}{/if}
	&lt;/div&gt;
&lt;/div&gt;
{/if}

</pre>
<p>Copy the previous code. Then, open up <strong>product.tpl</strong>, which you can find in the theme&#8217;s folder, and locate this line:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{if isset($features) &amp;&amp; $features}
			&lt;!-- Data sheet --&gt;
			&lt;section class=&quot;page-product-box&quot;&gt;
</pre>
<p>Right before that, paste in the 1.5 template code. We will need to make minor adjustments to it, but before diving deep into coding, let&#8217;s comment out the 1.6 code.<br />
Comment out everything from here:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{if isset($features) &amp;&amp; $features}
</pre>
<p>To right <strong>before</strong></p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{if isset($HOOK_PRODUCT_FOOTER) &amp;&amp; $HOOK_PRODUCT_FOOTER}{$HOOK_PRODUCT_FOOTER}{/if}
</pre>
<p>The result should be as follows:</p>
<pre class="brush: php; title: ; notranslate">
		{*if isset($features) &amp;&amp; $features}
			&lt;!-- Data sheet --&gt;
			&lt;section class=&quot;page-product-box&quot;&gt;
				&lt;h3 class=&quot;page-product-heading&quot;&gt;{l s='Data sheet'}&lt;/h3&gt;
				&lt;table class=&quot;table-data-sheet&quot;&gt;
					{foreach from=$features item=feature}
					&lt;tr class=&quot;{cycle values=&quot;odd,even&quot;}&quot;&gt;
						{if isset($feature.value)}
						&lt;td&gt;{$feature.name|escape:'html':'UTF-8'}&lt;/td&gt;
						&lt;td&gt;{$feature.value|escape:'html':'UTF-8'}&lt;/td&gt;
						{/if}
					&lt;/tr&gt;
					{/foreach}
				&lt;/table&gt;
			&lt;/section&gt;
			&lt;!--end Data sheet --&gt;


// WHOLE CODE BLOCK HERE...



					&lt;/div&gt;
				&lt;/div&gt;
			&lt;/section&gt;
			&lt;!--end Accessories --&gt;
		{/if*}
		{if isset($HOOK_PRODUCT_FOOTER) &amp;&amp; $HOOK_PRODUCT_FOOTER}{$HOOK_PRODUCT_FOOTER}{/if}
</pre>
<p>With the whole block commented out. Then, comment out what comes after the product footer hook as well</p>
<pre class="brush: php; title: ; notranslate">
&lt;!-- description &amp; features --&gt;
		{*if (isset($product) &amp;&amp; $product-&gt;description) || (isset($features) &amp;&amp; $features) || (isset($accessories) &amp;&amp; $accessories) || (isset($HOOK_PRODUCT_TAB) &amp;&amp; $HOOK_PRODUCT_TAB) || (isset($attachments) &amp;&amp; $attachments) || isset($product) &amp;&amp; $product-&gt;customizable}
			{if isset($attachments) &amp;&amp; $attachments}
	

		// WHOLE CODE BLOCK HERE...

				&lt;p class=&quot;clear required&quot;&gt;&lt;sup&gt;*&lt;/sup&gt; {l s='required fields'}&lt;/p&gt;
			&lt;/section&gt;
			&lt;!--end Customization --&gt;
			{/if}
		{/if*}
</pre>
<p>Pay extra attention to this step, there are a bunch of IF statements at the end of the block, which might cause a bad error if not commented out in the right place.</p>
<div class="separator"></div>
<h2>Adapting the code</h2>
<p>At this point, we need to adapt a couple of sections, to make sure they are compatible with 1.6. We will simply examine each section and replace the content with its newer counterpart when needed.</p>
<p>The first block is the product description, and there is really nothing to change here, as it&#8217;s the same across the two templates.</p>
<p><strong>Features</strong> (data sheet) is another one that can be left as it is.</p>
</p>
<p>THe following one would be attachments, looking like this in the 1.5 snippet:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{foreach from=$attachments item=attachment}
	&lt;li&gt;&lt;a href=&quot;{$link-&gt;getPageLink('attachment', true, NULL, &quot;id_attachment={$attachment.id_attachment}&quot;)|escape:'html'}&quot;&gt;{$attachment.name|escape:'htmlall':'UTF-8'}&lt;/a&gt;&lt;br /&gt;{$attachment.description|escape:'htmlall':'UTF-8'}&lt;/li&gt;
{/foreach}
</pre>
<p>Let&#8217;s compare it to the 1.6 version:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{foreach from=$attachments item=attachment name=attachements}
	{if $smarty.foreach.attachements.iteration %3 == 1}&lt;div class=&quot;row&quot;&gt;{/if}
		&lt;div class=&quot;col-lg-4&quot;&gt;
			&lt;h4&gt;&lt;a href=&quot;{$link-&gt;getPageLink('attachment', true, NULL, &quot;id_attachment={$attachment.id_attachment}&quot;)|escape:'html':'UTF-8'}&quot;&gt;{$attachment.name|escape:'html':'UTF-8'}&lt;/a&gt;&lt;/h4&gt;
			&lt;p class=&quot;text-muted&quot;&gt;{$attachment.description|escape:'html':'UTF-8'}&lt;/p&gt;
			&lt;a class=&quot;btn btn-default btn-block&quot; href=&quot;{$link-&gt;getPageLink('attachment', true, NULL, &quot;id_attachment={$attachment.id_attachment}&quot;)|escape:'html':'UTF-8'}&quot;&gt;
				&lt;i class=&quot;icon-download&quot;&gt;&lt;/i&gt;
				{l s=&quot;Download&quot;} ({Tools::formatBytes($attachment.file_size, 2)})
			&lt;/a&gt;
			&lt;hr /&gt;
		&lt;/div&gt;
	{if $smarty.foreach.attachements.iteration %3 == 0 || $smarty.foreach.attachements.last}&lt;/div&gt;{/if}
{/foreach}
</pre>
<p>Replacing it sounds like a good idea, so go ahead and do it. Simply paste over everything inside the foreach (<strong>make sure you also add the name=attachments part</strong>!).</p>
<p><strong>Accessories</strong> is another one we need to replace, so delete everything within the condition:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
	{if isset($accessories) AND $accessories}
		&lt;!-- accessories --&gt;
		&lt;div id=&quot;idTab4&quot; class=&quot;bullet&quot;&gt;

			// Delete everything inside
		&lt;/div&gt;
	{/if}

	&lt;!-- Customizable products --&gt;
</pre>
<p>Still making sure to retain the #idTab4 div</p>
<p>The last block of the 1.5 template concerns customizable data, and it&#8217;s better to replace the whole content here as well. Therefore, once more:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{if isset($product) &amp;&amp; $product-&gt;customizable}
	&lt;div id=&quot;idTab10&quot; class=&quot;bullet customization_block&quot;&gt;
		// Delete everything inside

	&lt;/div&gt;
{/if}

</pre>
<p>Remove everything inside that div with idTab10 as ID.</p>
<p>We should be done&#8230;almost! There is a leftover of the 1.6 section, <strong>Pack Items</strong>, which used to be elsewhere in 1.5. If you don&#8217;t want it to be part of tabbed data, you can simply uncomment the <strong>section</strong> as it is. Otherwise, read on.</p>
<div class="separator"></div>
<h2>Dealing with the Pack Items block</h2>
<p>We cannot simply copy and paste the pack items block, as that would result in a div having no parent link to call it among tabs. The first thing we therefore have to do is add a link pointing to it, in the tabs navigation bar:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
	&lt;ul id=&quot;more_info_tabs&quot; class=&quot;idTabs idTabsShort clearfix&quot;&gt;
		{if $product-&gt;description}&lt;li&gt;&lt;a id=&quot;more_info_tab_more_info&quot; href=&quot;#idTab1&quot;&gt;{l s='More info'}&lt;/a&gt;&lt;/li&gt;{/if}
		{if $features}&lt;li&gt;&lt;a id=&quot;more_info_tab_data_sheet&quot; href=&quot;#idTab2&quot;&gt;{l s='Data sheet'}&lt;/a&gt;&lt;/li&gt;{/if}
		{if $attachments}&lt;li&gt;&lt;a id=&quot;more_info_tab_attachments&quot; href=&quot;#idTab9&quot;&gt;{l s='Download'}&lt;/a&gt;&lt;/li&gt;{/if}
		{if isset($accessories) AND $accessories}&lt;li&gt;&lt;a href=&quot;#idTab4&quot;&gt;{l s='Accessories'}&lt;/a&gt;&lt;/li&gt;{/if}
		{if isset($product) &amp;&amp; $product-&gt;customizable}&lt;li&gt;&lt;a href=&quot;#idTab10&quot;&gt;{l s='Product customization'}&lt;/a&gt;&lt;/li&gt;{/if}
		{if isset($packItems) &amp;&amp; $packItems|@count &gt; 0}&lt;li&gt;&lt;a href=&quot;#blockpack&quot;&gt;{l s='Pack Items'}&lt;/a&gt;&lt;/li&gt;{/if}
		{$HOOK_PRODUCT_TAB}
	&lt;/ul&gt;
</pre>
<p>As you can see, I added a whole new line to handle the pack tab, which is referencing to a (still non existing) div with the id #blockpack. You can really choose any ID you want here, just making sure it matches in the following step.</p>
<p>Let&#8217;s not scroll back after the customization block:</p>
<pre class="brush: php; title: ; notranslate">
	{/if}

	{if isset($HOOK_PRODUCT_TAB_CONTENT) &amp;&amp; $HOOK_PRODUCT_TAB_CONTENT}{$HOOK_PRODUCT_TAB_CONTENT}{/if}
</pre>
<p><strong>Right before</strong> {if isset($HOOK_&#8230; } but <strong>after that closing {/if}</strong> (which was the customization condition), so in that only one empty line, add the following:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
	{if isset($packItems) &amp;&amp; $packItems|@count &gt; 0}
		&lt;div id=&quot;blockpack&quot;&gt;
			{include file=&quot;$tpl_dir./product-list.tpl&quot; products=$packItems}
		&lt;/div&gt;
	{/if}
</pre>
<p>Here is how it should look</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{/if}
{if isset($packItems) &amp;&amp; $packItems|@count &gt; 0}
	&lt;div id=&quot;blockpack&quot;&gt;
		{include file=&quot;$tpl_dir./product-list.tpl&quot; products=$packItems}
	&lt;/div&gt;
{/if}
{if isset($HOOK_PRODUCT_TAB_CONTENT) &amp;&amp; $HOOK_PRODUCT_TAB_CONTENT}{$HOOK_PRODUCT_TAB_CONTENT}{/if}
</pre>
<p><a href="http://nemops.com/wp-content/uploads/2015/07/product_page_tabs_unstyled.png"><img src="http://nemops.com/wp-content/uploads/2015/07/product_page_tabs_unstyled.png" alt="Product Page tabs like 1.5 in Prestashop 1.6 - unstyled" width="658" height="630" class="aligncenter size-full wp-image-2479" /></a></p>
<p>You can now breathe. The worst part is done. Save and refresh, you should have a working tabs system, even if navigation links are stack one on top of the other. Let&#8217;s give it some style!</p>
<div class="separator"></div>
<h2>Styling Tabs in the Product page</h2>
<p>There is not much to do at this point. Open up <strong>product.css</strong>, located in the theme folder, css/, and paste in the following</p>
<pre class="brush: css; title: ; notranslate">

#more_info_tabs li {
  float:left;

}

#more_info_tabs li a {
  padding: 0 20px;
  color:white;
  line-height: 40px;
  height: 40px;
  display:block;
  background: #555;
}

#more_info_tabs li a:active {text-decoration:none;}
#more_info_tabs li a.selected {
  background:black;
  text-decoration:none;
}

</pre>
<p>I gave it some generic styling to have them look like tabs, so feel free to expand over the tutorial and make it prettier! We&#8217;re done!</p>
<p><a href="http://nemops.com/wp-content/uploads/2015/07/product_page_tabs_done.png"><img src="http://nemops.com/wp-content/uploads/2015/07/product_page_tabs_done-680x601.png" alt="Product Page tabs like 1.5 in Prestashop 1.6 - Final result" width="680" height="601" class="aligncenter size-large wp-image-2480" /></a></p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-1-6-product-page-tabs/">Product page tabs like 1.5 on Prestashop 1.6</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/prestashop-1-6-product-page-tabs/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Adding a datepicker to Prestashop Customization Fields</title>
		<link>http://nemops.com/adding-a-datepicker-to-prestashop-customization-fields/</link>
		<comments>http://nemops.com/adding-a-datepicker-to-prestashop-customization-fields/#comments</comments>
		<pubDate>Mon, 13 Apr 2015 10:20:36 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Theming]]></category>
		<category><![CDATA[customization]]></category>
		<category><![CDATA[datepicker]]></category>
		<category><![CDATA[prestashop]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2374</guid>
		<description><![CDATA[<p>In this quick tip we will see how to enable the jquery date picker for Prestashop customization fields Watch the screencast</p>
<p>The post <a rel="nofollow" href="http://nemops.com/adding-a-datepicker-to-prestashop-customization-fields/">Adding a datepicker to Prestashop Customization Fields</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In this quick tip we will see how to enable the jquery date picker for Prestashop customization fields<br />
<span id="more-2374"></span></p>
<h2>Watch the screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/oWE0-NFYaUI" frameborder="0" allowfullscreen></iframe><p><a href="https://www.youtube.com/user/NemoPostScriptum/videos" rel="nofollow" title="Subscribe Post Scriptum's Youtube Channel">Subscribe Post Scriptum's Youtube Channel</a></p>	</div>
<p>The post <a rel="nofollow" href="http://nemops.com/adding-a-datepicker-to-prestashop-customization-fields/">Adding a datepicker to Prestashop Customization Fields</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/adding-a-datepicker-to-prestashop-customization-fields/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Hook the Prestashop Layered Navigation Block to the Center Column</title>
		<link>http://nemops.com/prestashop-layered-navigation-block-center-column/</link>
		<comments>http://nemops.com/prestashop-layered-navigation-block-center-column/#comments</comments>
		<pubDate>Wed, 11 Feb 2015 09:05:46 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Theming]]></category>
		<category><![CDATA[blocklayered]]></category>
		<category><![CDATA[columns]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2319</guid>
		<description><![CDATA[<p>Being one of the most frequently asked questions on the official board, in this quick tip we will see how to hook the layered navigation module to the center column, above the product list/grid in Prestashop. Step 1: overriding the Layered Navigation Module (Optional &#8211; 1.6.0.11 and newer only) If you are not using the [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-layered-navigation-block-center-column/">Hook the Prestashop Layered Navigation Block to the Center Column</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Being one of the most frequently asked questions on the official board, in this quick tip we will see how to hook the layered navigation module to the center column, above the product list/grid in Prestashop.</p>
<p><span id="more-2319"></span></p>
<h2>Step 1: overriding the Layered Navigation Module (Optional &#8211; 1.6.0.11 and newer only)</h2>
<p>If you are not using the latest Prestashop version, you can jump to step 2 as module overrides were not available before that, and it&#8217;s necessary to amend the module directly. If you are, reach the <em>override/modules/</em> folder and create a new one inside it called <strong>blocklayered</strong>. Inside that, add a file named <strong>blocklayered.php</strong> and paste the following inside php tags:</p>
<pre class="brush: php; title: ; notranslate">
 
if (!defined('_CAN_LOAD_FILES_'))
    exit;
 
class BlockLayeredOverride extends BlockLayered
{
 
 
}
</pre>
<p>We have just setup the base file for the override. Go ahead and erase the <strong>class_index.php</strong> located in the <em>cache/</em> folder, so that the new file is loaded and we can start extending the module.</p>
<div class="separator"></div>
<h2>Step 2 &#8211; Adding code for a new hook</h2>
<p>It&#8217;s given that no hook sits on top of the product listing, if you are using, like me, the default template. If you are not, you might want to check out the <strong>category.tpl</strong> file for any usable spot, to avoid adding another one.</p>
<p>We need to add a few lines of code to register a new hook, and allow the Layered Navigation block to stick there as well. First off, if you are using the override method, simply add the following to our new file:</p>
<pre class="brush: php; title: ; notranslate">
 
	public function install()
	{
		if(parent::install() &amp;&amp; $this-&gt;registerHook('categoryTop'))
			return true;
		else return false;
	}

</pre>
<p>Else, if you <strong>are not using the override method</strong>, simply amend the original install() of the <strong>blocklayered.php</strong> file, by adding the new hook registration as follows (see the fourth line &#8220;&#038;&#038; $this->registerHook(&#8216;categoryTop&#8217;)&#8221;)</p>
<pre class="brush: php; title: ; notranslate">
	public function install()
	{
		if (parent::install() &amp;&amp; $this-&gt;registerHook('header')
		&amp;&amp; $this-&gt;registerHook('categoryTop')
		&amp;&amp; $this-&gt;registerHook('categoryAddition') &amp;&amp; $this-&gt;registerHook('categoryUpdate') &amp;&amp; $this-&gt;registerHook('attributeGroupForm')
		&amp;&amp; $this-&gt;registerHook('afterSaveAttributeGroup') &amp;&amp; $this-&gt;registerHook('afterDeleteAttributeGroup') &amp;&amp; $this-&gt;registerHook('featureForm')
		&amp;&amp; $this-&gt;registerHook('afterDeleteFeature') &amp;&amp; $this-&gt;registerHook('afterSaveFeature') &amp;&amp; $this-&gt;registerHook('categoryDeletion')
		&amp;&amp; $this-&gt;registerHook('afterSaveProduct') &amp;&amp; $this-&gt;registerHook('productListAssign') &amp;&amp; $this-&gt;registerHook('postProcessAttributeGroup')
		&amp;&amp; $this-&gt;registerHook('postProcessFeature') &amp;&amp; $this-&gt;registerHook('featureValueForm') &amp;&amp; $this-&gt;registerHook('postProcessFeatureValue')
		&amp;&amp; $this-&gt;registerHook('afterDeleteFeatureValue') &amp;&amp; $this-&gt;registerHook('afterSaveFeatureValue') &amp;&amp; $this-&gt;registerHook('attributeForm')
		&amp;&amp; $this-&gt;registerHook('postProcessAttribute') &amp;&amp; $this-&gt;registerHook('afterDeleteAttribute') &amp;&amp; $this-&gt;registerHook('afterSaveAttribute'))
		{
			if (version_compare(_PS_VERSION_, '1.6.0', '&gt;=') === true)
			{
				// Hook the module either on the left or right column
				$theme = new Theme(Context::getContext()-&gt;shop-&gt;id_theme);
				if ((!$theme-&gt;default_left_column || !$this-&gt;registerHook('leftColumn'))
					&amp;&amp; (!$theme-&gt;default_right_column || !$this-&gt;registerHook('rightColumn')))
				{
					// If there are no colums implemented by the template, throw an error and uninstall the module
					$this-&gt;_errors[] = $this-&gt;l('This module need to be hooked in a column and your theme does not implement one');
					parent::uninstall();
					return false;
				}
			}
			else
				$this-&gt;registerHook('leftColumn');

			Configuration::updateValue('PS_LAYERED_HIDE_0_VALUES', 1);
			Configuration::updateValue('PS_LAYERED_SHOW_QTIES', 1);
			Configuration::updateValue('PS_LAYERED_FULL_TREE', 1);
			Configuration::updateValue('PS_LAYERED_FILTER_PRICE_USETAX', 1);
			Configuration::updateValue('PS_LAYERED_FILTER_CATEGORY_DEPTH', 1);
			Configuration::updateValue('PS_LAYERED_FILTER_INDEX_QTY', 0);
			Configuration::updateValue('PS_LAYERED_FILTER_INDEX_CDT', 0);
			Configuration::updateValue('PS_LAYERED_FILTER_INDEX_MNF', 0);
			Configuration::updateValue('PS_LAYERED_FILTER_INDEX_CAT', 0);
			Configuration::updateValue('PS_ATTRIBUTE_ANCHOR_SEPARATOR', '-');

			$this-&gt;rebuildLayeredStructure();
			$this-&gt;buildLayeredCategories();

			$products_count = Db::getInstance()-&gt;getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.'product`');

			if ($products_count &lt; 20000) // Lock template filter creation if too many products
				$this-&gt;rebuildLayeredCache();

			self::installPriceIndexTable();
			$this-&gt;installFriendlyUrlTable();
			$this-&gt;installIndexableAttributeTable();
			$this-&gt;installProductAttributeTable();

			if ($products_count &lt; 5000) // Lock indexation if too many products
			{
				self::fullPricesIndexProcess();
				$this-&gt;indexUrl();
				$this-&gt;indexAttribute();
			}

			return true;
		}
		else
		{
			// Installation failed (or hook registration) =&gt; uninstall the module
			$this-&gt;uninstall();
			return false;
		}
	}
</pre>
<p>Then, simply add the following new hooking method to your blocklayered file (whichever you are modifying)</p>
<pre class="brush: php; title: ; notranslate">
	public function hookCategoryTop($params)
	{
		return $this-&gt;hookLeftColumn($params);
	}
</pre>
<p>Before proceeding further, make sure you actually reset the Layered Navigation module from the modules section of the back office, so it register the new hook (or uninstall, then install again if that doesn&#8217;t work).</p>
<div class="separator"></div>
<p>Adding the new hook to the category.tpl template file</p>
<p>We will be using the <a href="http://nemops.com/adding-hooks-to-prestashop-1-5/#.VNiLjvmjOr0" title="new method to add hooks in Prestashop">new method to add hooks in Prestashop</a>, introduced since version 1.5. Open up the <strong>category.tpl</strong> file of your template, locate a suitable spot and paste the following in:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{hook h=&quot;categoryTop&quot;}
</pre>
<p><strong>Tip:</strong> I suggest you do it right after the {if $products} statement, before the product list. Here is where I did it, on a default-bootstrap template on 1.6.0.11:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
...

{if $products}
            {hook h=&quot;categoryTop&quot;}
			&lt;div class=&quot;content_sortPagiBar clearfix&quot;&gt;
            	&lt;div class=&quot;sortPagiBar clearfix&quot;&gt;
            		{include file=&quot;./product-sort.tpl&quot;}

...

</pre>
<p>Save and test, the module should be popping out in the middle column:</p>
<p><a href="http://nemops.com/wp-content/uploads/2015/02/blocklayered_center_col.png"><img src="http://nemops.com/wp-content/uploads/2015/02/blocklayered_center_col-680x409.png" alt="Hook the Prestashop Layered Navigation Block to the Center Column - hooked" width="680" height="409" class="aligncenter size-large wp-image-2324" /></a></p>
<p><strong>What to do if it doesn&#8217;t?</strong> First, make sure that your template has been recompiled: reach <em>Advanced Parameters > Performance</em> in the back office, and set <strong>Template Compilation</strong> to <strong>Recompile templates if the files have been updated</strong> at least, or even Force Compile. Refresh the Front office afterwards.</p>
<p>If you still don&#8217;t see anything, there might be a typo in the hook you register. Check all names, then try killing the script on the hooking method as follows:</p>
<pre class="brush: php; title: ; notranslate">
	public function hookCategoryTop($params)
	{
		die('I am here!');
		return $this-&gt;hookLeftColumn($params);
	}
</pre>
<p>If you see the page rendering interrupted by the &#8220;I am here&#8221; text, the hook should work, check that blocklayered is properly configured. If not, check, once more, for typos in function names, registrations and calls. If you are using the override and it still won&#8217;t work after clearing cache, switch to core modifications.</p>
<div class="separator"></div>
<h2>Step 3 &#8211; Making it work</h2>
<p>If you try out the module now, having it hooked to both either of the side columns and to the center one, you&#8217;ll be disappointed to notice it won&#8217;t work. Why? A javascript error will be triggered upon click.</p>
<p>To fix it, simply <strong>unhook the Layered Navigation from the side columns, leaving only one instance of it running in the center one</strong>. Reach Modules > positions and look the the module&#8217;s instances in displayLeftColumn and displayRightColumn. Unhook both, just in case.</p>
<div class="separator"></div>
<h2>Beauty Pass</h2>
<p>There is no need to say a huge list of features/attributes/whatever shown at the very top of the product list will force people to scroll down to see products. It&#8217;s therefore better to give the new block some better styling. Open up <strong>themes\default-bootstrap\css\modules\blocklayered\blocklayered.css</strong> (or the one of your template, or create it if it&#8217;s not there). </p>
<p>At the cery end, add:</p>
<pre class="brush: css; title: ; notranslate">
#center_column .layered_filter{
  float:left;
  width: 50%;
}
#center_column .layered_filter:nth-child(2n) {
  clear:left;
}
</pre>
<p>It&#8217;s just some basic styling to shorten the height, but it will give you the right pointer to customize it further.</p>
<p>We&#8217;re done!</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-layered-navigation-block-center-column/">Hook the Prestashop Layered Navigation Block to the Center Column</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/prestashop-layered-navigation-block-center-column/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Prestashop: Upgrade-safe template modifications</title>
		<link>http://nemops.com/prestashop-upgrade-safe-template-modifications/</link>
		<comments>http://nemops.com/prestashop-upgrade-safe-template-modifications/#comments</comments>
		<pubDate>Wed, 03 Dec 2014 09:10:33 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Theming]]></category>
		<category><![CDATA[override]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2227</guid>
		<description><![CDATA[<p>If you have ever been frustrated because your template modifications got lost after upgrading, here is the final, bulletproof solution for upgrade-safe prestashop template modifications (with overrides!). Last week, I came across a really useful hook, almost by chance: displayOverrideTemplate. It&#8217;s not (of course) mentioned anywhere in the official Prestashop documentation, but it&#8217;s fundamental to [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-upgrade-safe-template-modifications/">Prestashop: Upgrade-safe template modifications</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>If you have ever been frustrated because your template modifications got lost after upgrading, here is the final, bulletproof solution for upgrade-safe prestashop template modifications (with overrides!).</p>
<p><span id="more-2227"></span></p>
<a class="download-files button style1" href="http://nemops.com/wp-content/uploads/2014/12/psoverridetemplatedemo.zip" title="Download Project Files">Download Project Files</a>
<p>Last week, I came across a really useful hook, almost by chance: <strong>displayOverrideTemplate</strong>. It&#8217;s not (of course) mentioned anywhere in the official Prestashop documentation, but it&#8217;s fundamental to anyone willing to extend/modify the current template without fearing to lose all these tweaks with the next upgrade.</p>
<p>It&#8217;s been around since Prestashop 1.5, given what the calling method states, inside the <strong>FrontController.php</strong> file:</p>
<pre class="brush: php; title: ; notranslate">
	/**
	 * Returns the template corresponding to the current page.
	 * By default this method return false but could easily be overridden in a specific controller
	 *
	* @since 1.5
	* @return bool
	*/
	public function getOverrideTemplate()
	{
		return Hook::exec('DisplayOverrideTemplate', array('controller' =&gt; $this));
	}
</pre>
<p>At any rate, enough chit-chatting, it&#8217;s time to see the true power of this hook!</p>
<div class="separator"></div>
<h2>Example &#8211; Overriding the category page</h2>
<p>In this example, we will use a simple module to override the category page. Download the project files above, and then place the &#8216;psoverridetemplatedemo&#8217; folder in your Prestashop <em>modules/</em> folder. It&#8217;s nothing fancy, it&#8217;s just a blank module that does absolutely nothing. We will add something to it right away: locate the install method, and register our fancy hook</p>
<pre class="brush: php; title: ; notranslate">
	public function install()
	{
		if (!parent::install() ||
			!$this-&gt;registerHook('displayOverrideTemplate')
			)
			return false;
		return true;
	}
	
</pre>
<p>Install it. Then, to test that it really works, let&#8217;s add something SO invasive:</p>
<pre class="brush: php; title: ; notranslate">
	public function hookDisplayOverrideTemplate($params)
	{
		die('here');
		// return dirname(__FILE__).'/views/templates/hook/skeleton.tpl';
	}
</pre>
<p>This should kill every single page of your store, displaying &#8220;here&#8221; instead. If not, check the registerHook method.</p>
<p><strong>What should we now return from the hook?</strong> Not a template, as you might think, nor we will call smarty&#8217;s fetch method. <strong>We need to return a path to the template file we want to use</strong>. We have one in out module&#8217;s root (psoverridetemplatedemo.tpl), so let&#8217;s reference it here:</p>
<pre class="brush: php; title: ; notranslate">
	public function hookDisplayOverrideTemplate($params)
	{
		return dirname(__FILE__).'/psoverridetemplatedemo.tpl';
	}
</pre>
<p>Save and refresh. Every page of your store should now have the center column blank. Why? Because there is nothing in the template file. Add some garbage test to try it out, and you will see it appearing in every page. Yes, but this is not so useful, <strong>how can we replace a specific template?</strong> In a previous tutorial on <a href="http://nemops.com/page-specific-prestashop-module/#.VHeY7jGjOr0" target="_blank" title="Target specific pages from a Prestashop Module’s Hook">Target specific pages from a Prestashop Module’s Hook</a>, I showed you how to get each page&#8217;s specific identifier using the following method:</p>
<pre class="brush: php; title: ; notranslate">
$this-&gt;context-&gt;controller-&gt;php_self
</pre>
<p>If you recall the beginning of this article, we saw the Front Controller is passing the current controller object into the hook, which is then available to us for use within our method. The snippet I just mentioned therefore becomes:</p>
<pre class="brush: php; title: ; notranslate">
$params['controller']-&gt;php_self;
</pre>
<p>Easy as that. Let&#8217;s override the category page only, for example:</p>
<pre class="brush: php; title: ; notranslate">
	public function hookDisplayOverrideTemplate($params)
	{
		if ($params['controller']-&gt;php_self == 'category')
			return dirname(__FILE__).'/psoverridetemplatedemo.tpl';
	}
</pre>
<p>Save and refresh. The only overridden template will now be the category one! Sounds like a good deal. What about other pages? It&#8217;s easy enough to inspect each page&#8217;s name as follows:</p>
<pre class="brush: php; title: ; notranslate">
	public function hookDisplayOverrideTemplate($params)
	{
		var_dump($params['controller']-&gt;php_self);
		//if ($params['controller']-&gt;php_self == 'category')
		//	return dirname(__FILE__).'/psoverridetemplatedemo.tpl';
	}
</pre>
<p>The page name will be shown at the top. <strong>There are some exceptions though.</strong></p>
<p>Some pages simply don&#8217;t have any php_self assigned, and that statement would therefore cause trouble. To overcome, it&#8217;s enough to make sure it is assigned before comparing it to anything:</p>
<pre class="brush: php; title: ; notranslate">
	public function hookDisplayOverrideTemplate($params)
	{
		if (isset($params['controller']-&gt;php_self) &amp;&amp; $params['controller']-&gt;php_self == 'category')
			return dirname(__FILE__).'/psoverridetemplatedemo.tpl';
	}
</pre>
<p>And that&#8217;s it, you can target virtually every template for every controller with a page name now!</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-upgrade-safe-template-modifications/">Prestashop: Upgrade-safe template modifications</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/prestashop-upgrade-safe-template-modifications/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
