This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi, For my website that displays products that belong to categories, when someone gets into a product, i want to display similar products which mean the products have to belong to the same category as the product viewed. I thought that the best approach would be sending the category to a scope, and that this has to be in the code section but i couldn't figure out how to do it. Can anyone help me or send me links that could help !
Thanks !
I don't understand 'sending the category to a scope, but perhaps my PHP experience is lacking here.
The way I would do it with October is to put a reference to the product somewhere in the URI and then read that in the detail page. You can then lookup the product category in the page PHP section, look for other products in that category and retrieve information about those products to be listed and display them on the page.
Hope this makes any sense
Parsec, Thank you for your reply. Using a reference from the url in the php code section of the page is what i was thinking about. Now i couldn't figure out how to call from the code section a function that's within the product model. A function that will ofcourse return a list of products from the DB. Found some docs about it but couldn't get it to work. Can you please give me an example of use ?
1-3 of 3