| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Displaying a single custom field on product page | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Displaying a single custom field on product page
Hi all,
Is it possible to display a single custom field (rather than the whole array) when placed on the main product page? Currently X-Cart displays all fields in one go in one area. I want to be able to display just one or two single fields (eg "On Sale" or "New Product") in a separate location to the rest of the custom fields. What would the code be to achieve this please? Thanks in advance John
__________________
Version: 4.1.9 |
|||||||
#2
|
|||||||
|
|||||||
Re: Displaying a single custom field on product page
You could use the "Extra Fields" feature of a provider.
__________________
X-Cart Pro 4.1.9 PHP5.2.5 MySQL 5.0.54 IIS/Apache/NGINX Webservers |
|||||||
#3
|
|||||||
|
|||||||
Re: Displaying a single custom field on product page
You can display a single Extra Field value in the product page using the following code (works in 4.1.9).
{if $extra_fields.5.field_value ne ""}{$extra_fields.5.field_value}{/if} The number '5' in the code specifies the index value of the Extra Field. To find this value, go to the Modify Product page in admin, view the "source" HTML of the page and scroll down to the extra fields. Look for name="efields[6]" and subtract 1 from the number displayed. The index is one less than the number of the Extra Field.
__________________
X-Cart Gold 4.1.9 Gift Registry/Special Offers Advanced mini-cart XC-SEO Mulltiple Category/Product Templates Also bought/recently viewed Feedback reviewer/viewer bundle Marketing Manager Pro bundle many more mods |
|||||||
|
#4
|
|||||||
|
|||||||
Re: Displaying a single custom field on product page
This is more what I need on my product.tpl page. I tried adding this to my product page, but it doesn't reference my specified extra field (ie. {if $extra_fields.6.field_value ne ""}{$extra_fields.6.field_value}{/if} ). I also tried this again after I disabled:
{if $active_modules.Extra_Fields ne ""} {include file="modules/Extra_Fields/product.tpl"} {/if} then all the extra fields went away. Any suggestions to call out specific extra fields so I can place them on my product.tpl page? Christine Quote:
__________________
______________ version 4.1.9 Gold |
|||||||
#5
|
|||||||
|
|||||||
Re: Displaying a single custom field on product page
I am also having this same problem - I would like it to only show the extra fields with data in it... if its a blank field then dont display it.... anyone got this to work yet ?
|
|||||||
#6
|
|||||||
|
|||||||
Re: Displaying a single custom field on product page
I find it's best to call the Extra field by it's name, not it's index. The index can change as you add/delete extra fields. Here's a sample of what I use and it works fine for me. The Name of my extra field is "No Ship AIR?" -
Code:
__________________
X-Cart Gold 4.1.9 Gift Registry/Special Offers Advanced mini-cart XC-SEO Mulltiple Category/Product Templates Also bought/recently viewed Feedback reviewer/viewer bundle Marketing Manager Pro bundle many more mods |
|||||||
|
#7
|
|||||||
|
|||||||
Re: Displaying a single custom field on product page
Awesome! I got this working for one of my extra fields by using the method you posted to call the extra field by it's name. Can you direct me to where I can find how to call out other extra fields from the same modules/Extra_Fields/product.tpl ?
This is what I used in my customer/main/product.tpl to capture the field name: {if $active_modules.Extra_Fields ne ""}{$product.extra_fields.Manual.value} {include file="modules/Extra_Fields/product.tpl"} {/if} Christine Quote:
__________________
______________ version 4.1.9 Gold |
|||||||
|
|||
X-Cart forums © 2001-2020
|