User Setting Field in order confirmation email

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
mfreeze
Commodore (COMO)
Commodore (COMO)
Posts: 421
Joined: Mon Jan 24, 2005 2:07 pm
Location: Washington, NJ
Contact:

User Setting Field in order confirmation email

Post by mfreeze » Mon Jan 25, 2010 5:22 pm

I have successfully added a customernumber field to the UserSettings table and enabled display and update in the admin. Now I need to include this field in the Order Confirmation Email. Below is the code I used to add the field at registration.

Code: Select all

  	
                               UserSetting userSetting = new UserSetting();
                        	userSetting.FieldName = "colormidnumber";
                        	userSetting.FieldValue = colormidnumber.Text;
                        	newUser.Settings.Add(userSetting);
                        	newUser.Save();
 


How to I access this field in the Order Confirmation email and display it?
Mary E Freeze

Freeze Frame Graphics
Web Hosting and Design, ASP and CFMX Development

http://www.ffgraphics.com

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: User Setting Field in order confirmation email

Post by mazhar » Tue Jan 26, 2010 8:33 am

You have to do something like this

Code: Select all

#set($colormidnumber = $customer.Settings.GetValueByKey("colormidnumber"))
ColorMindNumber:- $colormidnumber

User avatar
mfreeze
Commodore (COMO)
Commodore (COMO)
Posts: 421
Joined: Mon Jan 24, 2005 2:07 pm
Location: Washington, NJ
Contact:

Re: User Setting Field in order confirmation email

Post by mfreeze » Tue Jan 26, 2010 11:03 am

I put that in and it didn't work. All I get is ColorMinNumber:- $scolormidnumber
Mary E Freeze

Freeze Frame Graphics
Web Hosting and Design, ASP and CFMX Development

http://www.ffgraphics.com

pezza
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 50
Joined: Sun Oct 11, 2009 6:24 am

Re: User Setting Field in order confirmation email

Post by pezza » Tue Jan 26, 2010 11:59 am

Hi,

Is the s meant to be before the colormidnumber, or is that just a typo? Maybe if typo in your code, that might be why it is not getting the correct value

Andrew

User avatar
mfreeze
Commodore (COMO)
Commodore (COMO)
Posts: 421
Joined: Mon Jan 24, 2005 2:07 pm
Location: Washington, NJ
Contact:

Re: User Setting Field in order confirmation email

Post by mfreeze » Tue Jan 26, 2010 12:05 pm

The s is just a typo.
Mary E Freeze

Freeze Frame Graphics
Web Hosting and Design, ASP and CFMX Development

http://www.ffgraphics.com

pezza
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 50
Joined: Sun Oct 11, 2009 6:24 am

Re: User Setting Field in order confirmation email

Post by pezza » Tue Jan 26, 2010 12:28 pm

and is that the same with colormin and colormid, or is that meant to be different values?

Sorry, just that i used to be a proof reader in a past life :-)

User avatar
mfreeze
Commodore (COMO)
Commodore (COMO)
Posts: 421
Joined: Mon Jan 24, 2005 2:07 pm
Location: Washington, NJ
Contact:

Re: User Setting Field in order confirmation email

Post by mfreeze » Wed Jan 27, 2010 9:57 am

Here's what I have in the email template.

Code: Select all

#set($colormidnumber = $customer.Settings.GetValueByKey("colormidnumber"))
ColorMidNumber:- $colormidnumber
Here's what I get in the email, ColorMidNumber:- $colormidnumber
Mary E Freeze

Freeze Frame Graphics
Web Hosting and Design, ASP and CFMX Development

http://www.ffgraphics.com

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: User Setting Field in order confirmation email

Post by mazhar » Wed Jan 27, 2010 11:42 am

Try by removing variable declaration only using something like this

Code: Select all

$customer.Settings.GetValueByKey("colormidnumber")

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: User Setting Field in order confirmation email

Post by mazhar » Wed Jan 27, 2010 11:53 am

Anyhow I just tested the code I have posted in my first comment and it seems to work for me.

User avatar
mfreeze
Commodore (COMO)
Commodore (COMO)
Posts: 421
Joined: Mon Jan 24, 2005 2:07 pm
Location: Washington, NJ
Contact:

Re: User Setting Field in order confirmation email

Post by mfreeze » Wed Jan 27, 2010 12:03 pm

At AC 7.03?

Maybe I'm putting it in the wrong place. Can you attach the order confirmation email you tested?
Mary E Freeze

Freeze Frame Graphics
Web Hosting and Design, ASP and CFMX Development

http://www.ffgraphics.com

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: User Setting Field in order confirmation email

Post by mazhar » Wed Jan 27, 2010 12:33 pm

Code should work for 7.0.3 as well.

User avatar
mfreeze
Commodore (COMO)
Commodore (COMO)
Posts: 421
Joined: Mon Jan 24, 2005 2:07 pm
Location: Washington, NJ
Contact:

Re: User Setting Field in order confirmation email

Post by mfreeze » Wed Jan 27, 2010 1:36 pm

Thanks.

Before your reply, I got it to work using

Code: Select all

<tr>
#set ($colormidnumber = $order.User.Settings.GetValueByKey("colormidnumber"))
<td class="Email"><div align="right"><strong>Colormid #:</strong></div></td>
<td class="Email">${colormidnumber}</td>
</tr>
Mary E Freeze

Freeze Frame Graphics
Web Hosting and Design, ASP and CFMX Development

http://www.ffgraphics.com

Post Reply