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

Need to create an if statement using product IDs...

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-26-2005, 10:03 AM
 
jkirkpatrick jkirkpatrick is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 193
 

Default Need to create an if statement using product IDs...

Hello,

I'd like to add some specific information to the page footer for a few products. In order to do this I need to know what the if statement is. I already know that for categories I would use:

Code:
{if $cat eq "301"} Do something {/if}

What would it be for individual products?

Thanks,
Jennifer
__________________
Jennifer Kirkpatrick
X-Cart Pro Version 4.4.1
AND
X-Cart Gold Version 4.1.9
Reply With Quote
  #2  
Old 10-26-2005, 10:08 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

http://forum.x-cart.com/viewtopic.php?t=12234
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 10-26-2005, 01:18 PM
 
jkirkpatrick jkirkpatrick is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 193
 

Default

Great, thanks.

One more question. When I use the category identifier as I mentioned above, it only works for products who have that as the main category. However, I have lots of products that are also assigned to several other categories (for example a baby blanket may have a main category of "baby blankets" but also be included in "baby shower gifts" and "personalized baby gifts").

Is there any way to say I want to do something to ALL products in a secondary category?

Thanks,
Jennifer
__________________
Jennifer Kirkpatrick
X-Cart Pro Version 4.4.1
AND
X-Cart Gold Version 4.1.9
Reply With Quote
  #4  
Old 10-27-2005, 08:15 AM
  leed's Avatar 
leed leed is offline
 

Senior Member
  
Join Date: Nov 2002
Location: England (UK)
Posts: 128
 

Default need to create if etc ...

Hiya

Try something like this

Code:
{if $product.categoryid == 4 or $product.categoryid1 == 5 or $product.categoryid2==5 or $product.categoryid3 == 5} display something {/if}

if you're referring to the $products array - use $products[product].categoryxx

Lee [/b]
__________________
Why a mouse when it spins ......
X-Cart Gunslingers - For Hire!!
http://forum.x-cart.com/viewtopic.php?t=8615
Reply With Quote
  #5  
Old 10-27-2005, 10:18 AM
 
jkirkpatrick jkirkpatrick is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 193
 

Default

Thanks Lee but that didn't work. It still only displays the text if the product has been assigned to the main category.

Jennifer
__________________
Jennifer Kirkpatrick
X-Cart Pro Version 4.4.1
AND
X-Cart Gold Version 4.1.9
Reply With Quote
  #6  
Old 10-27-2005, 02:37 PM
  leed's Avatar 
leed leed is offline
 

Senior Member
  
Join Date: Nov 2002
Location: England (UK)
Posts: 128
 

Default if etc

Jen

Post the code that you're trying to use here and I'll take a look

Lee
__________________
Why a mouse when it spins ......
X-Cart Gunslingers - For Hire!!
http://forum.x-cart.com/viewtopic.php?t=8615
Reply With Quote
  #7  
Old 10-27-2005, 04:35 PM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

use something like

Code:
{if $smarty.get.productid eq 1 OR $smarty.get.productid eq 2 OR $smarty.get.productid eq 3 OR $smarty.get.productid eq 4 } blah blah blah {/if}
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #8  
Old 10-28-2005, 10:41 AM
 
jkirkpatrick jkirkpatrick is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 193
 

Default

How would I specify the category ID though? I need to be able to do this:

{if category1 = 345 or category2 = 345 or category3 = 345}
Do something
{/if}

But I don't know how to refer to category1, category2, category3, etc.

Thanks,
Jennifer
__________________
Jennifer Kirkpatrick
X-Cart Pro Version 4.4.1
AND
X-Cart Gold Version 4.1.9
Reply With Quote
  #9  
Old 10-28-2005, 10:50 AM
 
jkirkpatrick jkirkpatrick is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 193
 

Default

Along this same line I'm also having problems specifying ONLY a category page.

I want to change the titles for the category pages so I used:

Code:
<TITLE> {if $cat eq "248"} Baby Clothes - Baby Shoes {/if} </TITLE> But, that makes the page title for ALL products in category 248 "Baby Clothes - Baby Shoes". I only want the category page to have that title and the product pages to keep their product names as the page title. Any ideas how to fix this problem? Thanks, Jennifer
__________________
Jennifer Kirkpatrick
X-Cart Pro Version 4.4.1
AND
X-Cart Gold Version 4.1.9
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 06:23 AM.

   

 
X-Cart forums © 2001-2020