Gift certificate name defaulting to 'Gift Certificate'

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
WylieE
Captain (CAPT)
Captain (CAPT)
Posts: 281
Joined: Tue Mar 25, 2008 8:26 am
Location: Puyallup, WA
Contact:

Gift certificate name defaulting to 'Gift Certificate'

Post by WylieE » Tue Apr 06, 2010 6:06 pm

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.
Eric Wylie
Warmoth Guitar Products, Inc.
http://www.warmoth.com

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

Re: Gift certificate name defaulting to 'Gift Certificate'

Post by mazhar » Wed Apr 07, 2010 8:29 am

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.

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);
        }
Then place some order for gift certificate purchase to test it.

michael.p.larsen
Lieutenant (LT)
Lieutenant (LT)
Posts: 70
Joined: Fri Jan 15, 2010 8:17 am

Re: Gift certificate name defaulting to 'Gift Certificate'

Post by michael.p.larsen » Wed Apr 07, 2010 11:42 am

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.

michael.p.larsen
Lieutenant (LT)
Lieutenant (LT)
Posts: 70
Joined: Fri Jan 15, 2010 8:17 am

Re: Gift certificate name defaulting to 'Gift Certificate'

Post by michael.p.larsen » Wed Apr 07, 2010 11:44 am

I think maybe you have to do a

Code: Select all

bi.Save();
After you change the name... testing now...

michael.p.larsen
Lieutenant (LT)
Lieutenant (LT)
Posts: 70
Joined: Fri Jan 15, 2010 8:17 am

Re: Gift certificate name defaulting to 'Gift Certificate'

Post by michael.p.larsen » Wed Apr 07, 2010 11:47 am

Nope, that didn't work either...


Any ideas?

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

Re: Gift certificate name defaulting to 'Gift Certificate'

Post by mazhar » Wed Apr 07, 2010 12:03 pm

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();
                    }
                }
            }
        }

Post Reply