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)
-   -   Coding With Product's Extra Fields (https://forum.x-cart.com/showthread.php?t=9146)

Total Hosting 03-09-2006 07:29 PM

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

willirl 03-10-2006 04:47 AM

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.

Total Hosting 03-10-2006 11:08 AM

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.

Oak1 05-18-2006 10:53 AM

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.

ecommerce 08-04-2006 09:46 PM

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?

Plug 02-08-2007 12:58 AM

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.


All times are GMT -8. The time now is 02:55 AM.

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