<?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; subcategories</title>
	<atom:link href="https://nemops.com/tag/subcategories/feed/" rel="self" type="application/rss+xml" />
	<link>https://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 products from subcategories in PrestaShop 1.6</title>
		<link>https://nemops.com/prestashop-16-display-products-from-subcategories/</link>
		<comments>https://nemops.com/prestashop-16-display-products-from-subcategories/#comments</comments>
		<pubDate>Wed, 25 Jan 2017 11:52:29 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[prestashop 1.6]]></category>
		<category><![CDATA[products]]></category>
		<category><![CDATA[subcategories]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2970</guid>
		<description><![CDATA[<p>Are you wondering how to display products from subcategories, without using the layered navigation module? Let&#8217;s see it for PrestaShop 1.6!</p>
<p>The post <a rel="nofollow" href="https://nemops.com/prestashop-16-display-products-from-subcategories/">Display products from subcategories in PrestaShop 1.6</a> appeared first on <a rel="nofollow" href="https://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Are you wondering how to display products from subcategories, without using the layered navigation module? Let&#8217;s see it for PrestaShop 1.6!</p>
<p><span id="more-2970"></span></p>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/6BBM62S6I08" 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="https://nemops.com/prestashop-16-display-products-from-subcategories/">Display products from subcategories in PrestaShop 1.6</a> appeared first on <a rel="nofollow" href="https://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://nemops.com/prestashop-16-display-products-from-subcategories/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding subcategories to the category page in PrestaShop 1.7</title>
		<link>https://nemops.com/prestashop-1-7-add-subcategories/</link>
		<comments>https://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="https://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="https://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="https://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="https://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://nemops.com/prestashop-1-7-add-subcategories/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
