| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Extra field value in products list | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Extra field value in products list
Hi, is there a change to add specific Extra Field value to show in products list? For example under {$product.descr}? Thanks for advance!
__________________
4.1.11 |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Extra field value in products list
First you need to enable the extra field as a product search option in the admin. General Settings > Product Search - set the field as active.
Then you should have the field assigned and you can use: {$product.extra_fields[0].field_value} Or better you could loop through the extra fields array with a foreach statement if you have multiple fields.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
|
#3
|
|||||||
|
|||||||
Re: Extra field value in products list
I was trying to achieve this as well, and was sucessful with the approach of looping through the extra fields array. See the thread http://forum.x-cart.com/showthread.php?t=63314 where I wanted to show extra field data on the invoice (to help us in pulling products to fill the order. The same looping approach worked on the product list pages.
Totaltec...if your suggestion of {$product.extra_fields[0].field_value} works (I assume the [0] is replaced by the index for the extra field value you want to display) then it seems it would be more efficient than looping through ALL the extra fields for each product being displayed while browsing a catagory or when viewing search results. What do you think?
__________________
David Coggan Carolyn Nussbaum Music Company X-Cart v4.5.4 Gold + LiteCommerce v2.2.41 (previous 6 years) |
|||||||
#4
|
|||||||
|
|||||||
Re: Extra field value in products list
oh yea, please note that I had been sucessful on a develoment instance of 4.4.5.
__________________
David Coggan Carolyn Nussbaum Music Company X-Cart v4.5.4 Gold + LiteCommerce v2.2.41 (previous 6 years) |
|||||||
#5
|
|||||||||
|
|||||||||
Re: Extra field value in products list
Looping through a list does not take much processor power, so I think that either method is fine if it consistently produces the result that you want.
Referencing the value directly is more efficient, but less flexible. If you use a loop, you can check to make sure you have the right value from the loop before executing your code. Either way is going to be fine.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
|
#6
|
|||||||
|
|||||||
Re: Extra field value in products list
I'm using xcart 4.0.16 - and I also want to display extra fields on the products list page as well but this doesn't seem to work.
On the products list page, debug console lists the $extra_fields array like this: {$extra_fields} Array (2) 0 => Array (5) fieldid => 1 provider => me field => Bundle001 value => empty active => Y 1 => Array (5) fieldid => 2 provider => me field => Bundle002 value => empty active => Y However on the product page debug console lists $extra_fields array like this: {$extra_fields} Array (2) 0 => Array (7) fieldid => 1 provider => me field => Bundle001 value => empty active => Y field_value => 2 is_value => Y 1 => Array (7) fieldid => 2 provider => me field => Bundle002 value => empty active => Y field_value => 7 is_value => Y (The extra fields are displayed correctly on the product page, but not on the products list page) As you can see, the products list page is missing the field_value, and is_value items. Please can anybody help?
__________________
X-Cart Gold v4.6.5 |
|||||||
#7
|
|||||||||
|
|||||||||
Re: Extra field value in products list
hamid,
The problem is probably larger than this. On the product page the variable $extra_fields can be assumed to be specific to that product. On the list it has many products to loop through. The $extra_fields variable is of no use to you. You will need to alter the MySQL query for the products list to also include the extra field values for each product. Then when looping through the products you can access the individual values for each product. Unfortunately I do not have access to such an old version of XC. To get you started, first determine the name of the array that has the products assigned to it. Then search through the files to find where this variable is assigned. Then look at the query that pulls the info from the database. Add your changes for including the extra field values in the array.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
#8
|
|||||||
|
|||||||
Re: Extra field value in products list
Thanks for your reply Totaltec.
Yes, I assumed it was something more complicated. I thought it might be the extra_fields.php file itself that is the issue, but it's probably not. When I'm on the products list page, I can see from the debug console an array called $products, which contains all the product information, but not the extra fields. Is there any way to put the extra fields into $products?
__________________
X-Cart Gold v4.6.5 |
|||||||
#9
|
|||||||||
|
|||||||||
Re: Extra field value in products list
Quote:
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
#10
|
|||||||
|
|||||||
Re: Extra field value in products list
Thanks again for your reply Totaltec.
Ah yes, php/mysql - unfortunately I'm not so skilled with this, and I don't really have enough time to delve into it - so I doubt I'll be able to make this happen
__________________
X-Cart Gold v4.6.5 |
|||||||
|
|||
X-Cart forums © 2001-2020
|