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

Display an extra field on products.tpl

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-14-2008, 03:20 PM
  abeight's Avatar 
abeight abeight is offline
 

X-Adept
  
Join Date: Nov 2003
Location: Cleveland, OH
Posts: 479
 

Default Display an extra field on products.tpl

Does anyone know if it's possible to display an extra field on the product listing page (products.tpl)? I'm using this code on the product detail page, but it doesn't work on the listing page.

{if $extra_fields.0.field_value ne ""}{$extra_fields.0.field_value}{/if}

V 4.1.11

TIA!
__________________
~ Andrea Beight
Reply With Quote
  #2  
Old 10-14-2008, 04:21 PM
 
longhorn180 longhorn180 is offline
 

Senior Member
  
Join Date: Apr 2004
Location: Richmond, Virginia
Posts: 187
 

Default Re: Display an extra field on products.tpl

Here is the code to show an extra field on products.tpl in 4.1.xx. You just have to put the name of the extra field that you want to display in place of nameofextrafield.
Code:
{if $products[product].extra_fields ne ''} {foreach from=$products[product].extra_fields item=extra_field} {if $extra_field.service_name eq "nameofextrafield"} {if $extra_field.value ne ""} {$extra_field.value} {/if} {/if} {/foreach} {/if}
__________________
4.1.9 (Linux) Live Store
www.thecrackedbook.com
Find used books and out of print books.
Reply With Quote
  #3  
Old 10-14-2008, 04:27 PM
  abeight's Avatar 
abeight abeight is offline
 

X-Adept
  
Join Date: Nov 2003
Location: Cleveland, OH
Posts: 479
 

Default Re: Display an extra field on products.tpl

Thank you so much! That worked perfectly.
__________________
~ Andrea Beight
Reply With Quote
  #4  
Old 10-14-2008, 04:51 PM
 
longhorn180 longhorn180 is offline
 

Senior Member
  
Join Date: Apr 2004
Location: Richmond, Virginia
Posts: 187
 

Default Re: Display an extra field on products.tpl

No problem.
__________________
4.1.9 (Linux) Live Store
www.thecrackedbook.com
Find used books and out of print books.
Reply With Quote
  #5  
Old 11-03-2008, 11:38 PM
  SamsonWebDesign's Avatar 
SamsonWebDesign SamsonWebDesign is offline
 

Senior Member
  
Join Date: Oct 2008
Location: East Sussex, UK
Posts: 101
 

Default Re: Display an extra field on products.tpl

Quote:
Originally Posted by longhorn180
Here is the code to show an extra field on products.tpl in 4.1.xx. You just have to put the name of the extra field that you want to display in place of nameofextrafield.
Code:
{if $products[product].extra_fields ne ''} {foreach from=$products[product].extra_fields item=extra_field} {if $extra_field.service_name eq "nameofextrafield"} {if $extra_field.value ne ""} {$extra_field.value} {/if} {/if} {/foreach} {/if}

Hi,

I am having difficulty getting an extra field to show on the product.tpl page not the products.tpl.

I have created an extra field called CONTENTS which will display the contents of a book if there are any in the field.
I've tried this code but it doesn't work.

Any ideas??
__________________
Versions 4.1.11 to 4.6.4 ... when will the new versions end!

Custom X-Cart driven e-commerce sites, skins and installations at www.samsonwebdesign.co.uk
Reply With Quote
  #6  
Old 01-13-2009, 01:19 PM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default Re: Display an extra field on products.tpl

Thank you! I got this working on my product.tpl page as:

{if $product[product].extra_fields ne ''}
{foreach from=$product[product].extra_fields item=extra_field}
{if $extra_field.service_name eq "service_name goes here"}
{if $extra_field.value eq "20"}
{$extra_field.value}
{/if}
{/if}
{/foreach}
{/if}

{if $product[product].extra_fields ne ''}
{foreach from=$product[product].extra_fields item=extra_field}
{if $extra_field.service_name eq "service _name goes here"}
{if $extra_field.value eq "30"}
{$extra_field.value}
{/if}
{/if}
{/foreach}
{/if}


I've been trying to get this into 2 column (side by side) and I want to add a button to each extra field. Can someone point me in the right direction to achieve this?


Quote:
Originally Posted by longhorn180
Here is the code to show an extra field on products.tpl in 4.1.xx. You just have to put the name of the extra field that you want to display in place of nameofextrafield.
Code:
{if $products[product].extra_fields ne ''} {foreach from=$products[product].extra_fields item=extra_field} {if $extra_field.service_name eq "nameofextrafield"} {if $extra_field.value ne ""} {$extra_field.value} {/if} {/if} {/foreach} {/if}
__________________
______________
version 4.1.9 Gold
Reply With Quote
  #7  
Old 01-21-2009, 07:06 AM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default Re: Display an extra field on products.tpl

Longhorn180,

I have my extra fields showing on my products.tpl, though I want to add a custom button for a download to a specific extra field. How would I go about doing this?

Christine


Quote:
Originally Posted by longhorn180
Here is the code to show an extra field on products.tpl in 4.1.xx. You just have to put the name of the extra field that you want to display in place of nameofextrafield.
Code:
{if $products[product].extra_fields ne ''} {foreach from=$products[product].extra_fields item=extra_field} {if $extra_field.service_name eq "nameofextrafield"} {if $extra_field.value ne ""} {$extra_field.value} {/if} {/if} {/foreach} {/if}
__________________
______________
version 4.1.9 Gold
Reply With Quote
  #8  
Old 01-21-2009, 09:46 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Display an extra field on products.tpl

try this..

{if $products[product].extra_fields ne ''}
{foreach from=$products[product].extra_fields item=extra_field}
{if $extra_field.service_name eq "nameofextrafield"}
{if $extra_field.value ne ""}
{$extra_field.value}
{/if}
{/if}
{/foreach}
{/if}
{if $extra_field.service_name eq "nameofextrafield"}button code here{/if}
__________________
xcart 5.1.2
Reply With Quote
  #9  
Old 01-21-2009, 11:02 AM
 
pfarcus pfarcus is offline
 

Senior Member
  
Join Date: Jan 2009
Posts: 179
 

Default Re: Display an extra field on products.tpl

Is this to put an extra field the add product portion of the admin back end? If not, anyone know how that would be done?

Thx advance
__________________
CDSEO PRO
4.1.11 PRO
Dynamic images by xcartmod.com
X-Cart CSSTemplate/Skin for v4.1.11 PRO
Reply With Quote
  #10  
Old 01-21-2009, 11:20 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Display an extra field on products.tpl

extra fierlds are already there
__________________
xcart 5.1.2
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 07:37 AM.

   

 
X-Cart forums © 2001-2020