Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Trying to add a one-time per order $25 HazMat fee, what files calculates the sub-tota

Trying to add a one-time per order $25 HazMat fee, what files calculates the sub-tota

1 Feb 2013, 8:14 PM
#1
tcarden avatar

tcarden

Zen Follower

Join Date:
Oct 2012
Posts:
282
Plugin Contributions:
0

Post #1 by tcarden

I'm trying to add a One-Time Per Order $25 HazMat fee to the shopping cart sub-total. First i tried to add to $cartShowTotal in tpl_shopping_cart_default, but couldn't of course because i did a var_dump and see that it is a string. and the var name itself it hints it is for display purposes only(?).

i know that this is a heady question, but where would i find the heart of the shopping cart calculator? or, the file that performs the shopping cart sub-total as it gets put onto the tpl_shopping_cart_default page?

i did look in ...
modules/pages/shopping_cart/header_php.php

and see $cartShowTotal equals show_total().

i know i'm in over my head but i have to do this ;-)

big thanks,

1 Feb 2013, 8:23 PM
#2
drbyte avatar

drbyte

Sensei

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

Post #2 by drbyte

Why not clone an existing order-total module and rename it to HazMat Fee, and have it fire only when your custom field 'hazmat' is flipped on?

Perhaps something like the "Delivery Area Surcharge" mod http://www.zen-cart.com/downloads.php?do=file&id=52
or one of the credit-card-surcharge mods http://www.zen-cart.com/downloads.php?do=file&id=755 or http://www.zen-cart.com/downloads.php?do=file&id=552

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Feb 2013, 9:12 PM
#3
tcarden avatar

tcarden

Zen Follower

Join Date:
Oct 2012
Posts:
282
Plugin Contributions:
0

Post #3 by tcarden

okay i'll look into but the HazMat isn't as simple as stated. there are 2 varieties, a $25 and a $49. and if the order is $300 or over it gets ixneh'd. etc. etc.

then there is a pyro-agreement and shipping considerations....!

i really need a Global $HazMat var for several reasons. if i could get that to happen on the shopping cart sub-total page i'd be half-way there, knowwhatahmean?

thanks

2 Feb 2013, 2:59 AM
#4
swguy avatar

swguy

Administrator

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

Post #4 by swguy

Instead, try starting with the low order fee module in includes/modules/order_total.

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.

2 Feb 2013, 3:06 AM
#5
drbyte avatar

drbyte

Sensei

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

Post #5 by drbyte

doh! I meant to suggest that one too.

But it too doesn't show the "fee" on the shopping-cart page. That's a whole different beast than just building an OT module.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

2 Feb 2013, 3:19 AM
#6
tcarden avatar

tcarden

Zen Follower

Join Date:
Oct 2012
Posts:
282
Plugin Contributions:
0

Post #6 by tcarden

if you all think of anything else, please let me know. i'm a little stumped at the moment.

i wanted the Global Var, a $HazMatStat of either 1 of 2, so i could then show a pyro agreement,
and also, i really need to show the amount on the subtotal,

thanks a lot

2 Feb 2013, 3:40 AM
#7
drbyte avatar

drbyte

Sensei

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

Post #7 by drbyte

Are you still using attribute-based selections like you were discussing in this other thread? http://www.zen-cart.com/showthread.php?205212-My-hazmat-one-time-fee-is-not-being-factored-into-price-when-added-to-cart

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

2 Feb 2013, 5:48 AM
#8
tcarden avatar

tcarden

Zen Follower

Join Date:
Oct 2012
Posts:
282
Plugin Contributions:
0

Post #8 by tcarden

No it didn't work for the HazMat. though we're using attributes for all kinds of other things.

if you buy 2 six inch electric matches it works but if then buy a 12-inch electric match it applies the one-time charge twice. the charge needs to be one per cart order.

additionally, HazMat2 ($49) needs to cancel out HazMat1($25) and if the order is $300 or above,
they both get dropped.

thanks for your help.

2 Feb 2013, 5:53 AM
#9
drbyte avatar

drbyte

Sensei

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

Post #9 by drbyte

tcarden:

if you buy 2 six inch electric matches it works but if then buy a 12-inch electric match it applies the one-time charge twice. the charge needs to be one per cart order.

additionally, HazMat2 ($49) needs to cancel out HazMat1($25) and if the order is $300 or above,
they both get dropped.

  • Any other specs this "feature" needs to accomplish?
  • And is it a "must" that it appear on the shopping-cart page? or is it acceptable to show in the order-totals area on checkout-payment and checkout-confirmation and order-history?
  • How are you currently specifying that a product requires one fee or the other? Just a single additional product field?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

2 Feb 2013, 6:09 AM
#10
tcarden avatar

tcarden

Zen Follower

Join Date:
Oct 2012
Posts:
282
Plugin Contributions:
0

Post #10 by tcarden

yes, a single additional column in the products table. hazmat_status. it's either 1, 2 or Null.

i'm not the site owner but it probably okay it were just to appear at the order's total area and not sub-totals page.

there is one requirement though, which is partly a front-end thing, but i need something to trigger a pyro-agreement div w/ checkbox and was planning on trying to create a Global Var to do so. like...
if ($HazMat == true) { echo '<div id="pyro-agreement".....} something like that.

and then if they didn't check the box, some JS would disable the checkout button, or entire form. something like that. or it would be even better to capture the checkbox if checked and put into the orders table, if there is such a thing, .. record it somehow.

thanks again Dr. Byte

2 Feb 2013, 6:12 AM
#11
tcarden avatar

tcarden

Zen Follower

Join Date:
Oct 2012
Posts:
282
Plugin Contributions:
0

Post #11 by tcarden

a little shy about posting a link to the Dev site on a pubic forum like this. i could send privately if interested. it's a great site.

2 Feb 2013, 6:51 AM
#12
tcarden avatar

tcarden

Zen Follower

Join Date:
Oct 2012
Posts:
282
Plugin Contributions:
0

Post #12 by tcarden

it's just occurred to me, i was not clear on something,
only $hazMat2 should trigger the pyro agreement. $hazMat2 is pro-pyrotechnics. One is the do-it-yourself stuff,

thanks