X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Display an extra field on products.tpl (https://forum.x-cart.com/showthread.php?t=42972)

abeight 10-14-2008 03:20 PM

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! :)

longhorn180 10-14-2008 04:21 PM

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}


abeight 10-14-2008 04:27 PM

Re: Display an extra field on products.tpl
 
Thank you so much! That worked perfectly. :)

longhorn180 10-14-2008 04:51 PM

Re: Display an extra field on products.tpl
 
No problem.

SamsonWebDesign 11-03-2008 11:38 PM

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??

ChristineP 01-13-2009 01:19 PM

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}



ChristineP 01-21-2009 07:06 AM

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}



ARW VISIONS 01-21-2009 09:46 AM

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}

pfarcus 01-21-2009 11:02 AM

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

ARW VISIONS 01-21-2009 11:20 AM

Re: Display an extra field on products.tpl
 
extra fierlds are already there


All times are GMT -8. The time now is 12:22 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.