<?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; blocklayered</title>
	<atom:link href="http://nemops.com/tag/blocklayered/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>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 Modules overview: Layered Navigation Block</title>
		<link>http://nemops.com/prestashop-layered-navigation-block/</link>
		<comments>http://nemops.com/prestashop-layered-navigation-block/#comments</comments>
		<pubDate>Mon, 10 Jun 2013 13:34:32 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[blocklayered]]></category>
		<category><![CDATA[modules]]></category>
		<category><![CDATA[prestashop]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=1351</guid>
		<description><![CDATA[<p>In this video we will have an overview of the Prestashop Module called Layered Navigation Block, as many people requested an how to video about its settings and setup! Running time: 24 mins Prestashop version used: 1.5.4.0 Watch the screencast &#160; Additional Resources My Prestashop Modules Store!</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-layered-navigation-block/">Prestashop Modules overview: Layered Navigation Block</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In this video we will have an overview of the Prestashop Module called Layered Navigation Block, as many people requested an how to video about its settings and setup!<br />
<span id="more-1351"></span></p>
<p><strong>Running time: </strong>24 mins<br />
<strong>Prestashop version used:</strong> 1.5.4.0</p>
<h2>Watch the screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/z_6ewjCTD6s" 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>
<h3>Additional Resources</h3>
<p><a href="http://store.nemops.com" title="Prestashop Modules Store">My Prestashop Modules Store!</a></p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-layered-navigation-block/">Prestashop Modules overview: Layered Navigation Block</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/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
