Jump to content
Samy_R

[Tip] How to display subcategories products on a category page

Recommended Posts

Recently, I needed to display, on a category page, products from children categories of my current category.

 

It is not possible with non-customized Prestashop, but you can, since 1.4, use override to extend Prestashop features.

 

Just create override/controllers/CategoryController.php and put the following code inside :

class CategoryController extends CategoryControllerCore
{
public $php_self = 'category.php';

protected $category;



public function process()
{
	parent::process();
	global $cookie,$smarty;

	//Hack pour lister les produits des sous-catégories
	$subCategories = $this->category->recurseLiteCategTree();
	$subCategories = $subCategories['children'];

	$subCategories_list = array();
	foreach($subCategories as $subCategory) {
		array_push($subCategories_list,$subCategory['id']);
	}
	$subCategories_list = implode($subCategories_list,",");
	$sql = 'SELECT p.*, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`,  p.`upc`,
		i.`id_image`, il.`legend`, t.`rate`
	FROM `'._DB_PREFIX_.'product` p
	LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)($cookie->id_lang).')
	LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
	LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)($cookie->id_lang).')
	LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
	                                           AND tr.`id_country` = '.(int)Country::getDefaultCountryId().'
                                           	   AND tr.`id_state` = 0)
    LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
	WHERE p.id_product IN (SELECT id_product FROM `'._DB_PREFIX_.'category_product` WHERE id_category IN ('.$subCategories_list.'))
	LIMIT 0,'.Configuration::get('PS_PRODUCTS_SUBCATS_LIMIT');
	$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
	array_shuffle($result);

	$smarty->assign(array(
		'subproducts' => Product::getProductsProperties($cookie->id_lang, $result)
	));
}
}

 

You need to add an entry in your ps_configuration table :

- name : PS_PRODUCTS_SUBCATS_LIMIT

- value : 10 (or whatever you want)

 

You can now use $subproducts Smarty array in your category.tpl template

  • Like 2

Share this post


Link to post
Share on other sites

Hi, can You write any example of file category.tpl which will use this feature or some code which We must paste to category.tpl to activate this function?

Share this post


Link to post
Share on other sites

I use a subtemplate (which is in fact a slightly modified copy of product-list.tpl) :

 

Use

{include file="$tpl_dir./product-subs.tpl" products=$subproducts}

to call it from category.tpl

 

And create the corresponding file :

{if isset($products)}
<!-- Products list -->
<div class="products_block subs">
 <h4>{l s='Voir aussi'}</h4>
 <ul class="clear">
 {foreach from=$products item=product name=products}

  <li class="ajax_block_product {if $smarty.foreach.products.first}first_item{elseif $smarty.foreach.products.last}last_item{else}item{/if} ">
 <div class="product_desc"><a href="{$product.link}" title="{$product.name|truncate:32:'...'|escape:'htmlall':'UTF-8'}">{$product.name|truncate:27:'...'|escape:'htmlall':'UTF-8'}</a></div>
 <a href="{$product.link}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'subs')}"  alt="{$product.name|escape:html:'UTF-8'}" /></a>
 <div>
  {if $product.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}<p class="price_container"><span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span></p>{else}<div style="height:21px;"></div>{/if}
  <a class="button" href="{$product.link}" title="{l s='View'}">{l s='View'}</a>
  {if ($product.id_product_attribute == 0 OR (isset($add_prod_display) AND ($add_prod_display == 1))) AND $product.available_for_order AND !isset($restricted_country_mode) AND $product.minimal_quantity == 1 AND $product.customizable != 2 AND !$PS_CATALOG_MODE}

  {else}
   <div style="height:23px;"></div>
  {/if}
 </div>
   </li>
 {/foreach}
 </ul>
</div>
<!-- /Products list -->
{/if}

  • Like 2

Share this post


Link to post
Share on other sites

I just tried this and get the following error using the CategoryController.php you created:

 

