X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Extra Field to show on Email receipt only (https://forum.x-cart.com/showthread.php?t=12978)

SellPro 11-01-2005 02:03 PM

I'm trying to achieve the same effect, but I'm having some trouble. Here is the code I'm using. I know that I need the value from the second extra field for each item, but this gives me a smarty error. It's trying to use $location as a smarty tag, I just want it to be a variable. Any help?

Code:

<?
$result = mysql_query("SELECT * FROM `xcart_extra_field_values` WHERE `productid` =$product.productid and `fieldid` =2");
    while($r=mysql_fetch_array($result))
    { $location=$r["value"];
?>
<? echo $location ?>
<? } ?>


DVDirect 12-13-2005 07:05 PM

Hi Everyone,

I have added this code to my site and added the code from Shan

Quote:

if you want to add the extra fields to the html invoices you have to do it a bit different.........


Code:
{foreach from=$product.extra_fields key=field_name item=field}

{$field.field} : {$field.field_value}

{/foreach}

I have placed the above code in
/mail/html/order_data.tpl I hope this is the correct place.

Now my question is what is the code to include in a html email that calls this ectra field information. In my case it is extra field "6"

Any assistance would be greatly appreciated.

Regards,
Andrew

DVDirect 12-18-2005 09:06 PM

FYI... v4.0.15

This is what you can add to your .tpl files to call the Extra Field Data:

In /customer/main/product.tpl you have the followiing calling the Extra Field Data:

Code:

{if $active_modules.Extra_Fields ne ""}
    {include file="modules/Extra_Fields/product.tpl"}
{/if}


Included code in /modules/Extra_Fields/product.tpl

Code:

{* $Id: product.tpl,v 1.7 2004/05/28 12:21:07 max Exp $ *}
{section name=field loop=$extra_fields}
{if $extra_fields[field].active eq "Y" && $extra_fields[field].field_value}
<TR><TD width="30%">
{$extra_fields[field].field}
</TD>
<TD>
{$extra_fields[field].field_value}
</TD>
</TR>
{/if}
{/section}


This justs lists the Extra Data fields on the Product Detail Page.

So to get just the Extra Field you want use the Extra Field ROW#. In Admin you have Extra Field you can add... if the data is in the 3rd row then use '03' inplcase of [field] in the code below... you can use 01,02,03,04,05 etc for represented rows.

Extra field Title:
Code:

{$extra_fields[field].field}
=
{$extra_fields[03].field}


Extra Field Value:
Code:

{$extra_fields[field].field_value}
=
{$extra_fields[03].field_value}


The Other thing you can do is just qualify the Title to make sure that you are displaying the correct ROW incase you have changed the Title to something else.

Taken from above code in /modules/Extra_Fields/product.tpl

Extra Field Title to display only = Test Title

Code:

{section name=field loop=$extra_fields}
{if $extra_fields[field].active eq "Y" && $extra_fields[field].field_value}
{if $extra_fields[field].field eq "Test Title"}
<TR><TD width="30%">
{$extra_fields[field].field}
</TD>
<TD>
{$extra_fields[field].field_value}
</TD>
</TR>
{/if}
{/if}
{/section}


Regards,
Marko


All times are GMT -8. The time now is 10:09 PM.

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