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

Extra Fields 4.1.x products_t.tpl

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #21  
Old 02-24-2009, 06:35 AM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default Re: Extra Fields 4.1.x products_t.tpl

Hi toltion,

How does this work for multiple extra fields on the product.tpl page?


Quote:
Originally Posted by toltion
Hi Christine,

You need to LOOP through the Extra fields and display the one using an {if} statement -

Code:
{section name=field loop=$extra_fields} {if $extra_fields[6].value ne ""} {$extra_fields[6].value} {/if} {/section}
__________________
______________
version 4.1.9 Gold
Reply With Quote
  #22  
Old 02-24-2009, 07:06 AM
 
toltion toltion is offline
 

Advanced Member
  
Join Date: Jun 2007
Posts: 39
 

Default Re: Extra Fields 4.1.x products_t.tpl

The code allows you to selectively display any extra field. I sometimes like to display the extra fields in different locations on the template, so I run the code at the top of the page and assign variables to the values. In this code I chose to identify the extra_fields by their Service Name instead of index position in the loop -
Code:
{section name=field loop=$extra_fields} {if $extra_fields[field].service_name eq "NO_SHIP_AIR"} {if $extra_fields[field].field_value ne ""}{assign var="no_ship_air" value="Y"}{/if} {/if} {if $extra_fields[field].service_name eq "CLEARANCE_PRICE"} {if $extra_fields[field].field_value ne ""}{assign var="clearance_price" value="Y"}{/if} {/if} {/section}

Then I can display the variables "no_ship_air" & "clearance_price" anywhere on the page using {if $no_ship_air ne ""}{$no_ship_air}{/if}.
__________________
X-Cart Gold 4.1.9
Gift Registry/Special Offers
Advanced mini-cart
XC-SEO
Mulltiple Category/Product Templates
Also bought/recently viewed
Feedback reviewer/viewer bundle
Marketing Manager Pro bundle
many more mods
Reply With Quote
  #23  
Old 02-24-2009, 08:54 AM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default Re: Extra Fields 4.1.x products_t.tpl

With your suggested code, I believe I have the "loop through" working in /modules/Extra_Fields/product.tpl, though I haven't been able to place each of my extra fields separately in customer/main/product.tpl.

This is what I have for my product.tpl
{if $active_modules.Extra_Fields ne ""}
{include file="modules/Extra_Fields/product.tpl"}

When I tried adding just one field name, there was no change
{if $active_modules.Extra_Fields ne ""}{$product.extra_fields.11.value}
{include file="modules/Extra_Fields/product.tpl"}

Can you see what I'm missing to call out individual extra fields where I need in my customer/main/product.tpl?

Christine

Quote:
Originally Posted by toltion
The code allows you to selectively display any extra field. I sometimes like to display the extra fields in different locations on the template, so I run the code at the top of the page and assign variables to the values. In this code I chose to identify the extra_fields by their Service Name instead of index position in the loop -
Code:
{section name=field loop=$extra_fields} {if $extra_fields[field].service_name eq "NO_SHIP_AIR"} {if $extra_fields[field].field_value ne ""}{assign var="no_ship_air" value="Y"}{/if} {/if} {if $extra_fields[field].service_name eq "CLEARANCE_PRICE"} {if $extra_fields[field].field_value ne ""}{assign var="clearance_price" value="Y"}{/if} {/if} {/section}

Then I can display the variables "no_ship_air" & "clearance_price" anywhere on the page using {if $no_ship_air ne ""}{$no_ship_air}{/if}.
__________________
______________
version 4.1.9 Gold
Reply With Quote
  #24  
Old 02-24-2009, 10:20 AM
 
toltion toltion is offline
 

Advanced Member
  
Join Date: Jun 2007
Posts: 39
 

Default Re: Extra Fields 4.1.x products_t.tpl

In customer/main/product.tpl, you have to replace -

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

With the code I suggested.

You are basically looping through the extra fields directly on product.tpl instead of including "modules/Extra_Fields/product.tpl".
__________________
X-Cart Gold 4.1.9
Gift Registry/Special Offers
Advanced mini-cart
XC-SEO
Mulltiple Category/Product Templates
Also bought/recently viewed
Feedback reviewer/viewer bundle
Marketing Manager Pro bundle
many more mods
Reply With Quote
  #25  
