X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Conditional Statement (https://forum.x-cart.com/showthread.php?t=3417)

Hawkie Moore 07-01-2003 03:05 PM

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!

kpayne 07-01-2003 05:11 PM

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

Hawkie Moore 07-02-2003 07:19 AM

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...

kpayne 07-02-2003 07:23 AM

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


All times are GMT -8. The time now is 05:59 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.