Jump to content

Group the brands by categories.


PAVON

Recommended Posts

Hello, good afternoon

I would like, if possible, to group the brands by categories.

Example:

Modeling marks.

Brand A - Brand B

hardware brands

Brand C - Brand D

Craft Brands

Mark E - Mark F

We use Prestashop 1.7.8.8

Our website www.pavononline.com

Thanks and good year

 

santi

Link to comment
Share on other sites

You can get the manufacture data like manufacture name and image from the below code
 

function getManufacturers($id_category)
{
   global $cookie;

   $manufacturers = array();
   $category = new Category($id_category);
   $products = $category->getProducts(intval($cookie->id_lang), 1, 1000000);

   if ($products)
       foreach ($products as $product)
       {
           $manufacturers['object'][$product['id_manufacturer']] = new Manufacturer(intval($product['id_manufacturer']), intval($cookie->id_lang));
           $manufacturers['image'][$product['id_manufacturer']] = (!file_exists(_PS_MANU_IMG_DIR_.'/'.$product['id_manufacturer'].'-medium.jpg')) ? 
   Language::getIsoById(intval($cookie->id_lang)).'-default' :    $product['id_manufacturer'];
       }

   $subcategories = $category->getSubcategories(intval($cookie->id_lang));

   if ($subcategories)
       foreach ($subcategories as $subcategory)
           $manufacturers = array_merge($manufacturers, getManufacturers($subcategory['id_category']));

   return $manufacturers;
}



$manufacturer_fields = getManufacturers($category->id_category);
$manufacturers = $manufacturer_fields['object'];
$manufacturer_images = $manufacturer_fields['image'];

Assign the same variable to the TPL and use as per your needs.

 

  • Like 1
Link to comment
Share on other sites

Just make brands features then you can include in your  filter system

 

note your shop product list uses nav followed by filters, I highly recommend using filters only....it's important they are able to drill down to product(s) on current page and not nav way as you  do now.

 

Avoid trying to make 'brands' act like categories, brands are better defined as prod feature or cat/subcat.

  • Thanks 1
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...