![]() |
Loop any Section
Greetings,
I am trying to figure out how to get a section to display without there having to be a value for cat. E.g. if I have this in a template (home.tpl): Code:
{section name=product loop=$products} and I go to http://mystore.com/x-cart/customer/home.php?cat=123 Its going to loop $products.productcode & $products.productid for everything in Category #123. Is there a way I can have it loop any section I want instead of the example above? Like: Code:
{section cat=142 name=product loop=$products} Code:
{section cat=156 name=product loop=$products} and it will loop categories 142, 156. Possible? |
Not within the templates you cant.
The values of the arrays that holds the products is already populated before it gets to the template. You can get it to do this in the php scripts themselves and assign each categories products to a new smarty array such as $products142 or $products 156 etc and then loop through these. Be warned though that this would be a lot of products. Another alternative is amending the products.php page or creating a copy of it so that it takes all products into the $products array, then put some logic into the section loop for the display. ie {if $products[product].categoryid eq "142"} display it {/if} If you have a lot of products this will eat your server though. :( |
Okay, I will mess around with that at work today.
Thanks! |
I am still not having any luck with this at all.
What I am trying to do is modify my products listing to display the products. And then I can specify another category to list right under it. that other category right under the main would be the Accessories for the main product. See what im trying to do? |
All times are GMT -8. The time now is 06:03 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.