Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Handling Fee as Percentage?

Handling Fee as Percentage?

Views: 22,077

Results 41 to 52 of 52
19 Feb 2012, 2:19 AM
#41
ec_web avatar

ec_web

New Zenner

Join Date:
Feb 2011
Posts:
89
Plugin Contributions:
0

Handling Fee as Percentage?

Well thank you so much for your time !!! I really do appreciate the help.....I'm stumped here!

If I take the code out that does the 1.75 and just add the 1.75 into the shipping module under admin/module/shipping, usps, it shows it either logged in or not, I just cant add the 3% like I wanted... but took it out of the code.......can't show one price in the estimator then they log in and see a higher fee....would run them off...........

ugggghhh...I'll keep searching, if I find anything I'll post so that maybe it can help someone else if they have the same issue.

Thanks again!

19 Feb 2012, 2:42 PM
#42
ajeh avatar

ajeh

Oba-san

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

Re: Handling Fee as Percentage?

Try this code instead and see if it works for both your shipping_estimator and the checkout_shipping ...

global $cart;
$chk_cart_total = $_SESSION['cart']->show_total();
echo 'Cart total: ' . $chk_cart_total . ' Cost: ' . $cost . ' Extra: ' . ($chk_cart_total * .03 + 1.75) . ' = ' . (($chk_cart_total * .03 + 1.75) + $cost) . '<br>';
          $methods[] = array('id' => $type,
                             'title' => $title,
                             'cost' => ($cost * $shipping_num_boxes) + ($chk_cart_total * .03 + 1.75) + (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box' ? $usps_handling_fee * $shipping_num_boxes : $usps_handling_fee) );

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

19 Feb 2012, 8:39 PM
#43
ec_web avatar

ec_web

New Zenner

Join Date:
Feb 2011
Posts:
89
Plugin Contributions:
0

Re: Handling Fee as Percentage?

WWAAAAAAAAAHOOOOOOOOOOO !!!!!! :clap:

It works!

Thank you so very much for your time helping me figure this out !!!! I am so very grateful. Couldn't have done it without you.

19 Feb 2012, 11:27 PM
#44
ajeh avatar

ajeh

Oba-san

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

Re: Handling Fee as Percentage?

Thanks for the update that this works for you ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

28 Nov 2012, 3:52 AM
#45
inlayout avatar

inlayout

New Zenner

Join Date:
Nov 2012
Posts:
12
Plugin Contributions:
0

Re: Handling Fee as Percentage?

Hi, I'm trying to do this with 1.5.1 UPS module. I need to add 15% handling fee to the UPS fee estimate.

The solution proposed here seems like what I need: http://www.zen-cart.com/showthread.php?60865-Handling-Fee-as-Percentage&p=392868#post392868

but the shipping module appears different in 1.5.1. I can't find the exact code they replaced. I did find something on line 269 that seems like the place it needs to be changed, but the code they used in the example above doesn't work.

Any ideas?

28 Nov 2012, 5:09 AM
#46
ajeh avatar

ajeh

Oba-san

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

Re: Handling Fee as Percentage?

Are you wanting the handling fee to be 15% of the Order Total or 15% of the Shipping Cost?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

28 Nov 2012, 1:41 PM
#47
inlayout avatar

inlayout

New Zenner

Join Date:
Nov 2012
Posts:
12
Plugin Contributions:
0

Re: Handling Fee as Percentage?

Hi thanks for replying. 15% of the shipping cost.

28 Nov 2012, 4:43 PM
#48
ajeh avatar

ajeh

Oba-san

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

Re: Handling Fee as Percentage?

To make handling 15% of the shipping cost, you can customize the UPS shipping file:
/includes/shipping/ups.php

with the code:

        // EOF: UPS USPS
        $cost = preg_replace('/[^0-9.]/', '',  $cost);
[B]        $new_handling = $cost * .15;
[/B]        $methods[] = array('id' => $type,
                           'title' => $this->types[$type],
                           'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? [B]$new_handling[/B] * $shipping_num_boxes : [B]$new_handling[/B]) );

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

28 Nov 2012, 9:22 PM
#49
inlayout avatar

inlayout

New Zenner

Join Date:
Nov 2012
Posts:
12
Plugin Contributions:
0

Re: Handling Fee as Percentage?

The code is a little different than the code you have here, I wonder if it is because my UPS module file is UPSXML.php instead of UPS.php? How can I get the UPS.php module? I don't know why I ended up with this one.

28 Nov 2012, 9:40 PM
#50
inlayout avatar

inlayout

New Zenner

Join Date:
Nov 2012
Posts:
12
Plugin Contributions:
0

Re: Handling Fee as Percentage?

Ok, never mind, I found the ups.php module. I was also able to find and change the code. The prices I'm getting from the 2 different modules are different though, even with the 15% factored in. I wonder which is more accurate? Seems like the regular UPS module is giving me higher price quotes.

28 Nov 2012, 11:03 PM
#51
ajeh avatar

ajeh

Oba-san

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

Re: Handling Fee as Percentage?

Check your settings on the two modules ... you could also be getting different ones as you are logged into your account with one of them ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

17 Apr 2019, 5:35 PM
#52
apollowilcox avatar

apollowilcox

Zen Follower

Join Date:
Sep 2014
Location:
Indiana
Posts:
123
Plugin Contributions:
0

Re: Handling Fee as Percentage?

On this topic of adding a %-age based handling fee: A while back, we converted our UPSXML module to use our input as a percentage instead of a flat $ amount. But the %-age method is sort of useless on small orders and the flat dollar amount is ineffective on large orders. Especially in light of setting the shipping to be based on COM and it's a RES order.

So, now we've changed our UPSXML mod to use both a %-age and flat rate. It works similarly to the Package Tare: Percentage: Weight setting under Configuration/ Shipping. We now have a percent and dollar amount in the UPS XML shipping module admin settings and the module uses both.

In includes\modules\shipping\upsxml.php; around line 324, i remmed out:

$methods[] = array('id' => $type, 'title' => $_type, 'cost' => ($this->handling_fee / 100 * $cost + $cost));

then added:

$za_handling_array= preg_split("/[:,]/" , str_replace(' ', '', $this->handling_fee));
	$zc_handling_percent= (float)$za_handling_array[0];
	$zc_handling_dollar= (float)$za_handling_array[1];
	$methods[] = array('id' => $type, 'title' => $_type, 'cost' => ($cost + $zc_handling_dollar + $zc_handling_percent / 100 * $cost));

Second, in phpMyAdmin, search the configuration table for key: MODULE_SHIPPING_UPSXML_RATES_HANDLING
Change the configuration title to something like: "What is the handling fee for UPS? <br />Example: 10% markup + $1 10:1<br />10% + $0 10:0<br />0% + $5 0:5<br />0% + 0lbs 0:0"

to give proper instructions to the admin entering the handling fee settings for the shipping module.

Just putting this out there in case others find it helpful.