Page 1 of 1

BUG? Confirmation Email shows Merchant Fields - ignores nVel

Posted: Mon Jun 01, 2009 8:03 pm
by ZLA
The Order Confirmation Email Template includes the following code:

Code: Select all

#foreach($orderItemInput in $orderItem.Inputs)
#if (!$orderItemInput.IsMerchantField)
<br /><b>$orderItemInput.Name:</b> $orderItemInput.InputValue 
#end
#end
It didn't seem to be working so I added the following to see IsMerchantField:

Code: Select all

#foreach($orderItemInput in $orderItem.Inputs)
#if (!$orderItemInput.IsMerchantField)
<br /><b>$orderItemInput.Name:</b> $orderItemInput.InputValue <i>$orderItemInput.IsMerchantField</i>
#end
#end
That was the only change. When the email is produced, it shows the following in the description column:
OrderConfirmation.jpg
I've confirmed that these fields are Merchant fields (still set to their original AC values).

Two questions:
1) Why are the merchant fields being displayed when the nVelocity code says not to?
2) Why didn't <i>$orderItemInput.IsMerchantField</i> display an italic one or zero?

Thanks in Advance. -- ZLA

Re: BUG? Confirmation Email shows Merchant Fields - ignores nVel

Posted: Tue Jun 02, 2009 9:32 am
by mazhar
Confirmed, just logged the issue. You can track progress here
http://bugs.ablecommerce.com/show_bug.cgi?id=8123

Its because we haven't any property IsMerchantField defied at OrderItemInput class. You may try to workaround by using product information available with order item. Here is some code to float the idea

Code: Select all

#foreach($ptf in $orderItem.Product.TemplateFields)
#if(!$ptf.InputField.IsMerchantField && $ptf.InputField.Name == $orderItemInput.Name)
<br /><b>$orderItemInput.Name:</b> $orderItemInput.InputValue
#end
#end

Re: BUG? Confirmation Email shows Merchant Fields - ignores nVel

Posted: Tue Jun 02, 2009 9:35 am
by nickc
IsMerchantField is not a member of the OrderItemInput class. You'd have to dig it out of OrderItem.Product.TemplateFields[n].InputField somehow - looks like a Name comparison might be the only way. Challenging to do in the nVelocity world. I turned off Able's order confirmation triggers and inserted my own methods into OnePageCheckout to give me more flexibilty with confirmation and vendor emails. I still use the nVelocity engine and Able mail templates, but now can add my own classes to the hashtable that nVelocity uses to process text.

Re: BUG? Confirmation Email shows Merchant Fields - ignores nVel

Posted: Tue Jun 02, 2009 11:19 am
by ZLA
Thanks for the confirmation Mazhar. Any chance AC will republish the default email templates for a final workaround? In my case, normal merchant fields are okay but not the ones I use for required fields and for regular expression validation. So I'll probably just compare directly against $orderItemInput.Name for "Regex*" and "RequiredFieldsList".

Would your code still display customer fields? I know the table ac_ProductTemplateFields only contains merchant fields but the object could include all. I would think you would still want to loop through orderItem.Inputs and then use a second loop to find the matching product template field and then see if it was a merchant field or not. I'm not strong yet at nVelocity so I can't show any code yet.

By the way, examining the Product.TemplateFields collection may not be a good idea from a data consistency viewpoint. For example, the Order Confirmation should display the information at the time of the order, even if re-generated manually. orderItem.Inputs meets that requirements. But the Product.TemplateFields could change after an order is placed and could produce an inaccurate order confirmation email. It's unlikely but the correct solution would be to have the IsMerchantField value added to ac_OrderItemInputs and make it visible in the objectdatasource. Should I report that as a feature request or do you think it will be included as part of the bug fix?

-- ZLA

Re: BUG? Confirmation Email shows Merchant Fields - ignores nVel

Posted: Tue Jun 02, 2009 11:29 am
by ZLA
FYI, this bug affects the following default templates:
  • Customer Order Notification
  • Gift Certificate Validated
  • Order Shipped Partial
  • Order Shipped
  • ESD file is activated
  • License key is fulfilled

Re: BUG? Confirmation Email shows Merchant Fields - ignores nVel

Posted: Tue Jun 02, 2009 12:25 pm
by Logan Rhodehamel
ZLA wrote:Should I report that as a feature request or do you think it will be included as part of the bug fix?
Whatever information we record will be static as part of the order. The class OrderItemInput should have a property IsMerchantField. A bug report was entered on this a long time ago and somehow got overlooked.