How To Get Products In A Category (Smarty)

Hi,



I am trying to modify the compact_list.tpl so that it displays the products in separate tables each under their main category heading, instead of all listed in one table. So I loop through the categories and I want to get all products under that category to generate the compact list table for that category. I can’t figure out how to do this with smarty! How do I set a variable catproducts that is an array (just like the products array that is already set in that template) with only the products for that category?? It seems like there should be a function call I can make and pass the category ID and it returns the array of products in that category?





{assign var=“catproducts” value=“???”}

{foreach from=$catproducts item=“product” key=“key” name="catproducts}



…print the table of products for that category…



{/foreach}



I apologize for my newbie-ness…



Colleen

Hi Colleen,

You wish to create something like [url=“A-Z Product Catalog”]http://www.hungryweb.net/demo/index.php?dispatch=categories.azproducts[/url] but with categories?





Valentin

[color=#808080][size=2]part of hungryweb.net[/size][/color]

[quote name='colleende' timestamp='1396456254' post='180782']

Hi,



I am trying to modify the compact_list.tpl so that it displays the products in separate tables each under their main category heading, instead of all listed in one table. So I loop through the categories and I want to get all products under that category to generate the compact list table for that category. I can't figure out how to do this with smarty! How do I set a variable catproducts that is an array (just like the products array that is already set in that template) with only the products for that category?? It seems like there should be a function call I can make and pass the category ID and it returns the array of products in that category?

[/quote]



Hi Colleen,



It is required to create a new function to get products by category ID. If you are interested in it, please contact us at http://ecom-labs.com