Custom Customer Fields

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
bha
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 44
Joined: Tue Mar 11, 2008 6:04 pm

Custom Customer Fields

Post by bha » Thu Mar 13, 2008 12:50 pm

I would like to display some of the custom customer fields in the shipment information of the shipping confirmation email.

The default shows variables like $orderItem.SKU, $orderItem.Name, etc... What variable would the custom fields be?

Thanks in advance!
Bruce.

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Post by sohaib » Mon Mar 17, 2008 7:36 am

You mean custom fields you defined for products?

Here is how you can access them

Code: Select all

#foreach($customField in $orderItem.Product.CustomFields )
     
     $customField.FieldName   :  $customField.FieldValue </br>
    
#end
Last edited by sohaib on Mon Mar 17, 2008 9:19 am, edited 1 time in total.

User avatar
bha
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 44
Joined: Tue Mar 11, 2008 6:04 pm

Thanks Sohai.

Post by bha » Mon Mar 17, 2008 9:09 am

The custom fields are customer fields I had defined in the Product Templates.

I made a modification to the customer notification email template to replace the $orderItem.Name with just the custom fields to see if it would work.

After entering a dummy order and putting some values in the custom fields on the order to ensure some values, the email notification just shows a blank in the description column. See script...

#foreach($orderItem in $order.Items.FilterByShipmentAndSort($shipment.OrderShipmentId))
#beforeall
<tr>
<td><strong>SKU</strong></td>
<td><strong>Description</strong></td>
<td><strong>Quantity</strong></td>
<td><strong>Price</strong></td>
</tr>
#each
#if ($orderItem.OrderItemType == "Product")
<tr>
<td>$orderItem.Sku</td>

<!-- <td>$orderItem.Name</td> -->

<td>
#foreach($customField in $orderItem.Product.CustomFields )
$customField.Name : $customField.Value </br>
#end
</td>


<td>$orderItem.Quantity</td>
<td>$orderItem.ExtendedPrice.ToString("C")</td>
</tr>
#end
#end


The Sku and Quantity fields are populated but not the custom fields. If you see the problem, please inform.

Thanks,
Bruce.

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Post by sohaib » Mon Mar 17, 2008 9:19 am

please try $customField.FieldName and $customField.FieldValue instead of $customField.Name and $customField.Value

User avatar
bha
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 44
Joined: Tue Mar 11, 2008 6:04 pm

Post by bha » Mon Mar 17, 2008 9:56 am

Same result with

<td class="Email">
#foreach($customField in $orderItem.Product.CustomFields )
$customField.FieldName : $customField.FieldValue </br>
#end
</td>

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Post by sohaib » Mon Mar 17, 2008 10:16 am

oops I am sorry. $oderItem.Product.CustomFields will return the custom fields defined not the user specified values for the custom fields.

This should work ... although I haven't tested this either.

Code: Select all

#foreach($customInput in $orderItem.Inputs)     
     $customInput.Name   :  $customInput.InputValue </br>   
#end 

User avatar
bha
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 44
Joined: Tue Mar 11, 2008 6:04 pm

Post by bha » Mon Mar 17, 2008 10:22 am

WooHoo. Spot on! That did it. Thank you!

lab_n_chemicals
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Mon Mar 10, 2008 12:18 am
Location: us
Contact:

Re: Custom Customer Fields

Post by lab_n_chemicals » Wed Jul 16, 2008 10:33 am

sohaib,

This question is not related to the topic but ...
How do I use the ac_CustomFields table?
I cannot find anyplace in admin where I can work with this table.
Lab supplies, consumables & chemicals
http://www.espchemicals.com

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Custom Customer Fields

Post by jmestep » Wed Jul 16, 2008 11:59 am

There isn't any place in the admin right now. Joe has an add-on on his site that adds them to the admin.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

lab_n_chemicals
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Mon Mar 10, 2008 12:18 am
Location: us
Contact:

Re: Custom Customer Fields

Post by lab_n_chemicals » Wed Jul 16, 2008 2:24 pm

Thanks a bunch Judy.
Lab supplies, consumables & chemicals
http://www.espchemicals.com

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Custom Customer Fields

Post by AbleMods » Wed Jul 16, 2008 9:09 pm

Thanks for the plug Judy :)

My add-on works with ac_Products custom fields though. I could probably adapt it to the ac_CustomFields, but it's not something I've explored in-depth at this point.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

Post Reply