Jump to content

Display products from 2 categories on one page


Recommended Posts

Hi,

 

I'm trying to show the products from 2 categories on one category page. I've created a blank category and assigned a custom category template with an override CategoryController.php.

 

Can anyone show me an example of a function to get the products from two categories?

Link to comment
Share on other sites

Yes I could use that category but I like the flexibility of which products can be added to each independent new arrivals category. Surely someone can point me in the right direction to create a function to pull products from both categories?

Link to comment
Share on other sites

$this->category2 = new Category(10, $this->context->language->id);

$this->cat_products2 = $this->category2->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay);
$this->cat_products = array_merge($this->cat_products, $this->cat_products2);

 

voila ;)

Link to comment
Share on other sites

Hi Guys

 

I was trying to the the same, however unlike you two I'm a little lost when it comes to the php smarty stuff.

 

If you have time I wonder if either of you could explain the way you achived it and the code used, as I wouldnt mind learning how you made it work.

 

Thanks In Advance

 

@Pete,  Questlove, qaulity drummer, roots qaulity band :-)

Link to comment
Share on other sites

Hi Guys

 

I was trying to the the same, however unlike you two I'm a little lost when it comes to the php smarty stuff.

 

If you have time I wonder if either of you could explain the way you achived it and the code used, as I wouldnt mind learning how you made it work.

 

Thanks In Advance

 

@Pete,  Questlove, qaulity drummer, roots qaulity band :-)

 

 

where exactly you want to change it? for what part of website?

Link to comment
Share on other sites

Hi Vekia

 

Thanks for taking the time to repley.

 

Like Pete, i would like to have 2 catagories display on one page as I also need the flexability to select want product show in those categories

 

For example I have an on sale catagory , on that page I want to show to fashion labels that are on sale but not all mixed up, I would like to have them like below

 

 

Sale

---label 1

    ---- all the items here

---label 2

    ---- all the items here

 

I see the code you have written and looked at the CategoryController but I don't understand how you implemented it.

 

Chris

Edited by Chris2013 (see edit history)
Link to comment
Share on other sites

  • 1 month later...
  • 3 years later...

Hey guys, 

 

I have the following problem: I have Cat1 and Cat2. When somebody enters in Cat1, I want to list:

Cat1

     - products from Cat1

Cat2

     - products from Cat2

 

Similar when they enter Cat2, to have a label Cat2 and the products from Cat2, and label Cat1 and products from Cat1.

 

I tried the code that Vekia said, but I didn't understand where to assign Cat2 to Cat1 and Cat1 to Cat2

 

Can you please help me?

 

Thanks, Madalin

Link to comment
Share on other sites

×
×
  • Create New...