class CategoryController extends CategoryControllerCore { public $php_self = 'category.php'; protected $category; public function process() { parent::process(); global $cookie,$smarty; $subCategories = $this->category->recurseLiteCategTree(); $subCategories = $subCategories['children']; $subCategories_list = array(); foreach($subCategories as $subCategory) { array_push($subCategories_list,$subCategory['id']); } $subCategories_list = implode($subCategories_list,","); $sql = 'SELECT p.*, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`, p.`upc`, i.`id_image`, il.`legend`, t.`rate` FROM `'._DB_PREFIX_.'product` p LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)($cookie->id_lang).') LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1) LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)($cookie->id_lang).') LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group` AND tr.`id_country` = '.(int)Country::getDefaultCountryId().' AND tr.`id_state` = 0) LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`) WHERE p.id_product IN (SELECT id_product FROM `'._DB_PREFIX_.'category_product` WHERE id_category IN ('.$subCategories_list.')) LIMIT 0,'.Configuration::get('PS_PRODUCTS_SUBCATS_LIMIT'); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); array_shuffle($result); $smarty->assign(array( 'subproducts' => Product::getProductsProperties($cookie->id_lang, $result) )); } }

 

If I remove that file, it works fine. I created the database entry as mentioned and even tried the above solution in the post above mine and still have the same issue. Can you advise?

Share this post


Link to post
Share on other sites

I just tried this and get the following error using the CategoryController.php you created:

 

 

 

If I remove that file, it works fine. I created the database entry as mentioned and even tried the above solution in the post above mine and still have the same issue. Can you advise?

Did you use the <?php ?> closing tags in the file ?

Share this post


Link to post
Share on other sites

Just curious, has anybody got this to work? I am not sure what I did wrong, but I after I make the changes as listed above, no products are showing on my category pages. If anyone has it working and has any advise, please share. Can't find any other threads that solve this problem at the moment.

Share this post


Link to post
Share on other sites

My Prestashop install (1.4.7) is showing child products in the parent category by default?? I can't for the life of me find how to stop this!

 

I have:

 

Mens

- t-shirts

- jeans

 

etc etc

 

and a product is ONLY in the t-shirts category but is showing when i go to the Mens category also

 

???

Share this post


Link to post
Share on other sites

My Prestashop install (1.4.7) is showing child products in the parent category by default?? I can't for the life of me find how to stop this!

 

I have:

 

Mens

- t-shirts

- jeans

 

etc etc

 

and a product is ONLY in the t-shirts category but is showing when i go to the Mens category also

 

???

I have this happening as well and wonder how I would prevent it from happening?

Share this post


Link to post
Share on other sites

Recently, I needed to display, on a category page, products from children categories of my current category.

 

It is not possible with non-customized Prestashop, but you can, since 1.4, use override to extend Prestashop features.

 

Just create override/controllers/CategoryController.php and put the following code inside :

class CategoryController extends CategoryControllerCore
{
public $php_self = 'category.php';

protected $category;



public function process()
{
	parent::process();
	global $cookie,$smarty;

	//Hack pour lister les produits des sous-catégories
	$subCategories = $this->category->recurseLiteCategTree();
	$subCategories = $subCategories['children'];

	$subCategories_list = array();
	foreach($subCategories as $subCategory) {
		array_push($subCategories_list,$subCategory['id']);
	}
	$subCategories_list = implode($subCategories_list,",");
	$sql = 'SELECT p.*, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`,  p.`upc`,
		i.`id_image`, il.`legend`, t.`rate`
	FROM `'._DB_PREFIX_.'product` p
	LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)($cookie->id_lang).')
	LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
	LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)($cookie->id_lang).')
	LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
											   AND tr.`id_country` = '.(int)Country::getDefaultCountryId().'
										   	   AND tr.`id_state` = 0)
	LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
	WHERE p.id_product IN (SELECT id_product FROM `'._DB_PREFIX_.'category_product` WHERE id_category IN ('.$subCategories_list.'))
	LIMIT 0,'.Configuration::get('PS_PRODUCTS_SUBCATS_LIMIT');
	$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
	array_shuffle($result);

	$smarty->assign(array(
		'subproducts' => Product::getProductsProperties($cookie->id_lang, $result)
	));
}
}

 

You need to add an entry in your ps_configuration table :

- name : PS_PRODUCTS_SUBCATS_LIMIT

- value : 10 (or whatever you want)

 

You can now use $subproducts Smarty array in your category.tpl template

 

Hi,

Please help me.. This code not working in prestashop latest version...

can any one upgrade this code.

Thank you

Share this post


Link to post
Share on other sites

We recently wanted to display all the subcategory products on the category page. In our search we found this forum and having found a solution for ourselves wanted to share it with the community.

 

If you are using a recent version of Prestashop that has prestashop/override/controllers/front/CategoryController.php then your code changes will go there.

