Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Extra fields outside of product.tpl

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-13-2012, 05:34 AM
  tqualizerman's Avatar 
tqualizerman tqualizerman is offline
 

X-Adept
  
Join Date: Jun 2008
Posts: 392
 

Default Extra fields outside of product.tpl

Hi,

I'm wanting to be able to use extra fields outside of product.tpl (say in a category listing) - unfortunately calling {include file="modules/Extra_Fields/product.tpl"} doesn't seem to do the trick. Can anyone give me some advice about what the other part of the trick to this would be?
__________________
- www.nerdseven.com - Gadgets & Gizmos from Out of This World
- Sound Sensitive T-Shirts That Flash to the Beat of Music (http://www.tqualizer.com)


X-Cart Version 4.1.10
Reply With Quote
  #2  
Old 03-13-2012, 05:48 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Extra fields outside of product.tpl

Lots of posts about how to do this - depends on your version. Your sig says 4.1, but you are in the 4.4 forum.

Start here:

http://forum.x-cart.com/showthread.php?t=47812
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 03-13-2012, 07:21 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Extra fields outside of product.tpl

Extra fields on product details page is a separate array, on products list page is part of the product array. So calling extra field template directly won't work. Try passing to it extra fields array

{include file="modules/Extra_Fields/product.tpl" extra_fields=$product.extra_fields}

check with the debug window the variable name is correct
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #4  
Old 03-13-2012, 07:47 AM
  tqualizerman's Avatar 
tqualizerman tqualizerman is offline
 

X-Adept
  
Join Date: Jun 2008
Posts: 392
 

Default Re: Extra fields outside of product.tpl

Thanks to both of you for your input on this.

cflsystems - do you expect that code should work on *any* page in the site? I'm trying to get this to work on the BCSE quick order module, but I'm wondering if the variable $product is something that is always available regardless of module, or if i would have to explicitly make it available? I have noticed their coding uses the variable $p instead of $product, but for some other customizations I was able to use $product (for cart functions.)

I specifically only need to reference a single extra field for my purposes, and I've also tried using {$product.extra_fields[0].field_value} and {$p.extra_fields[0].field_value} but no such luck.
__________________
- www.nerdseven.com - Gadgets & Gizmos from Out of This World
- Sound Sensitive T-Shirts That Flash to the Beat of Music (http://www.tqualizer.com)


X-Cart Version 4.1.10
Reply With Quote
  #5  
Old 03-13-2012, 08:25 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Extra fields outside of product.tpl

The code will not work on any page of the site of course but should work on products list pages. It all depends what is available on the page.

$products array is on every products list page regardless of what modules are in use. You still need to use the debug console and get the correct variable names from there.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #6  
Old 03-14-2012, 08:07 AM
  tqualizerman's Avatar 
tqualizerman tqualizerman is offline
 

X-Adept
  
Join Date: Jun 2008
Posts: 392
 

Default Re: Extra fields outside of product.tpl

Aha. Thanks for clearing that up for me.

This is all being done inside an addon module that deals with cart functions and product functions...but it could very well be that it does not include the extra fields as part of its $p array.

Can you point me in the direction, or to one of the .php files where the product array is loaded? I would like to see if I can try and force the extra fields to load.
__________________
- www.nerdseven.com - Gadgets & Gizmos from Out of This World
- Sound Sensitive T-Shirts That Flash to the Beat of Music (http://www.tqualizer.com)


X-Cart Version 4.1.10
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:26 PM.

   

 
X-Cart forums © 2001-2020