| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Extra Fields if statement | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
Extra Fields if statement
Hi guys,
I am trying to stop the display of the contact us pop up on the product page if the extra field "Sample Request" is set to "NO" Here is what I have done so far but can't get it to work. Can someone have a quick look at my code and see if I am doing something wrong. Code:
I have inserted this in product_details.tpl but its not showing the ask question part no matter what the "Sample Request" is set to. any one got any ideas?
__________________
Live Version : 4.5.2 Licensed Products: X-Cart Gold Ability Theme CDSEO xCMS Abandoned Cart Food Packaging Scotland |
|||||||||
#2
|
|||||||
|
|||||||
Re: Extra Fields if statement
Can you simplify this and do this in css?
Possibly use css, 'display:none;" for the popup ? Or if you don't want to disrupt the layout, use "visibility:hidden;" Not saying this is better - but it may get you there with minimum code. Maybe?
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4 |
|||||||
|
#3
|
|||||||||
|
|||||||||
Re: Extra Fields if statement
Thanks Mate,
I am unfortunately not great with CSS, it is something I really need to sit down and teach myself. I wouldn't have a clue how to do what you are suggesting. Any tips?
__________________
Live Version : 4.5.2 Licensed Products: X-Cart Gold Ability Theme CDSEO xCMS Abandoned Cart Food Packaging Scotland |
|||||||||
#4
|
|||||||
|
|||||||
Re: Extra Fields if statement
THIS is NOT TESTED SPECIFICALLY, but based on code that works. This should get you started.
1. verify the extra field content is available on your page (use webmaster mode) 2. define a variable, $test for the extra field, "testing". The if code makes sure there is something there, else it ignores. Code:
3. place your variable in a div with inline css. The if makes sure something is there, else it ignores. If $test is empty, nothing happens. If test has something in it, it will display the <div> - which is set to not display anything using css, style="display:none;" Code:
The logic is: "is there anything in the test field? If so, do not display the content. Hope this helps in some way. J
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4 |
|||||||
|
#5
|
|||||||||
|
|||||||||
Re: Extra Fields if statement
Thanks mate that looks like a good way of doing it. I'll give it a bash and see how I get on. thanks for your help.
Time I really spent some time learning CSS.
__________________
Live Version : 4.5.2 Licensed Products: X-Cart Gold Ability Theme CDSEO xCMS Abandoned Cart Food Packaging Scotland |
|||||||||
#6
|
|||||||||
|
|||||||||
Re: Extra Fields if statement
Quote:
J your some man that works a treat with some tweaking. Here is what I did incase it helps anyone else. Code:
__________________
Live Version : 4.5.2 Licensed Products: X-Cart Gold Ability Theme CDSEO xCMS Abandoned Cart Food Packaging Scotland |
|||||||||
#7
|
|||||||
|
|||||||
Re: Extra Fields if statement
Glad to know you were able to work it out!
PS-- the var, $test was only used as an example -- I would imagine you will change the var to $samplereq or something related to the field -- imagine troubleshooting this 3 years from now -- try to backtrace the $test var? Best, Jeremy
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4 |
|||||||
|
#8
|
|||||||||
|
|||||||||
Re: Extra Fields if statement
Quote:
Thanks for the tip Jeremy i'll change that now. smart thinking
__________________
Live Version : 4.5.2 Licensed Products: X-Cart Gold Ability Theme CDSEO xCMS Abandoned Cart Food Packaging Scotland |
|||||||||
#9
|
|||||||||
|
|||||||||
Re: Extra Fields if statement
I'm trying to do something similar, but I want it to display on the products list. I have tried products_t.tpl and products_list.tp[ in the skin directory but I am not having any luck. Would this behave differently if I were to make the changes in the "common" or "2 column" section?
__________________
Business Edition 5.2.10 Gold Plus 4.6.1 |
|||||||||
|
|||
X-Cart forums © 2001-2020
|