If you are using an older version of Prestashop that does not have an overrides folder then your changes will go in prestashop/controllers/front/CategoryController.php (edits here could have issues with upgrades, always use prestashop/override/ when possible)

 

For this example we will assume you are editing the override at prestashop/override/controllers/front/CategoryController.php

 

Currently, the function assignSubcategories in prestashop/controllers/front/CategoryController.php looks like this:

protected function assignSubcategories()
{
 if ($subCategories = $this->category->getSubCategories($this->context->language->id))
 {
  $this->context->smarty->assign(array(
'subcategories' => $subCategories,
'subcategories_nb_total' => count($subCategories),
'subcategories_nb_half' => ceil(count($subCategories) / 2)
  ));
 }
}

 

We will be adding the following code to this function (but in our override file):

$subcategory_objects=array();
		self::$smarty->assign("andr_lang",(int)(self::$cookie->id_lang));
		foreach ($subCategories as $subcategory)
		{
			$sub=new Category(($subcategory['id_category']),(int)(self::$cookie->id_lang));
			$subcategory_objects[$subcategory[id_category]]=$sub;
		}
		self::$smarty->assign("subcategories_objects",$subcategory_objects);

 

Step 1

Open prestashop/override/controllers/front/CategoryController.php in a text editor and add copy our combined code there:

<?php
class CategoryController extends CategoryControllerCore
{
/**
 * Assign sub categories templates vars
 */
protected function assignSubcategories()
{
 if ($subCategories = $this->category->getSubCategories($this->context->language->id))
 {
  $this->context->smarty->assign(array(
'subcategories' => $subCategories,
'subcategories_nb_total' => count($subCategories),
'subcategories_nb_half' => ceil(count($subCategories) / 2)
  ));
  $subcategory_objects=array();
		self::$smarty->assign("andr_lang",(int)(self::$cookie->id_lang));
		foreach ($subCategories as $subcategory)
		{
			$sub=new Category(($subcategory['id_category']),(int)(self::$cookie->id_lang));
			$subcategory_objects[$subcategory[id_category]]=$sub;
		}
		self::$smarty->assign("subcategories_objects",$subcategory_objects);
 }
}
}

 

 

Step 2

 

Open prestashop/themes/YOUR_THEME/category.tpl

Right below

{if $subcategory.description}
   <p class="cat_desc">{$subcategory.description}</p>
  {/if}

 

You'll want to add

<!-- displays the subcategory products -->
  {assign var="subcategory_id" value=$subcategory.id_category}
  {assign var="subcategory_object" value=$subcategories_objects.$subcategory_id}
				 {include file="$tpl_dir./product-list-sub.tpl" products=$subcategory_object->getProducts($andr_lang,'1','100')}

 

Step 3

Notice here that we are calling a file that doesn't exist yet 'product-list-sub.tpl'. To save some time you can use one of Prestashop's current files and edit it to fit your needs. Make a copy of prestashop/themes/YOUR_THEME/product-list.tpl and rename the copy to product-list-sub.tpl

 

Save all your changes and refresh your category page. You should now see the subcategories' products listed out below each subcategory title. Depending on your theme you may need to make adjustments for the display or change what product information you want to display. To do this you can now edit prestashop/themes/YOUR_THEME/product-list-sub.tpl.

 

Hope this helps!

Edited by papertraitors (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Recently, I needed to display, on a category page, products from children categories of my current category.

 

It is not possible with non-customized Prestashop, but you can, since 1.4, use override to extend Prestashop features.

 

Just create override/controllers/CategoryController.php and put the following code inside :

class CategoryController extends CategoryControllerCore
{
public $php_self = 'category.php';

protected $category;



public function process()
{
	parent::process();
	global $cookie,$smarty;

	//Hack pour lister les produits des sous-catégories
	$subCategories = $this->category->recurseLiteCategTree();
	$subCategories = $subCategories['children'];

	$subCategories_list = array();
	foreach($subCategories as $subCategory) {
		array_push($subCategories_list,$subCategory['id']);
	}
	$subCategories_list = implode($subCategories_list,",");
	$sql = 'SELECT p.*, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`,  p.`upc`,
		i.`id_image`, il.`legend`, t.`rate`
	FROM `'._DB_PREFIX_.'product` p
	LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)($cookie->id_lang).')
	LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
	LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)($cookie->id_lang).')
	LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
											   AND tr.`id_country` = '.(int)Country::getDefaultCountryId().'
										   	   AND tr.`id_state` = 0)
	LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
	WHERE p.id_product IN (SELECT id_product FROM `'._DB_PREFIX_.'category_product` WHERE id_category IN ('.$subCategories_list.'))
	LIMIT 0,'.Configuration::get('PS_PRODUCTS_SUBCATS_LIMIT');
	$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
	array_shuffle($result);

	$smarty->assign(array(
		'subproducts' => Product::getProductsProperties($cookie->id_lang, $result)
	));
}
}

 

