Jump to content

Module - Extra filter, left menu


Recommended Posts

Hello,


 


Im trying to made a module like manufacturers-block but with a dropdown whit more filters like this:


 


Example: 


 


  • DELL
    • DELL ENTERPRISE
      • SERVERS
        • TIPO RACK
        • TIPO TOWER


    • DELL NETWORKING

 


  • SAMSUNG... 

 


I need code example or query examples to do it, any help will be apreciated.


 


Image example:


 


 


123Captura.JPG


Link to comment
Share on other sites

Since it's not possible in PrestaShop to link categories to manufacturers, I think the easiest solution would be to create a category structure that includes the manufacturer names as the first level of categories and then add subcategories below them.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

you mean some like this:

select    p.id_product, p.id_manufacturer, id_category_default, l.name PName, c.name CName , m.name MName
from      hlg_product p
               inner join hlg_product_lang l on p.id_product = l.id_product
               inner join  hlg_category_lang c on p.id_category_default = c.id_category 
               inner join hlg_manufacturer m on p.id_manufacturer = m.id_manufacturer  

or this:

select    distinct p.id_manufacturer, id_category_default, m.name MName, c.name CName 
from      hlg_product p
               inner join  hlg_category_lang c on p.id_category_default = c.id_category 
               inner join hlg_manufacturer m on p.id_manufacturer = m.id_manufacturer 
order by m.name, c.name 
Link to comment
Share on other sites

but now how to show it in tpl, and how to execute in the php class?

public function hookLeftColumn($params)
	{
			$sql = 'select    distinct p.id_manufacturer, id_category_default, m.name MName, c.name CName 
from      hlg_product p
               inner join  hlg_category_lang c on p.id_category_default = c.id_category 
               inner join hlg_manufacturer m on p.id_manufacturer = m.id_manufacturer 
order by m.name, c.name ';
			if ($results = Db::getInstance()->ExecuteS($sql))
			foreach ($results as $row)
			echo $row['id_shop'].' :: '.$row['name'].'<br />';
	}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...