Post by oliwin » Mon Oct 23, 2017 8:24 am

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?

New member

Posts

Joined
Tue Jan 10, 2017 2:00 am

Post by straightlight » Mon Oct 23, 2017 8:36 am

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 }}

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by oliwin » Wed Oct 25, 2017 3:49 am

Where can I find documentation about methods in OpenCart?

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

New member

Posts

Joined
Tue Jan 10, 2017 2:00 am

Post by straightlight » Wed Oct 25, 2017 4:35 am

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.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ahetaton » Fri Jan 19, 2018 10:20 pm

Thanks, it's good code.
It does not work on the main "featured products" module.

Can you help?

Newbie

Posts

Joined
Tue Aug 16, 2016 9:24 pm

Post by straightlight » Sat Jan 20, 2018 6:02 am

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'),

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ahetaton » Sat Jan 20, 2018 8:06 am

very very thanks! :) :)

Newbie

Posts

Joined
Tue Aug 16, 2016 9:24 pm

Post by m_uzunov » Tue May 29, 2018 4:23 pm

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

Newbie

Posts

Joined
Wed May 02, 2018 10:52 pm

Post by straightlight » Tue May 29, 2018 10:59 pm

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.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 78 guests