derekjwhitten Posted May 19, 2020 Share Posted May 19, 2020 I'm trying to add some radio buttons on the product page to allow the customer to select a second product to add to their cart with the current product. The products should be from a particular category. I believe I need to do the following: Get all products in the required category Assign them to a Smarty variable Output relevant information in the template To get the products I think I should use this code based on this post: $additional_products=Product::getProducts($id_lang, $start, $limit, $order_by, $order_way, $id_category, $only_active, $context = null); I could then loop through $all_products and assign them products to a Smarty variable using something like this: $this->context->smarty->assign('additional_products', $additional_products); In Smarty I expect they will then be available using {$additional_products}. What I'm not clear on is where do I put this code to actually retrieve the products? I assume it's a custom module I need to create but how do I start that? So far I've tweaked the template files of some existing modules but I'm not able to work out how modules provide to Smarty the additional data they need. Thanks in advance for any guidance you can provide. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now