Zen Cart Logo
Forums / All Other Contributions/Addons / autofill gift certificate value support thread

autofill gift certificate value support thread

Views: 1,061

Results 1 to 8 of 8
8 Jul 2022, 11:02 PM
#1
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,967
Plugin Contributions:
8

autofill gift certificate value support thread

once approved, one can download from here:

https://www.zen-cart.com/downloads.php?do=file&id=2354

only has 2 files. one file if not using OPC. no ZC core files modified.

takes any value up to the max of the order value and automatically fills that amount into the gift certificate input field (input[name=cot_gv]).

enjoy.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

9 Jul 2022, 12:31 AM
#2
lolwaut avatar

lolwaut

Zen Follower

Join Date:
Dec 2010
Posts:
142
Plugin Contributions:
0

Re: autofill gift certificate value support thread

Amazing! Can't wait! THANK YOU @carlwhat!

9 Jul 2022, 11:39 AM
#3
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,718
Plugin Contributions:
56

Re: autofill gift certificate value support thread

A couple of things:

a) Please resubmit without MIT license.

b) This doesn't work in my environment with OPC or standard checkout:

  • At a minimum, you need to wrap the script that sets the value in
    jQuery(document).ready(function(){

  • At load time (in this environment), the total value is not what is shown on the screen (shipping tax has not yet been added and there are local taxes).
    This is only an issue if the total is less than the GC amount.

  • You may need to use

    $orderTotalPlugin = round($order->info['total'], 2);

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

9 Jul 2022, 1:32 PM
#4
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,967
Plugin Contributions:
8

Re: autofill gift certificate value support thread

swguy:

  • At load time (in this environment), the total value is not what is shown on the screen (shipping tax has not yet been added and there are local taxes).
    This is only an issue if the total is less than the GC amount.
    i would prefer to not have pre-release debugging in the forum, but if that's what you want...

checkout payment, should be done after shipping and local taxes. payments are always done last in any sane shopping cart. why would one pay prior to knowing a total.

in my testing using test data it works fine. i can not comment on your environment with regards to this issue.

your other 2 points are duly noted and incorporated into new submission.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

9 Jul 2022, 2:37 PM
#5
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,718
Plugin Contributions:
56

Re: autofill gift certificate value support thread

Set your GC balance to be greater than the order total, and use an OT module that increases the order total further, and you'll see the issue.
Also, comments still say Code is licensed under the MIT license.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

10 Jul 2022, 1:26 PM
#7
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,718
Plugin Contributions:
56

Re: autofill gift certificate value support thread

Approved and link in first post updated.

checkout payment, should be done after shipping and local taxes. payments are always done last in any sane shopping cart. why would one pay prior to knowing a total.

The JS you put your code in loads before the page builds the order completely. So this won't work if there are order total modules that modify the bottom line.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

10 Jul 2022, 3:17 PM
#8
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,967
Plugin Contributions:
8

Re: autofill gift certificate value support thread

swguy:

Approved and link in first post updated.

checkout payment, should be done after shipping and local taxes. payments are always done last in any sane shopping cart. why would one pay prior to knowing a total.

The JS you put your code in loads before the page builds the order completely. So this won't work if there are order total modules that modify the bottom line.

the problem that you are, in theory, presenting is inherent in the structure of zen-cart. and has been something that i have discussed previously on github.

the idea that there is an order_total module called ot_total that just takes what is in the $order->info['total'] is, to me, one of the many problems inherent in the structure of zen-cart. i am not a fan of this structure, but understand how legacy code works.

the latest update that i have submitted fixes an issue with OPC, and will be the last update i issue under real store owners decide to use it and report problems.

best.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.