You need to add an entry in your ps_configuration table :

- name : PS_PRODUCTS_SUBCATS_LIMIT

- value : 10 (or whatever you want)

 

You can now use $subproducts Smarty array in your category.tpl template

 

 

 

i have this error:

Fatal error: Call to undefined function array_shuffle() in .../public_html/.../override/controllers/CategoryController.php on line 37

 

 

prestashop version: 1.4.4.0

 

any idea ?

Edited by svchost (see edit history)

Share this post


Link to post
Share on other sites

Hi, any tips on how to get products to display above the subcategory list on the categories page? Here's the page I'm looking at: http://www.learninggizmos.com/pincentives/index.php?id_category=43&controller=category - as you can see, customers have to scroll down quite a bit to see our products. If the subs were in a grid instead of a list (so they took up less space) it'd be okay but as it is my client just doesn't like it.

Share this post


Link to post
Share on other sites
We recently wanted to display all the subcategory products on the category page. In our search we found this forum and having found a solution for ourselves wanted to share it with the community. If you are using a recent version of Prestashop that has prestashop/override/controllers/front/CategoryController.php then your code changes will go there. If you are using an older version of Prestashop that does not have an overrides folder then your changes will go in prestashop/controllers/front/CategoryController.php (edits here could have issues with upgrades, always use prestashop/override/ when possible) For this example we will assume you are editing the override at prestashop/override/controllers/front/CategoryController.php Currently, the function assignSubcategories in prestashop/controllers/front/CategoryController.php looks like this:
 protected function assignSubcategories() { if ($subCategories = $this->category->getSubCategories($this->context->language->id)) { $this->context->smarty->assign(array( 'subcategories' => $subCategories, 'subcategories_nb_total' => count($subCategories), 'subcategories_nb_half' => ceil(count($subCategories) / 2) )); } } 

We will be adding the following code to this function (but in our override file):

 $subcategory_objects=array(); self::$smarty->assign("andr_lang",(int)(self::$cookie->id_lang)); foreach ($subCategories as $subcategory) { $sub=new Category(($subcategory['id_category']),(int)(self::$cookie->id_lang)); $subcategory_objects[$subcategory[id_category]]=$sub; } self::$smarty->assign("subcategories_objects",$subcategory_objects); 

Step 1 Open prestashop/override/controllers/front/CategoryController.php in a text editor and add copy our combined code there:

 category->getSubCategories($this->context->language->id)) { $this->context->smarty->assign(array( 'subcategories' => $subCategories, 'subcategories_nb_total' => count($subCategories), 'subcategories_nb_half' => ceil(count($subCategories) / 2) )); $subcategory_objects=array(); self::$smarty->assign("andr_lang",(int)(self::$cookie->id_lang)); foreach ($subCategories as $subcategory) { $sub=new Category(($subcategory['id_category']),(int)(self::$cookie->id_lang)); $subcategory_objects[$subcategory[id_category]]=$sub; } self::$smarty->assign("subcategories_objects",$subcategory_objects); } } } 

Step 2 Open prestashop/themes/YOUR_THEME/category.tpl Right below

 {if $subcategory.description}
{$subcategory.description}
{/if} 

You'll want to add

 {assign var="subcategory_id" value=$subcategory.id_category} {assign var="subcategory_object" value=$subcategories_objects.$subcategory_id} {include file="$tpl_dir./product-list-sub.tpl" products=$subcategory_object->getProducts($andr_lang,'1','100')} 

Step 3 Notice here that we are calling a file that doesn't exist yet 'product-list-sub.tpl'. To save some time you can use one of Prestashop's current files and edit it to fit your needs. Make a copy of prestashop/themes/YOUR_THEME/product-list.tpl and rename the copy to product-list-sub.tpl Save all your changes and refresh your category page. You should now see the subcategories' products listed out below each subcategory title. Depending on your theme you may need to make adjustments for the display or change what product information you want to display. To do this you can now edit prestashop/themes/YOUR_THEME/product-list-sub.tpl. Hope this helps!

 

