Jump to content

Related Produtos Group by Category (tabs)


HMoreira
 Share

Recommended Posts

Hi,

 

I already searched on web and didn't found what i need.

 

I'm developing an PrestaShop "shop", and i need on the product detail, have tabs with the related products group by category.

Example:

 

Product 1 Detail

 

TAB Informations, TAB category 1 (with related products), TAB category 4 (with related products) etc...

 

Something like this:

 

http://www.logiscenter.com/impresoras-codigo-barras/mod-gk420

 

Best Regards,
H Moreira

 

Share this post


Link to post
Share on other sites

Hi,

 

first you have to create a system that enables you to choose related categories for one product. The cleanest way to do it is to create a module adding a tab in the product administration with related categories to select.

 

Then in you productController file, you have to request the module table (where related categories are registered) and for each category of the result you have to use the getProducts method of Category class to retrieve their products. Then you put all in an array and assign it to smarty to use in in product.tpl. In this template, you need to make a loop to create category tabs containing product.

Share this post


Link to post
Share on other sites

Hi Fred Vine Presta,

Thank you for your reply.

However, isn't possible get de categories from related products? I already made this on "pure php", but in prestashop i don't know how!

If I "know" all related products, all products have an category, correct? Why i can't use this information?

In "Pure PHP" I create an sql query that returns all related products group by category and create the tab header.

I save this categories in an array, and inside an foreach loop I made an query that returns related products for each category.

 

Thank you.

B.R.

H Moreira

Edited by hmaltronix (see edit history)

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More