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

Conditional Statement

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-01-2003, 03:05 PM
 
Hawkie Moore Hawkie Moore is offline
 

Newbie
  
Join Date: Jun 2003
Location: St. Louis, MO
Posts: 7
 

Default Conditional Statement

I'm attempting to add a conditional statement to the customer/main/product.tpl template (just above the "Product Options" segment). As a test, I've entered the following code to see if I could get the correct response to print:

{if $products.productcode eq "XXXX"}
This Test Worked
{else}
Test did NOT work!
{/if}

I must not be accessing the xcart database correctly, because the false statement is always returned (unless I change "eq" to "ne", then the true statement is always returned). Products have been added with different product codes so that you should be able to see each condition returned.
Any help would be greatly appreciated!
Reply With Quote
  #2  
Old 07-01-2003, 05:11 PM
  kpayne's Avatar 
kpayne kpayne is offline
 

X-Adept
  
Join Date: Dec 2002
Location: Firetanksoftware.com
Posts: 469
 

Default

Try "$product.productcode"

If it's on "product.tpl" then it's one product and the information is stored in the "$product" array not "$products". I'm guessing you got "$products" off of another template?

Anyway, I hope this helps.

--Kurt
Reply With Quote
  #3  
Old 07-02-2003, 07:19 AM
 
Hawkie Moore Hawkie Moore is offline
 

Newbie
  
Join Date: Jun 2003
Location: St. Louis, MO
Posts: 7
 

Default Conditional Statement

Thanks for the Help!

I'm just digging into this for the first time and made the wrong assumption: that "$products.productcode" accessed (database) "products" and (field) "productcode". I'm moving our store from a FileMaker Pro/Lasso solution, so I 'm sure I've got steep learning curve ahead...
Reply With Quote
  #4  
Old 07-02-2003, 07:23 AM
  kpayne's Avatar 
kpayne kpayne is offline
 

X-Adept
  
Join Date: Dec 2002
Location: Firetanksoftware.com
Posts: 469
 

Default

No problem.

The way smarty works is that the PHP code assigns variables to the template. There is no direct connection between the template and the database. In this case, xcart assigned all of the product information into a huge array called "$product".

If you just keep working backwards, you can usually trace most anything in this program.

--Kurt
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 02:16 AM.

   

 
X-Cart forums © 2001-2020