Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Loop any Section

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-28-2003, 10:14 AM
  anoack's Avatar 
anoack anoack is offline
 

Senior Member
  
Join Date: Dec 2002
Location: Austin, TX
Posts: 113
 

Default 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} {$products[product].productcode} {$products[product].productid} {/section}

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} {$products[product].productcode} {$products[product].productid} {/section}

Code:
{section cat=156 name=product loop=$products} {$products[product].productcode} {$products[product].productid} {/section}

and it will loop categories 142, 156.

Possible?
Reply With Quote
  #2  
Old 07-30-2003, 11:14 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

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.
__________________
ex x-cart guru
Reply With Quote
  #3  
Old 07-31-2003, 03:01 AM
  anoack's Avatar 
anoack anoack is offline
 

Senior Member
  
Join Date: Dec 2002
Location: Austin, TX
Posts: 113
 

Default

Okay, I will mess around with that at work today.

Thanks!
Reply With Quote
  #4  
Old 08-06-2003, 01:44 PM
  anoack's Avatar 
anoack anoack is offline
 

Senior Member
  
Join Date: Dec 2002
Location: Austin, TX
Posts: 113
 

Default

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?
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 09:28 AM.

   

 
X-Cart forums © 2001-2020