Hello all,
We recently enabled online gift certificates and are encountering a minor issue.
When the certificate is automatically generated, 'Gift Certificate' is being entered under the certificate name. Shouldn't this be the purchaser's name? Our management wants to see the purchaser's name.
Is there a simple way to change this?
AC 7.0.3, build 12458.
Gift certificate name defaulting to 'Gift Certificate'
Re: Gift certificate name defaulting to 'Gift Certificate'
I guess you can try it in ConLib/OnePageCheckout.ascx.cs class's CheckingOut method. Try placing following code lines at the very end of this method just above the closing brace.
Then place some order for gift certificate purchase to test it.
Code: Select all
foreach (BasketItem bi in Token.Instance.User.Basket.Items)
{
if (bi.OrderItemType == OrderItemType.Product && bi.Product.IsGiftCertificate)
bi.Name = string.Format("{0}-{1}",bi.Name,user.PrimaryAddress.FullName);
}
-
- Lieutenant (LT)
- Posts: 70
- Joined: Fri Jan 15, 2010 8:17 am
Re: Gift certificate name defaulting to 'Gift Certificate'
I tried this and it doesn't seem to work...
I'll look into it a bit more, but it seems like the name isn't sticking.
I'll look into it a bit more, but it seems like the name isn't sticking.
-
- Lieutenant (LT)
- Posts: 70
- Joined: Fri Jan 15, 2010 8:17 am
Re: Gift certificate name defaulting to 'Gift Certificate'
I think maybe you have to do a
After you change the name... testing now...
Code: Select all
bi.Save();
-
- Lieutenant (LT)
- Posts: 70
- Joined: Fri Jan 15, 2010 8:17 am
Re: Gift certificate name defaulting to 'Gift Certificate'
Nope, that didn't work either...
Any ideas?
Any ideas?
Re: Gift certificate name defaulting to 'Gift Certificate'
I guess I misinterpreted what is required. Seems like you guys want to see it on Administration > Gift Certificates. In this I case I think that you need to put the code in CheckedOut event handler. Remove the old one and place this in CheckedOut method
Code: Select all
Order order = OrderDataSource.Load(e.OrderId);
if (order != null)
{
foreach (OrderItem orderItem in order.Items)
{
if (orderItem.OrderItemType == OrderItemType.Product && orderItem.Product.IsGiftCertificate)
{
GiftCertificateCollection giftCertificates = GiftCertificateDataSource.LoadForOrderItem(orderItem.OrderItemId);
foreach (GiftCertificate giftCertificate in giftCertificates)
{
giftCertificate.Name = order.User.PrimaryAddress.FullName;
giftCertificate.Save();
}
}
}
}