<?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; product</title>
	<atom:link href="http://nemops.com/tag/product/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>Display a &#8220;Bought product&#8221; label in PrestaShop</title>
		<link>http://nemops.com/prestashop-bought-product-label/</link>
		<comments>http://nemops.com/prestashop-bought-product-label/#comments</comments>
		<pubDate>Mon, 05 Sep 2016 08:30:53 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[order]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[product]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2847</guid>
		<description><![CDATA[<p>In today&#8217;s tutorial we will learn how to add a &#8220;bought product&#8221; notification on the PrestaShop product page, much like Amazon does. Creating a ProductController override in PrestaShop The cleanest and standard compliant method for assigning the proper variables in PrestaShop, is to use a controller. We need to add content to the product page, [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-bought-product-label/">Display a &#8220;Bought product&#8221; label in PrestaShop</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In today&#8217;s tutorial we will learn how to add a &#8220;bought product&#8221; notification on the PrestaShop product page, much like Amazon does.</p>
<p><span id="more-2847"></span></p>
<h2>Creating a ProductController override in PrestaShop</h2>
<p>The cleanest and standard compliant method for assigning the proper variables in PrestaShop, is to use a controller. We need to add content to the product page, so the one we are interested in is the ProductController. Additionally, in order to make sure our modification is upgrade-safe, we need to use an override instead of modifying the original.</p>
<p>Let&#8217;s get started!</p>
<p>Create a new file inside <em>override/controllers/front/</em> and name it <strong>ProductController.php</strong></p>
<p>Open it up, and within php tags add the following:</p>
<pre class="brush: php; title: ; notranslate">

Class ProductController extends ProductControllerCore
{

}
</pre>
<p>We want to extend the initContent() method, so let&#8217;s do it:</p>
<pre class="brush: php; title: ; notranslate">

Class ProductController extends ProductControllerCore
{
	public function initContent()
    {
        parent::initContent();
    }
}
</pre>
<p>We are calling the parent&#8217;s initContent as well, to make sure all the needed variables are loaded. At this point, <strong>before</strong> the parent is called, let&#8217;s first check if the current user is a registered customer, as we will never be able to tell what a guest has bought:</p>
<pre class="brush: php; title: ; notranslate">

Class ProductController extends ProductControllerCore
{
	public function initContent()
    {

    	if($this-&gt;context-&gt;customer-&gt;id) // only if logged in
        {
			$bought_products = $this-&gt;context-&gt;customer-&gt;getBoughtProducts(); // only valid orders
        }
        parent::initContent();
    }
}
</pre>
<p>If it is, we get all the products he bought. Please notice only valid(paid) orders are considered. If you wish to include them all, you must remove the condition &#8220;valid = 1&#8243; in the getBoughtProducts method, Customer class.</p>
<p>Now let&#8217;s cycle through them. If the current product&#8217;s id is matched, we assign a date variable to the template:</p>
<pre class="brush: php; title: ; notranslate">
    if($this-&gt;context-&gt;customer-&gt;id) // only if logged in
    {
        $bought_products = $this-&gt;context-&gt;customer-&gt;getBoughtProducts(); // only valid orders
        if($bought_products)
        {
            foreach ($bought_products as $prod) {

                if($prod['product_id'] = $this-&gt;product-&gt;id)
                {
                    $this-&gt;context-&gt;smarty-&gt;assign(array(
                        'bought_on'=&gt; $prod['date_add']
                    ));
                }
            }
        }
    }
</pre>
<p>We are done with php, the next step will be showing our custom text in the product.tpl file. Before proceeding, make sure to erase your class_index.php file, located in the <em>cache/</em> folder.</p>
<div class="separator"></div>
<h2>Adding a bought product text to the product page</h2>
<p>Open up <strong>product.tpl</strong>, located in the theme folder. Please notice your code will be different if you use a custom template, as I am using default-bootstrap for this demonstration. I decided to add the info box at the top of the page, above the product image.<br />
If you want to pick the same spot, locate the div with class pb-left-column, and add the following right before it:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
		{if isset($bought_on)}
			&lt;div class=&quot;col-xs-12&quot;&gt;
				&lt;div class=&quot;bought_on alert alert-info&quot;&gt;
					{l s='You purchased this product on'} {dateFormat date=$bought_on}
				&lt;/div&gt;	
			&lt;/div&gt;
		{/if}
</pre>
<p>Save and refresh, we are done! You should see something like this:</p>
<p><a href="http://nemops.com/wp-content/uploads/2016/09/bought_product_notification.png"><img src="http://nemops.com/wp-content/uploads/2016/09/bought_product_notification-680x418.png" alt="Product bought label in PrestaShop" width="680" height="418" class="aligncenter size-large wp-image-2848" /></a></p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-bought-product-label/">Display a &#8220;Bought product&#8221; label in PrestaShop</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/prestashop-bought-product-label/feed/</wfw:commentRss>
		<slash:comments>7</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>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 Previous and Next navigation buttons to the Prestashop product page</title>
		<link>http://nemops.com/prestashop-previous-next-product-buttons/</link>
		<comments>http://nemops.com/prestashop-previous-next-product-buttons/#comments</comments>
		<pubDate>Tue, 30 Sep 2014 07:57:22 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[product]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2161</guid>
		<description><![CDATA[<p>To allow an easier navigation through categories, let&#8217;s add Previous and Next product navigation buttons to each product page in Prestashop Prestashop version: 1.5, 1.6 Please notice project files are from 1.6.0.9 Introduction Although I only tested this code on Prestashop 1.6, it should equally work on 1.5 as the database structure didn&#8217;t change. That [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-previous-next-product-buttons/">Adding Previous and Next navigation buttons to the Prestashop product page</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>To allow an easier navigation through categories, let&#8217;s add Previous and Next product navigation buttons to each product page in Prestashop</p>
<p><span id="more-2161"></span></p>
<ul>
<li>Prestashop version: <strong>1.5, 1.6</strong></li>
</ul>
<a class="download-files button style1" href="http://nemops.com/wp-content/uploads/2014/09/prevnext_tut.zip" title="Download Project Files">Download Project Files</a>
<p>Please notice project files are from 1.6.0.9</p>
<h2>Introduction</h2>
<p>Although I only tested this code on Prestashop 1.6, it should equally work on 1.5 as the database structure didn&#8217;t change. That said, we need to edit/extend the following files:</p>
<ul>
<li>classes/Product.php (to grab previous and next products)</li>
<li>controllers/front/ProductController.php (to assign links to the template)</li>
<li>themes/default-bootstrap/product.tpl (to add the buttons)</li>
</ul>
<p>As always, I recommend overriding whenever possible; therefore, we will extend the first 2 files and directly modify the template one.</p>
<p>Additionally, given that a product can belong to different categories, we will only navigate through the default one, to make things easier.</p>
<div class="separator"></div>
<h2>Step 1 &#8211; Retrieving the previous and next product</h2>
<p>First off, we need some data to work with. Neither previous nor next product are assigned to the product page, so we need to get them first. As mentioned above, to simplify we will only retrieve the ones that come before and after in the default product category. It is indeed possible to use the previously visited category, but things can get quite complicated and overly troublesome (it might be a good subject for another tutorial though!).</p>
<p>Create a new file inside <em>override/classes</em> and call it <strong>Product.php</strong>, and paste the following inside php tags:</p>
<pre class="brush: php; title: ; notranslate">
class Product extends ProductCore
{
}
</pre>
<p>Then, let&#8217;s create the method we need, and start by grabbing the current product&#8217;s position in its default category:</p>
<pre class="brush: php; title: ; notranslate">

	public function getAdjacentProducts()
	{

		$position  = Db::getInstance()-&gt;getValue('SELECT position FROM '._DB_PREFIX_.'category_product WHERE id_product = ' . (int)$this-&gt;id . ' AND id_category = ' . (int)$this-&gt;id_category_default);
	}

</pre>
<p>Once we get that, we can retrieve previous and next products:</p>
<pre class="brush: php; title: ; notranslate">

	public function getAdjacentProducts()
	{


		$position  = Db::getInstance()-&gt;getValue('SELECT position FROM '._DB_PREFIX_.'category_product WHERE id_product = ' . (int)$this-&gt;id . ' AND id_category = ' . (int)$this-&gt;id_category_default);

		// get products that are before and after
		
		$previous = Db::getInstance(_PS_USE_SQL_SLAVE_)-&gt;getRow('
			SELECT cp.id_product, pl.link_rewrite, cp.position, pl.name
			FROM '._DB_PREFIX_.'category_product cp
			LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (cp.id_product = pl.id_product)
			LEFT JOIN '._DB_PREFIX_.'product p ON (cp.id_product = p.id_product)
			WHERE p.id_category_default = '.(int)$this-&gt;id_category_default.' AND (cp.position &lt; '. (int)($position ) .' ) AND cp.id_category = ' . (int)$this-&gt;id_category_default .' AND pl.id_lang = '.(Context::getContext()-&gt;language-&gt;id).'
			ORDER BY cp.position DESC');

		$next = Db::getInstance(_PS_USE_SQL_SLAVE_)-&gt;getRow('
			SELECT cp.id_product, pl.link_rewrite, cp.position, pl.name
			FROM '._DB_PREFIX_.'category_product cp
			LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (cp.id_product = pl.id_product)
			LEFT JOIN '._DB_PREFIX_.'product p ON (cp.id_product = p.id_product)
			WHERE p.id_category_default = '.(int)$this-&gt;id_category_default.' AND (cp.position &gt; '. (int)($position ) .' ) AND cp.id_category = ' . (int)$this-&gt;id_category_default .' AND pl.id_lang = '.(Context::getContext()-&gt;language-&gt;id).'
			ORDER BY cp.position ASC');


		return array('previous' =&gt; $previous, 'next' =&gt; $next);
	}


</pre>
<p><strong>Explanation:</strong> We are using basically the same qurery for both the previous and next product. For the previous, we get the very first product that has a lower position, given the conditions. For the next, the one that has the immediately higher one. Notice we only grab products from the same default category, and that is why we can&#8217;t simply use position + 1 and position &#8211; 1 in a single query (we would have gaps)</p>
<div class="separator"></div>
<h2>Step 2 &#8211; Assigning products to the Product page</h2>
<p>It&#8217;s time to assign the variables we got to the product page. Create a new override, this time inside <em>override/controllers/front</em> and call it <strong>ProductController.php</strong>. Then, as always, initialize the class override:</p>
<pre class="brush: php; title: ; notranslate">


Class ProductController extends ProductControllerCore
{

	public function initContent()
	{
	
		parent::initContent();
	}	
}
</pre>
<p>We are going to extend the initContent() method, as you can see. Therefore, inside it, and before calling the parent&#8217;s initContent(), paste the following:</p>
<pre class="brush: php; title: ; notranslate">


		$adjacent_products = $this-&gt;product-&gt;getAdjacentProducts();

		$this-&gt;context-&gt;smarty-&gt;assign(array(
			'prev_product'=&gt; $adjacent_products['previous'],
			'next_product'=&gt; $adjacent_products['next']
		));


</pre>
<p><strong>Explanation:</strong> Nothing special here, we simply use the previously created method, and then assign previous and next products</p>
<p>Our final override should look like this:</p>
<pre class="brush: php; title: ; notranslate">
Class ProductController extends ProductControllerCore
{

	public function initContent()
	{


		$adjacent_products = $this-&gt;product-&gt;getAdjacentProducts();

		$this-&gt;context-&gt;smarty-&gt;assign(array(
			'prev_product'=&gt; $adjacent_products['previous'],
			'next_product'=&gt; $adjacent_products['next']
		));

		parent::initContent();
	}	
}
</pre>
<p>Time to add our buttons! Before that, though, open the <em>cache/</em> folder and <strong>erase class_index.php</strong> so that our overrides can take place!</p>
<div class="separator"></div>
<h2>Step 3 &#8211; Adding the new buttons to product.tpl</h2>
<p>In this last stepm I will use the default template (as always), so your code might differ from mine, especially if you are using Prestashop 1.5, as I am using 1.6.</p>
<p>We first need to decide where the two buttons are going to sit. Ideally, I recommend adding them at the very top of the product page, so that they are easily and immediately accessible. Of course, any place is fine. Once you decide on position, open up <strong>product.tpl</strong> located in your theme&#8217;s folder.</p>
<p>For my position, the right spot is <strong>immediately before</strong> the following code, at the very beginning of the file:</p>
<pre class="brush: xml; title: ; notranslate">
	&lt;div class=&quot;primary_block row&quot;&gt;
</pre>
<p>Paste the following in:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
&lt;!-- Navigation --&gt;

&lt;div class=&quot;product-navigation clearfix&quot; style=&quot;margin-bottom:20px&quot;&gt;
	{if $prev_product}
		&lt;a title=&quot;{$prev_product.name}&quot; class=&quot;btn btn-default&quot; href=&quot;{$link-&gt;getProductLink($prev_product.id_product, $prev_product.link_rewrite)}&quot;&gt;{l s='Previous Product'}&lt;/a&gt;
	{/if}
	{if $next_product}
		&lt;a title=&quot;{$next_product.name}&quot; class=&quot;btn btn-default&quot; style=&quot;float:right&quot;href=&quot;{$link-&gt;getProductLink($next_product.id_product, $next_product.link_rewrite)}&quot;&gt;{l s='Next Product'}&lt;/a&gt;
	{/if}
&lt;/div&gt;

</pre>
<p>And we are done!</p>
<p><a href="http://nemops.com/wp-content/uploads/2014/09/prevnext_tut.png"><img src="http://nemops.com/wp-content/uploads/2014/09/prevnext_tut-680x194.png" alt="Display previous and next navigation buttons in the product page in prestashop" width="680" height="194" class="aligncenter size-large wp-image-2165" /></a></p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-previous-next-product-buttons/">Adding Previous and Next navigation buttons to the Prestashop product page</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/prestashop-previous-next-product-buttons/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>