Thank you

Share this post


Link to post
Share on other sites

Hi, any tips on how to get products to display above the subcategory list on the categories page? Here's the page I'm looking at: http://www.learningg...roller=category - as you can see, customers have to scroll down quite a bit to see our products. If the subs were in a grid instead of a list (so they took up less space) it'd be okay but as it is my client just doesn't like it.

 

Hi redalice734

 

You can totally remove the sub category from the listing by doing the following.

 

In your theme, in the category.css find

#subcategories

and add

display:none

 

Example:

#subcategories {margin-top:15px; display:none;}

Edited by Microame (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

We recently wanted to display all the subcategory products on the category page. In our search we found this forum and having found a solution for ourselves wanted to share it with the community.

 

If you are using a recent version of Prestashop that has prestashop/override/controllers/front/CategoryController.php then your code changes will go there.

If you are using an older version of Prestashop that does not have an overrides folder then your changes will go in prestashop/controllers/front/CategoryController.php (edits here could have issues with upgrades, always use prestashop/override/ when possible)

 

For this example we will assume you are editing the override at prestashop/override/controllers/front/CategoryController.php

 

Currently, the function assignSubcategories in prestashop/controllers/front/CategoryController.php looks like this:

protected function assignSubcategories()
{
 if ($subCategories = $this->category->getSubCategories($this->context->language->id))
 {
  $this->context->smarty->assign(array(
'subcategories' => $subCategories,
'subcategories_nb_total' => count($subCategories),
'subcategories_nb_half' => ceil(count($subCategories) / 2)
  ));
 }
}

 

We will be adding the following code to this function (but in our override file):

$subcategory_objects=array();
		self::$smarty->assign("andr_lang",(int)(self::$cookie->id_lang));
		foreach ($subCategories as $subcategory)
		{
			$sub=new Category(($subcategory['id_category']),(int)(self::$cookie->id_lang));
			$subcategory_objects[$subcategory[id_category]]=$sub;
		}
		self::$smarty->assign("subcategories_objects",$subcategory_objects);

 

Step 1

Open prestashop/override/controllers/front/CategoryController.php in a text editor and add copy our combined code there:

<?php
class CategoryController extends CategoryControllerCore
{
/**
 * Assign sub categories templates vars
 */
protected function assignSubcategories()
{
 if ($subCategories = $this->category->getSubCategories($this->context->language->id))
 {
  $this->context->smarty->assign(array(
'subcategories' => $subCategories,
'subcategories_nb_total' => count($subCategories),
'subcategories_nb_half' => ceil(count($subCategories) / 2)
  ));
  $subcategory_objects=array();
		self::$smarty->assign("andr_lang",(int)(self::$cookie->id_lang));
		foreach ($subCategories as $subcategory)
		{
			$sub=new Category(($subcategory['id_category']),(int)(self::$cookie->id_lang));
			$subcategory_objects[$subcategory[id_category]]=$sub;
		}
		self::$smarty->assign("subcategories_objects",$subcategory_objects);
 }
}
}

 

 

Step 2

 

Open prestashop/themes/YOUR_THEME/category.tpl

Right below

{if $subcategory.description}
   <p class="cat_desc">{$subcategory.description}</p>
  {/if}

 

You'll want to add

<!-- displays the subcategory products -->
  {assign var="subcategory_id" value=$subcategory.id_category}
  {assign var="subcategory_object" value=$subcategories_objects.$subcategory_id}
				 {include file="$tpl_dir./product-list-sub.tpl" products=$subcategory_object->getProducts($andr_lang,'1','100')}

 

Step 3

Notice here that we are calling a file that doesn't exist yet 'product-list-sub.tpl'. To save some time you can use one of Prestashop's current files and edit it to fit your needs. Make a copy of prestashop/themes/YOUR_THEME/product-list.tpl and rename the copy to product-list-sub.tpl

 

Save all your changes and refresh your category page. You should now see the subcategories' products listed out below each subcategory title. Depending on your theme you may need to make adjustments for the display or change what product information you want to display. To do this you can now edit prestashop/themes/YOUR_THEME/product-list-sub.tpl.

 

Hope this helps!

 

By default, I have no /override/controllers/front/CategoryController.php in my installation. How should I deal with this?

Share this post


Link to post
Share on other sites

You can claasify them according their barcodes, and I also found you mentioned EAN13 in your code.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More