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)
-   -   If statement for specific option class? (https://forum.x-cart.com/showthread.php?t=45774)

balinor 02-24-2009 06:26 AM

Re: If statement for specific option class?
 
Thanks Victor, but it isn't for me. What version is it working for you on? This is a 4.1.10 cart.

geckoday 02-24-2009 06:49 AM

Re: If statement for specific option class?
 
Quote:

Originally Posted by Victor D
http://www.phpbuilder.com/manual/en/language.references.pass.php
also I should mention that this is working for me ;)

That page discusses pass by reference for function calls by using the & in the function definition. The correct page reference is http://us3.php.net/foreach which does discuss the *PHP 5 only* reference within the foreach construct. This will not work in PHP 4.

geckoday 02-24-2009 06:54 AM

Re: If statement for specific option class?
 
Its possible you might need to use $v.classtext instead of $v.class in the smarty. classtext is what is displayed on the page. If that doesn't work add {$products|print_r} to the top of your products.tpl and take a look at the [class] and [classtext] values for the products to see whats up.

balinor 02-24-2009 07:01 AM

Re: If statement for specific option class?
 
Yep both class and classtext are 'size'. Now some of these products have both a size and flavor class - will this work when a product has both? Meaning I want it to display if size class is present by itself or in combo with another class.

geckoday 02-24-2009 07:39 AM

Re: If statement for specific option class?
 
It scans all options for the product and if it finds one with the name size it adds the text. So it works like you want it to. Tested and working fine for me.

Did you add it to the right .tpl? Sometimes I dig around in products.tpl for a while before I notice things don't look right and remember my site uses products_t.tpl.

Other than that I can only suggest some basic troubleshooting. Replace the whole smarty {foreach} stuff that was added with some plain text to be sure its in the right spot. If that's OK replace it with {$products[product].product_options|print_r} to see if you've got the [class] variable there. If that shows the proper [class] stuff, scratch head and post back.

balinor 02-24-2009 07:51 AM

Re: If statement for specific option class?
 
Yep, did that, spit out the correct variable. So I backed up and started from scratch. This time I got rid of the |lower and it is now working. Thanks for the help guys, really appreciate it!

Victor D 02-24-2009 08:03 AM

Re: If statement for specific option class?
 
I have really stuck with 4.1.10 till found that products_t.tpl is used for 1-column format (in admin there was 1 for number of columns to display products). :D

For 4.1.11 it is working perfect.


All times are GMT -8. The time now is 11:57 AM.

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