| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
IF statement for custom fields | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
IF statement for custom fields
I would like to make a image visable when an extra fires is set to 'Yes' in the product.tpl
My current code look like: {if $bestsellers.extra_fields[0]value eq "Yes"} <img src="lifetimelabour.jpg"/> {/if} But fails to work. Can someone please point me in the correct direction.
__________________
X-Cart 4.4 |
|||||||
#2
|
|||||||||
|
|||||||||
Re: IF statement for custom fields
There is no such thing as $bestsellers.extra_fields unless you have some customization done. It will be either $product.extra_fields ot $extra_fields
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#3
|
|||||||
|
|||||||
Re: IF statement for custom fields
Quote:
Many thanks, I am trying to query a the result of a custom field "SERVICE_NAME01" to then output the image "lifetimelabour.jpg" I have basic experience in C++ and Java but not this and am not able to find any api information relating to the reference location of the variables. Can you please advise me where I need to reference or where I can find the information needed. I have experance in C++ and Java but not this and am not able to fine any api information relating to the referance location of the verables. can you please advise me where I need to referance or where I can find the information needed.
__________________
X-Cart 4.4 |
|||||||
#4
|
|||||||||
|
|||||||||
Re: IF statement for custom fields
Turn the debuging console on from admin/general settings - it will show you all variables on a page and their structure. Also if you are on 4.4.0 consider upgrading either to 4.4.2 or 4.4.3 (in about a week) - 4.4.0 is extremely buggy
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#5
|
|||||||
|
|||||||
Re: IF statement for custom fields
Quote:
Thanks again but I'm still having difficulty this one. My debugging console has the following under {$bestsellers} Array (5) 0 => Array (22) productid => "17651" provider => "1" product => "Beko DVTC60W Vented Dryer" productcode => "DVTC60W" avail => "0" price => "184.95" fclassid => null is_clist => "" variantid => "0" weight => "0.00" is_product_options => "Y" is_variant => "" taxid => "1" taxed_price => "184.95" extra_fields => Array (5) 0 => Array (7) fieldid => "1" provider => "1" field => "Life Time Labour Free Available?" value => "Yes" active => "Y" orderby => "1" service_name => "SERVICE_NAME01" That I would take to mean bestsellers.extra_fields(1)(4) or extra_fields(1)(4) for the yes/no variable. Can you please let me know the error of my ways. Thanks again
__________________
X-Cart 4.4 |
|||||||
#6
|
|||||||||
|
|||||||||
Re: IF statement for custom fields
{if $bestsellers.extra_fields[0].value eq "Yes"}
<img src="lifetimelabour.jpg"/> {/if} It may work with your original code but you were missing a dot(.)
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#7
|
|||||||
|
|||||||
Re: IF statement for custom fields
Quote:
Perfect. Code I used in the end was {if $extra_fields[0].field_value eq "Yes"} <img src="lifetimelabour.jpg"/> {/if} but that's because I made the mistake of thinking value was the field value. I couldn't have managed this without your help. Many thanks.
__________________
X-Cart 4.4 |
|||||||
|
|||
X-Cart forums © 2001-2020
|