Page 1 of 1

How to add manufacturers to category?

Posted: Mon Oct 23, 2017 8:24 am
by oliwin
I need to create category: "Water". Then to add some manufacturers to this category.

Then when I click over water category link firstly sholud displayed all manufactures inside this category, after clicking manufacture name should be reirected to page with products.

How to do this in Open Cart?

Re: How to add manufacturers to category?

Posted: Mon Oct 23, 2017 8:36 am
by straightlight
A simple way to show the manufacturer among the category, for demonstration purposes, would be under your catalog/controller/product/category.php file.

Find:

Code: Select all

'name'        => $result['name'],
add below:

Code: Select all

'manufacturer' => html_entity_decode($result['manufacturer'], ENT_QUOTES, 'UTF-8'),
In catalog/view/theme/your_theme/template/product/category.twig file,

starting from this location:

Code: Select all

<div class="row"> {% for product in products %}
until:

Code: Select all

{% endfor %} </div>
you can use:

Code: Select all

{{ product.manufacturer }}

Re: How to add manufacturers to category?

Posted: Wed Oct 25, 2017 3:49 am
by oliwin
Where can I find documentation about methods in OpenCart?

Can you demonstrate some code? How to display manufacturers firstly on the page?

Re: How to add manufacturers to category?

Posted: Wed Oct 25, 2017 4:35 am
by straightlight
In the exception of the openbay libraries, controllers and models, the structure is pretty much identical with the ways to call a specific method between controllers or loading a model, library or a theme file from either PHP or jQuery Ajax requests.

Re: How to add manufacturers to category?

Posted: Fri Jan 19, 2018 10:20 pm
by ahetaton
Thanks, it's good code.
It does not work on the main "featured products" module.

Can you help?

Re: How to add manufacturers to category?

Posted: Sat Jan 20, 2018 6:02 am
by straightlight
For products featured module, in catalog/controller/extension/module/featured.php file,

simply replace the added line:

Code: Select all

'manufacturer' => html_entity_decode($result['manufacturer'], ENT_QUOTES, 'UTF-8'),
with:

Code: Select all

'manufacturer' => html_entity_decode($product_info['manufacturer'], ENT_QUOTES, 'UTF-8'),

Re: How to add manufacturers to category?

Posted: Sat Jan 20, 2018 8:06 am
by ahetaton
very very thanks! :) :)

Re: How to add manufacturers to category?

Posted: Tue May 29, 2018 4:23 pm
by m_uzunov
Hmm it shows manufacturer name only on first page of pagination, when scroll down and load more products they have not manufacturer name on it

Re: How to add manufacturers to category?

Posted: Tue May 29, 2018 10:59 pm
by straightlight
The latest instructions above are about the featured module, not about the category page itself which is why while using the paging class, you don't notice the manufacturer info.