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

Coding With Product's Extra Fields

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #21  
Old 03-09-2006, 07:29 PM
 
Total Hosting Total Hosting is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 52
 

Default

Not sure why, but I get nothing. I get the extra fields to pull in fine into product.tpl. What am I not seeing?
products.tpl
Code:
<TD valign="top"> <h1 style="margin: 0px; padding-bottom: 5px;"><FONT class="ProductTitle">{$products[product].product}</FONT></h1> {* Get the product ID as we loop through the products to be displayed *} {assign var="productId" value=$products[product].productid} {php} global $sql_tbl; // Get the product id from the smarty var $productid=$this->get_template_vars('productId'); // Get the rows from the extra_field_values table for this product id if($productid) { $extra_fields = func_query( "SELECT productid, fieldid, value as field_value FROM $sql_tbl[extra_field_values] WHERE productid = $productid" ); } $this->assign("extra_fields",$extra_fields); {/php} {$extra_fields[2].field_value} {$products[product].descr|truncate:500:"...":true}
products_t.tp
Code:
<TABLE border="0" width="100%" cellpadding="5" cellspacing="1"> {math equation="floor(100/x)" x=$config.Appearance.products_per_row assign="width"} {section name=product loop=$products} {assign var="discount" value=0} {* Get the product ID as we loop through the products to be displayed *} {assign var="productId" value=$products[product].productid} {php} global $sql_tbl; // Get the product id from the smarty var $productid=$this->get_template_vars('productId'); // Get the rows from the extra_field_values table for this product id if($productid) { $extra_fields = func_query( "SELECT productid, fieldid, value as field_value FROM $sql_tbl[extra_field_values] WHERE productid = $productid" ); } $this->assign("extra_fields",$extra_fields); {/php} {if %product.index% is div by $config.Appearance.products_per_row} <TR> {assign var="cell_counter" value=0} {/if} {math equation="x+1" x=$cell_counter assign="cell_counter" } <TD align="center" valign="top" width="{$width}%" class="DialogBox"> {$products[product].product} <!-- {$lng.lbl_sku}: {$products[product].productcode} --> {$extra_fields[2].field_value} {if $active_modules.Special_Offers ne "" and $products[product].have_offers} {include file="modules/Special_Offers/customer/product_offer_thumb.tpl" product=$products[product]} {else}

here is the page: http://www.empowermentgroup.com/xcart/home.php?cat=26 The products work fine.

Thanks
__________________
Regards,

Peter Stoermer
http://www.TotalHosting.com for http://www.EmpowermentGroup.com
X-cart: 4.0.17
Reply With Quote
  #22  
Old 03-10-2006, 04:47 AM
 
willirl willirl is offline
 

eXpert
  
Join Date: Mar 2004
Location: OHIO
Posts: 271
 

Default

Peter,

How many extra fields do you have? Which are you trying to show?

If you have only one extra field you should use {$extra_fields[1].field_value} to see the value.

I've double checked the two modules and the changes above are the only ones in the files.
__________________
Richard

x-cart version 4.0.17
http://roguewavemarine.com
Reply With Quote
  #23  
Old 03-10-2006, 11:08 AM
 
Total Hosting Total Hosting is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 52
 

Default

I have a total of 6 extra fields in use at the moment.

You can see them here:
http://www.empowermentgroup.com/xcart/product.php?productid=16134&cat=0&page=1&featured

So I know it's working.

I am just pulling the template to show all extra fields on my product.tpl.

Hmmm. I may have to spend some support points on this one.

Appreciate your help.
__________________
Regards,

Peter Stoermer
http://www.TotalHosting.com for http://www.EmpowermentGroup.com
X-cart: 4.0.17
Reply With Quote
  #24  
Old 05-18-2006, 10:53 AM
 
Oak1 Oak1 is offline
 

Advanced Member
  
Join Date: Mar 2006
Posts: 34
 

Default Thank you... it works

Hey Guys,

This was on my wish list and it ended up working when plenty of other posts said it would not.

Much appreciated and thanks to the X-Cart-Community.

Oak.
__________________
--
X-Cart v4.0.18, Linux
Reply With Quote
  #25  
Old 08-04-2006, 09:46 PM
 
ecommerce ecommerce is offline
 

eXpert
  
Join Date: Jul 2006
Posts: 267
 

Default

im looking to add an extra field but the size of text box, like the description field.

and also want to be able to paste html in that text box.

is that what this is for?
__________________
X-Cart 4.0.18 DBest
Reply With Quote
  #26  
Old 02-08-2007, 12:58 AM
 
Plug Plug is offline
 

Member
  
Join Date: Oct 2006
Posts: 14
 

Default Re: Coding With Product's Extra Fields

I seem have got this to partially work. I can get it to display the value of the extra field but not the title of the extra field.

I am using the following code to display this.

{$extra_fields[2].field} {$extra_fields[2].field_value}

Any help would be appreciated.
__________________
x-cart 4.0.19 Gold
www.the-plug.com
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 04:59 AM.

   

 
X-Cart forums © 2001-2020