| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Extra Fields 4.1.x products_t.tpl | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Extra Fields 4.1.x products_t.tpl
I sacrificed 25 points for the soloution as I couldn't get there myself. Thanks to the Xcart Team
By default, the extra field values are not assignd to the Smarty template engine on the products page (they are shown only on the product details page). In order to achieve such a functionality, the following modification to the 'products.php' file is required: insert the next code Code:
just before the following line: $smarty->assign("products",$products); Then extra fields will be assigned to the '/skin1/customer/main/products_t.tpl' Smarty template and you'll be able to operate with the values. For example, you may show all extra fields for the product if you insert the following code (into the '/skin1/customer/main/products_t.tpl' template) {foreach from=$products[product].extra_fields item="ef"} {if $ef.value ne ''} <br>{$ef.field}: {$ef.value} {/if} {/foreach} before the next one: {if $active_modules.Feature_Comparison ne '' && $products[product].fclassid > 0} If you need to display only certain extra field which has the 'minPrice' service name, then you are supposed to use the next code: {foreach from=$products[product].extra_fields item="ef"} {if $ef.value ne '' && $ef.service_name eq 'minPrice'} <br>{$ef.field}: {$ef.value} {/if} {/foreach} Hope that helps
__________________
Xcart 4.4.? Xcart Next Litecommerce with Drupal http://www.corbywebworx.com Custom Mods, Hosting and Support for Xcart-Next and LiteCommerce |
|||||||
|
#2
|
|||||||
|
|||||||
Re: Extra Fields 4.1.x products_t.tpl
Funny...there must be 500 posts asking for this functionality in 4.1 and it looks like it still isn't there by default
__________________
Padraic Ryan Ryan Design Studio Professional E-Commerce Development |
|||||||
#3
|
|||||||
|
|||||||
Re: Extra Fields 4.1.x products_t.tpl
nn... it doesnt work...why??
I'm now using 4.1.3 |
|||||||
#4
|
|||||||
|
|||||||
Re: Extra Fields 4.1.x products_t.tpl
I added the code
Code:
into '/skin1/customer/main/products.tpl' instead of products_t.tpl and it works. Thank you!
__________________
X-Cart Gold v4.1.3 |
|||||||
#5
|
|||||||
|
|||||||
Re: Extra Fields 4.1.x products_t.tpl
Quick Comment:
Using the above mod you can also use the following to output a specified output for values: {$products[product].extra_fields[0].value} for field titles: {$products[product].extra_fields[0].field} this is slightly different than the syntax for the product page variables -Thanks for the contribution Cpt, saved me lots of time |
|||||||
#6
|
|||||||
|
|||||||
Re: Extra Fields 4.1.x products_t.tpl
Hi
Thanks for the post, this helped me to clear out the system a bit, but there's still something that I can't get to work. Since I didn't have any service_name-column in the database (what's with that?) and I needed to check out the value regardless to the activity, I modified the lines suggested in the original post a bit and put them into my products.php: Code:
This thing works like a charm on the customer/main/products.tpl and I can simply refer to the variable I need by using $products[product].extra_fields[8].value. Anyhow, I'd need the same information on the featured products-lists, but for some reason(s) all the extra fields are not to be used in customer/main/products_t.tpl, although the original posting suggests just that. By putting the line Code:
Trying everything, I gave Code:
Did I mess up something when I modified the query-part in the products.php? Or should it be assigned also somewhere else to work in the products_t.tpl? The featured products list is used in multicolumn format.
__________________
Version 4.0.19 |
|||||||
#7
|
|||||||||
|
|||||||||
Re: Extra Fields 4.1.x products_t.tpl
remove the following from the statement
AND $sql_tbl[extra_fields].active='Y' and it will pick up all your extra fields not just the active ones (in other words the ones with the show box ticked). You can also put the same statement in your featured_products.php so that extra fields are available to them as well. UPDATE: add again the same coding into include/search.php just above $smarty->assign("products",$products); and you will have extra fields in your search results also.
__________________
Darren Kierman Carlisle Glass (http://www.carlisleglass.co.uk/) ... running X-Cart Gold 4.4.5 [unix] |
|||||||||
#8
|
|||||||||
|
|||||||||
Re: Extra Fields 4.1.x products_t.tpl
Carlisleglass, thanks, but i didn't understand.
Can you please write in advance what code should i add to the search.php or to some other files so it'll have extra fields in my search results also
__________________
X-card Gold 4.1.7 Batch Order Mod/Order Processing Detailed Order Management Mod Order Audit/Profit reports Advanced Product Search Ajax Username Checker Direct Product Enquiry Form FAQ Manager Social Bookmarking Tabs Mod v3 MagneticOne.com All-IN-ONE X-Cart Export Show Referrer Information on Order Details Page www.medsmarket.net |
|||||||||
#9
|
|||||||
|
|||||||
Re: Extra Fields 4.1.x products_t.tpl
Where does the code need to be placed if you want an extra field in one of the emails (skin1/mail/html/drop_shipper_email.tpl)?
I have the following code to put in the email template: {if $products[product].extra_fields ne ''} {foreach from=$products[product].extra_fields item=extra_field} {if $extra_field.service_name eq "Kit Contents"} {$extra_field.field}: {$extra_field.value} {/if} {/foreach} {/if} But I need to know where to place the code to assign the extra fields to the Smart template engine. I hava already added an extra field to the cart by adding the code in "include/func/func.cart.php". What is the similar for email? Thanks, Sam
__________________
spwestwood. Version 4.1.9 Version 4.4 |
|||||||
#10
|
|||||||
|
|||||||
Re: Extra Fields 4.1.x products_t.tpl
has anyone got this to work on
4.1.9 in products_t.tpl
__________________
X-cart - 4.3.2 loads of mods and custom code |
|||||||
|
|||
X-Cart forums © 2001-2020
|