Forums / Built-in Shipping and Payment Modules / Need Shipping Quotes UPS Worldwide to take off 40%

Need Shipping Quotes UPS Worldwide to take off 40%

Views: 702

Results 1 to 2 of 2
28 Nov 2011, 4:08 PM
#1
ffdotnet avatar

ffdotnet

New Zenner

Join Date:
Aug 2010
Posts:
6
Plugin Contributions:
0

Need Shipping Quotes UPS Worldwide to take off 40%

Greetings,

I hope this has not been answered already, I could not find anything on here that answered my question.

I am using the UPS shipping module, and it is calculating shipping accurately as every item in the catalog has the exact weight filled in.

However, our wholesaler gives a 40% discount on the price of UPS Worldwide Expedited for international orders.

For example, a 5lb item shipping to Australia (Queensland 4570) calculates as $138 with the shipping module on our store, but our wholesaler calculates it to be $82.80 (138-40%)

I need our website to do this also. Any help is greatly appreciated!

I'm not afraid of changing .php files either if this can't be changed via the admin pages.

29 Nov 2011, 7:32 PM
#2
ffdotnet avatar

ffdotnet

New Zenner

Join Date:
Aug 2010
Posts:
6
Plugin Contributions:
0

Re: Need Shipping Quotes UPS Worldwide to take off 40%

OK after some tinkering I figured it out! Now when I have a customer who's address uses UPS Worldwide Expedited, it correctly takes 40% off the shipping cost that's pulled from UPS's servers.

I will post how I did it here in a sort of tutorial form in case anyone else has the same issue!!

First, I had to duplicate the shipping module, because I only want the price of shipping using UPS Worldwide Expedited discounted, not every UPS method.

To do this, I simply downloaded these two files to my desktop:

/includes/languages/english/modules/shipping/ups.php
/includes/modules/shipping/ups.php

(I put the language file in it's own folder to keep it separate)

Open each file and use your find/replace function to replace "ups" with "ups1" and "UPS" with "UPS1" IMPORTANT - THESE ARE CASE SENSITIVE!!

now, change the name of both files from ups.php to ups1.php (remember, I put the language file in it's own folder to keep it separate)

Now open your /includes/modules/shipping/ups1.php and find the following line:

$cost = preg_replace('/[^0-9.]/', '',  $cost);

Now under it add this code so it now looks like this:

$cost = preg_replace('/[^0-9.]/', '',  $cost);
	// bof: adjust cost for international shipping
           $cost = $cost * 0.60;
	// eof: adjust cost for international shipping

You can see here that I am getting the cost to apply the 40% discount by multiplying it by 0.60 so it displays 60% of the UPS quote.

now re-upload your files to your webserver and go to your admin page. Under Modules->Shipping you should now see "ups1"

Install it and duplicate your settings of the original ups module. Now simply check off the UPS shipping methods that you want to apply your discount to, and uncheck those same methods in the original ups module!

And that's it, you're done! :clap: