Zen Cart Logo
Forums / Bug Reports / [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

[Done 1.3.9] "Invalid Gift Certificate Redemption Code"

Locked

Views: 7,700

Results 1 to 20 of 25
This thread is locked. New replies are disabled.
11 Nov 2008, 8:01 PM
#1
zcnb avatar

zcnb

Zen Follower

Join Date:
Jun 2008
Posts:
338
Plugin Contributions:
0

[Done 1.3.9] "Invalid Gift Certificate Redemption Code"

One of my test customers reports that she tries applying a gift certificate during checkout but it fails with the error message:

Invalid Gift Certificate Redemption Code
I checked the customer table and can see that she has the correct GV balance ($4.28).

However, while the tabular GV Balance shows the correct value, the one in the right pane shows $0.00... :blink:

I am attaching a snapshot here - she is the only one who tried redeeming a gift certificate so far.

How do I begin troubleshooting this problem?

11 Nov 2008, 8:17 PM
#2
zcnb avatar

zcnb

Zen Follower

Join Date:
Jun 2008
Posts:
338
Plugin Contributions:
0

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

I would like to add that when trying to redeem gift certificates that I sent to a test account that I created, I don't encounter any problem.

I am attaching a snapshot of the database table coupon_gv_customer. The customer ID in question is 18. Do you notice anything that could explain this problem?

13 Nov 2008, 3:48 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

This is a bug ... there isn't an Order yet and the SELECT statement is written in such a way that because there isn't an Order, the value is coming up as 0.00 ...

I am moving this to the Bug Reports ... thanks!

13 Nov 2008, 4:17 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

Add this function to the:
/admin/includes/functions/general.php

    function zen_user_has_gv_balance($c_id) {
      global $db;
        $gv_result = $db->Execute("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . (int)$c_id . "'");
        if ($gv_result->RecordCount() > 0) {
          if ($gv_result->fields['amount'] > 0) {
            return $gv_result->fields['amount'];
          }
        }
        return 0;
    }

The edit the file:
/admin/customers.php

And change:

        $contents[] = array('text' => '<br />' . TEXT_INFO_GV_AMOUNT . ' ' . $currencies->format($customers_orders->fields['amount']));

to read:

        $customer_gv_balance = zen_user_has_gv_balance($cInfo->customers_id);
        $contents[] = array('text' => '<br />' . TEXT_INFO_GV_AMOUNT . ' ' . $currencies->format($customer_gv_balance));
17 Nov 2008, 3:26 PM
#5
zcnb avatar

zcnb

Zen Follower

Join Date:
Jun 2008
Posts:
338
Plugin Contributions:
0

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

Ajeh, thank you for your bugfix and I am glad that I was able to contribute something to "perfecting" Zen Cart. :smile:

My question now relates to the fact that the bugfix is in the admin code only:

I understand that it fixes the display on the Admin's right panel for Gift Certificate balance (when no order exists yet for a customer).

Does that also solve the problem I described as seen by the customer?

18 Nov 2008, 1:52 AM
#6
zcnb avatar

zcnb

Zen Follower

Join Date:
Jun 2008
Posts:
338
Plugin Contributions:
0

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

zcnb:

Does that also solve the problem I described as seen by the customer?
OK - I did some more elaborate testing after applying the fix and there seems to still be a problem from the customer's point of view:

  • If the customer clicks the GC redemption link, then everything is fine (at checkout, she can elect to apply any amount in her GC balance).
  • On the other hand, if the customer starts checkout before redeeming the GC (and has a GC balance of $0.00), then the "Apply Amount" edit box is missing in step 2 (of 3), and the customer is taken directly to PayPal...
    Some of my test customers were really confused by this.

Any suggestion how to workaround this (except for asking the customers in the GC email to always use the link)?

18 Nov 2008, 2:02 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

If your customer actually enters the GV redemption code during checkout, the funds will be added to their account. They can then fill in the amount they wish to redeem before they complete checkout.
But they certainly have to redeem the code before the funds are available to them.

18 Nov 2008, 2:13 AM
#8
zcnb avatar

zcnb

Zen Follower

Join Date:
Jun 2008
Posts:
338
Plugin Contributions:
0

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

DrByte:

If your customer actually enters the GV redemption code during checkout, the funds will be added to their account. They can then fill in the amount they wish to redeem before they complete checkout.
But they certainly have to redeem the code before the funds are available to them.
I just tried this procedure again and it seems that describing the problem off my memory was inaccurate: During checkout, the customer is actually given the edit box to enter the GC redemption code and the funds are actually added to their account. However, the customer is not given the edit box to fill in the amount he wishes to redeem before he completes checkout. If, after being directed to PayPal, the customer choses to leave PayPal and return to the store, then the edit box to fill in the amount to apply appears...

If the customer redeems the GC before checkout, however, then what you just described actually happens: the customer is given the edit box to fill in the amount he wishes to redeem before he completes checkout.

Notice this subtle difference in behavior - I just tried it with a test setup that has the latest fix by Ajeh.

Can you reproduce this problem?

18 Nov 2008, 3:00 AM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

I don't see any technical problem that needs reproducing. It's working as the code is written to work.

The customer cannot use the GV funds until they've redeemed the code.

  1. Customer can redeem the code before they start checkout, by using the link in the email, or the redemption option in the GV-FAQ page, etc. Then they can easily redeem available funds during checkout.

  2. Customer can enter the code and choose payment method, and then on the order-confirmation screen click Edit to go back and apply a GV amount.

  3. If the customer enters the GV code in the box and presses Enter or clicks Continue without choosing a payment method, they'll immediately be able to use the funds, because they will be redeemed when they're returned to the same page to select the payment method.

18 Nov 2008, 11:14 AM
#10
zcnb avatar

zcnb

Zen Follower

Join Date:
Jun 2008
Posts:
338
Plugin Contributions:
0

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

DrByte:

The customer cannot use the GV funds until they've redeemed the code.Indeed, that is the way I expect it to be - and it works as advertised.

DrByte:

  1. Customer can redeem the code before they start checkout, by using the link in the email, or the redemption option in the GV-FAQ page, etc. Then they can easily redeem available funds during checkout.Works great (and without the customer being confused).

DrByte:

  1. Customer can enter the code and choose payment method, and then on the order-confirmation screen click Edit to go back and apply a GV amount.OK, although IMHO it would be better to present the 'Apply Amount' box without having to go back.

DrByte:

  1. If the customer enters the GV code in the box and presses Enter or clicks Continue without choosing a payment method, they'll immediately be able to use the funds, because they will be redeemed when they're returned to the same page to select the payment method.Aha! This is where I see the problem: in my shop, there currently is only one payment method (PayPal). Therefore, the customer is never returned back to be given the option to immediately use the funds. A picture is worth a thousand words, so I am attaching a snapshot of this special case.

Do you see where this can be confusing to the customer? :lamo:

18 Nov 2008, 1:20 PM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

Sure.

So, now that you know the options available as-is, you can decide what you intend to do from here, whether to write custom code to change things, or to come up with other ways of getting your customers to do their redemption earlier, or draw their attention to it on the checkout-confirmation page. You have several options from which to choose. Some are easier than others. Most are free. If you decide to hire someone to write custom code, well, that's not free.

19 Nov 2008, 5:33 AM
#12
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

I understand zcnb problem.> Aha! This is where I see the problem: in my shop, there currently is only one payment method (PayPal). Therefore, the customer is never returned back to be given the option to immediately use the funds.I also only have one payment method (PayPal). Thus, the customer never returns to the same page to select the payment method as would be the case if multiple payment method were available.

The only solution I can offer is a rather crude one that I use on Step 3 of 3 - Order Confirmation on the bottom of the page.

Final Step

GIFT CERTIFICATES: If you are paying with a gift certificate, please check your total to make sure it is applied before submitting your order. Return to the payment page if necessary. Your order is not complete until you click "Confirm" to complete your purchase. ** - continue to confirm your order. Thank you!**I agree that it would be nice to have zcnb suggestion implemented in the new ZC. Or as DrByte suggests someone could write some code to do the trick. Otherwise the only thing I can offer is my crude procedure.

Sawhorse

2 Dec 2008, 2:40 AM
#13
zcnb avatar

zcnb

Zen Follower

Join Date:
Jun 2008
Posts:
338
Plugin Contributions:
0

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

Sawhorse:

I also only have one payment method (PayPal). Thus, the customer never returns to the same page to select the payment method as would be the case if multiple payment method were available.
Actually, I was mistaken (once again): This problem is independent of the number of payment methods available.

The "Apply Amount" box does not appear consistently: it will show up for a customer who has a balance of $0.00 in the GC account, but only if that customer has redeemed a GC in the past.

A customer, who is checking out for the first time, will not have the The "Apply Amount" box, despite having the same exact conditions...

Sawhorse:

The only solution I can offer is a rather crude one that I use on Step 3 of 3 - Order Confirmation on the bottom of the page.
Sawhorse, this is a great workaround - thank you! I have implemented it not in checkout_confirmation.php, but rather in tpl_checkout_confirmation_default.php, by inserting the following in line 181 (just before the <div class="buttonRow forward"> line):

<br /><font color=#0000FF><strong>
GIFT CERTIFICATES</strong></font>: If you intended to pay with a gift certificate, please check your total to make sure it is applied before submitting your order. Return to the payment page if necessary. <br /><br />Your order is not complete until you click "Confirm" to complete your purchase.

HTH,
Daniel

2 Dec 2008, 5:04 AM
#14
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

zcnb thank you for your investigation. I did not know that> The "Apply Amount" box does not appear consistently: it will show up for a customer who has a balance of $0.00 in the GC account, but only if that customer has redeemed a GC in the past.

A customer, who is checking out for the first time, will not have the The "Apply Amount" box, despite having the same exact conditions...I thought that I just missed it on one or more of my tests.

I will look at your implementations in tpl_checkout_confirmation_default.php rather then in checkout_confirmation.php.

I just noticed that we now have in the thread header **[Done 1.4.0] which I believe tells us that the bug has been corrected in the next version. Thank you DrByte.
**

2 Dec 2008, 2:33 PM
#15
zcnb avatar

zcnb

Zen Follower

Join Date:
Jun 2008
Posts:
338
Plugin Contributions:
0

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

Sawhorse:

I will look at your implementations in tpl_checkout_confirmation_default.php rather then in checkout_confirmation.php.
I initially implemented this in checkout_confirmation.php but it looked ugly :smile: as the Confirm button was no longer aligned (vertically) with the single "continue to confirm your order" line.

So, I moved the text to tpl_checkout_confirmation_default.php, although software engineering-wise it is better to change definitions/parameters, not touch the core code.

Sawhorse:

I just noticed that we now have in the thread header **[Done 1.4.0] **which I believe tells us that the bug has been corrected in the next version.
AFAIK, it has been corrected only from the Admin side, not the customer side.

3 Dec 2008, 2:46 AM
#16
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

zcnb:

... I moved the text to tpl_checkout_confirmation_default.php, although software engineering-wise it is better to change definitions/parameters, not touch the core code

I think I will leave mine just were it is - I just don't like touching tpl_checkout_confirmation_default.php

And as far as the** [Done 1.4.0] **I have no idea what DrByte has done. Maybe more than what we expect. Let's hope.

3 Dec 2008, 3:40 AM
#17
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

The bugfix posted by Ajeh is what has been incorporated into v1.4.0

3 Dec 2008, 4:33 PM
#18
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

DrByte,
If zcnb is now correct in his analysis of the current customer problem after the admin fix that has been provided earlier.

zcnb:

...This problem is independent of the number of payment methods available.

The "Apply Amount" box does not appear consistently: it will show up for a customer who has a balance of $0.00 in the GC account, but only if that customer has redeemed a GC in the past.

A customer, who is checking out for the first time, will not have the The "Apply Amount" box, despite having the same exact conditions... It sounds like there is a simple (to someone other than myself) switch (logic) problem. If my assumption is correct, would it not be an enhancement that could be looked into? IF not, I do see DrByte's position.

Sawhorse

3 Dec 2008, 9:32 PM
#19
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

If a customer has never redeemed a GC, then there are no funds in their GC balance to "apply". THAT is why there is no "Apply Amount" box ... because it would be pointless.
It is not a bug. It's by design.

4 Dec 2008, 12:54 AM
#20
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: [Done 1.3.9] "Invalid Gift Certificate Redemption Code"

It is a funny thing when both people are correct. It is often not obvious to each person, but sometimes a third party can shed a bit of light. Hopefully, with a bit of success.

In my recent test. If a customer uses the email he/she receives with the gift certificate and uses the link provided the customer will be provided and amount box to place the amount the customer wants to use of the gift certificate. I believe that by using the email link the GV has been redeemed (before any purchase) and thus activates the amount box.

However, if a brand new customer (has no history at the site and does not use an email link) has been given a GV (say as a paper gift certificate) she may have a problem. If this new customer gets to **S****tep 2 of 3 - Payment Information **she is only provided with a redemption box and not an amount box. If this new customer keys in the gift certificate key it will be redeemed. And you get notification of the redemption. However, and here is I believe the key point - ALL OF THE GV IS REDEEMED if it is less than the purchace price if the item being purchased. The new customer does not have a choice to redeem only a portion of her GV. That is what I believe is the issue that zcnb is really talking about.

If say this same new customer, once seeing that all of the GV had been used, and does not like this and deletes the purchase, logs out and then logs back in. Guess what! the redemption & amount boxes are now present in **S****tep 2 of 3 - Payment Information.

I believe that ****zcnb would like both boxes (redemption & amount) always present in Step 2 of 3 - Payment Information. **Thus, no redemption trigger will be necessary to show the amount box.

On the face of it, I see no practical problem with the request. But, please let me know if I am missing something. I often do miss things.

Sawhorse