Jump to content

change where clausole in query for "similar products"


Recommended Posts

Hi,

I download this module: https://mypresta.eu/modules/front-office-features/related-products-free.html

It adds a "similar products" strip in product pages, the items shown have the same category,

I tried to extract the zip archive to find out where the query for retrieving the matching products is composed, because I'd like to change the where clausole and match items with same value for a certain feature I used to tag products.

Can somebody give me an hint?

 

Thanks in advance,

Leo

Link to comment
Share on other sites

Hi Pierre,

 

thanks for the response.

I just made a check and the table you mention (_accessory) contains product pairs inserted explicitly in the admin area choosing the similar product for various product in catalog (there is a small section at the end of the product page in admin).

The module I'm talking about (https://mypresta.eu/modules/front-office-features/related-products-free.html) provides suggestions presenting products on the same category (you can download it and test it in a shop, you are going to see two different set of suggested products).

 

 

I don't want to filter product by tags or anything else: I defined a features called "product lines", each product has a product line and I want to have products from the same product line to be presented as similar products.

 

I could use a query to populate the table _accessory to match my goal but I should launch that query anytime I add a product, and It's not smart... :(

 

I hope you understand better my question.

 

Regards,

Leo

 

 

 

 

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

Hi Leo, yes I understand your question! You're right about the _accessory table and I agree I wouldn't be smart to run a query each time you add a product. I had a quick look at the module you mention and couldn't see any query. So I deduced it's using the native PS product association, but I may be wrong.

You may need to develop a specific module to achieve what you need. Based on what you say, I think it's rather simple. You need to follow PS guidelines to create module (search for tutorials in Google). Then you need a "hook" (search for prestashop hook in Google) to display products from the same line in the product page. You retrieve products from the database with your own query or, better, using PS native functions. It's a bit of work and research if you do that for the first time, but it does look overly complex to me.

You could also use this "related_product" module as a starting point, and modify it to fit your needs.

Good luck!
Pierre

 

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