| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Conditional Statement | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() 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! |
|||||||
#2
|
|||||||||
|
|||||||||
![]() 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 |
|||||||||
#3
|
|||||||
|
|||||||
![]() 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... |
|||||||
#4
|
|||||||||
|
|||||||||
![]() 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 |
|||||||||
![]() |
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|