Old 02-24-2009, 11:12 AM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default Re: Extra Fields 4.1.x products_t.tpl

Awesome! I have one more piece to this that I need working. I have a custom button that I'm trying to get working for 3 of my extra fields. Here's what I've done with trying to add my custom button .tpl:

In customer/main/product.tpl I commented out
<!--{if $active_modules.Extra_Fields ne ""}
{include file="modules/Extra_Fields/product.tpl"}
{/if}-->

and added from your code suggestion
<table align="left" cellspacing="0" cellpadding="0">
{section name=field loop=$extra_fields}
<td>{if $extra_fields[field].service_name eq "products_PDF"}
{include file="buttons/pdf_button.tpl" href="javascript:window.open $extra_fields[field].field_value=products_PDF" style="button"}
{/if}</td>
<td>&nbsp;&nbsp;</td>
<td>{if $extra_fields[field].service_name eq "products_manual"}
{$extra_fields[field].field_value eq "products_manual"}
{/if}</td>
<td>&nbsp;&nbsp;</td>
<td>{if $extra_fields[field].service_name eq "product_image"}
{$extra_fields[field].field_value eq "product_image"}
{/if}</td>
{/section}
</table>

The bold is my attempt for my custom button. The image of my custom button is now showing, though it's not clickable to my product.

Do you have any suggestions?

Christine

Quote:
Originally Posted by toltion
In customer/main/product.tpl, you have to replace -

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

With the code I suggested.

You are basically looping through the extra fields directly on product.tpl instead of including "modules/Extra_Fields/product.tpl".
__________________
______________
version 4.1.9 Gold
Reply With Quote
  #26  
Old 02-24-2009, 12:49 PM
 
toltion toltion is offline
 

Advanced Member
  
Join Date: Jun 2007
Posts: 39
 

Default Re: Extra Fields 4.1.x products_t.tpl

Try this...

<table align="left" cellspacing="0" cellpadding="0">
{section name=field loop=$extra_fields}
<td>{if $extra_fields[field].service_name eq "products_PDF"}
{include file="buttons/pdf_button.tpl" href="javascript:window.open $extra_fields[field].field_value" style="button"}
{/if}</td>
<td>&nbsp;&nbsp;</td>
<td>{if $extra_fields[field].service_name eq "products_manual"}
{$extra_fields[field].field_value}
{/if}</td>
<td>&nbsp;&nbsp;</td>
<td>{if $extra_fields[field].service_name eq "product_image"}
{$extra_fields[field].field_value}
{/if}</td>
{/section}
</table>

Not too sure about your javascript window.open code. Doesn't look like that will work...
__________________
X-Cart Gold 4.1.9
Gift Registry/Special Offers
Advanced mini-cart
XC-SEO
Mulltiple Category/Product Templates
Also bought/recently viewed
Feedback reviewer/viewer bundle
Marketing Manager Pro bundle
many more mods
Reply With Quote

The following user thanks toltion for this useful post:
ChristineP (02-24-2009)
  #27  
Old 02-24-2009, 01:09 PM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default Re: Extra Fields 4.1.x products_t.tpl

Great job. Thanks for your help! I have the loop through working.

For my custom button, I will need to get mod work done.

Christine
__________________
______________
version 4.1.9 Gold
Reply With Quote
  #28  
Old 03-29-2009, 03:34 PM
 
chastie chastie is offline
 

Member
  
Join Date: May 2006
Posts: 17
 

Default Re: Extra Fields 4.1.x products_t.tpl

Thank you thank you!
__________________
4.0.18
Reply With Quote
  #29  
Old 05-30-2009, 06:50 PM
 
Hallsons Hallsons is offline
 

Advanced Member
  
Join Date: Dec 2007
Posts: 84
 

Default Re: Extra Fields 4.1.x products_t.tpl

Hi,

I can't find where to insert the code in 4.1.11 as I can't find the $smarty->assign line mentioned.

Where should I insert this to call up the extra fields?

Thanks,

Chris
__________________
Chris Wilson
4.7.10 (after 9 years with 4.1.12)
CDSEO Pro
Reply With Quote
  #30  
Old 05-30-2009, 09:08 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: Extra Fields 4.1.x products_t.tpl

Are you modifying products.php? It should be near the last lines of the file. The php code goes in the products.php file, the smarty and html changes go in the template files.
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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:15 AM.

   

 
X-Cart forums © 2001-2020