| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Create custom IF function | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Create custom IF function
We created a custom product property field (string) that displays on the product page. What I want to do it have an image display ONLY IF the value of the custom property field ($MyField) equals a specific string "Test".
I can have an image display on the product page if I use <img IF="{product.getMyField())" /> but this displays it as long as the field is not empty.
__________________
X-cart v 5.2 |
|||||||
#2
|
|||||||
|
|||||||
Re: Create custom IF function
have you tried wrapping the image tag in an if statement?
{if:product.getMyField() == 'test'} <img> {end:}
__________________
SEEK HAPPINESS. EVERYTHING ELSE IS DETAILS. |
|||||||
#3
|
|||||||||
|
|||||||||
Re: Create custom IF function
Try the following:
1. Create a custom module 2. Decorate the \XLite\View\Product\Details\Customer\Image class 3. Add isVisible() method that checks for the field as follows: Code:
Will this work?
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions Last edited by qualiteam : 05-04-2015 at 05:00 AM. |
|||||||||
|
|||
X-Cart forums © 2001-2020
|