News:

Support the VirtueMart project and become a member

Main Menu

UPS Shipping Module Hacks: Set Shipping Methods & Override Vendor Zip

Started by Daniel Wagner, March 25, 2006, 21:09:40 PM

Previous topic - Next topic

Daniel Wagner

I have made a few modifications to the UPS Shipping module:

Source Zip Code - I needed to be able to set a ship from (source) zip code that is different from the Vendor's zip code (products are shipped from a fulfillment center in a different city). A Ship From Zip Code can now be set in the Shipping Module Configuration and if set will override the Vendor's zip code.


  • Source Zip Code - I needed to be able to set a ship from (source) zip code that is different from the Vendor's zip code (products are shipped from a fulfillment center in a different city). A Ship From Zip Code can now be set in the Shipping Module Configuration and if set will override the Vendor's zip code.

  • UPS Shipping Method - I am using the UPS Online Tools to retrieve shipping rates, but I do not want customers to be able to select some of the methods that are returned from UPS. So, these too can now be set in the Shipping Module Configuration. There are simply check boxes for each of the available shipping methods and you may select which to allow a customer to choose from.

note: I removed the UPS Worldwide Expedited SM shipping method from the list (actually just commented out in the attached file) because for some reason, no matter what I did, this shipping method was always checked in the configuration...really pretty strange. I must have made a silly mistake, but I was unable to figure it out. If someone is able to figure out what I did wrong please let me know!

Updated ups.php file is attached. I have placed comments around all of my changes to the original code. I hope that someone else finds this useful.

[attachment cleanup by admin]
Dan

deneb

Hey Dan,
awesome contribution!

I was fiddling around with this hack and found that the UPS Worldwide Expedited SM-is-always-checked issue is indeed weird! As you have coded it, if you uncheck the UPS Worldwide Express SM option...then the Expedited option would be shown unchecked. So, I thought maybe there was a typo in the php IF statement for that option. well...it all looked good.

My only solution is to enclose the value in single quotes so it tests to see if it matches a string instead of a number. This works!

here is the modded html row:
<tr>
  <td>&nbsp;</td>
  <td>
<input type="checkbox" name="UPS_WORLDWIDE_EXPEDITED_SM" class="inputbox" <?php if (UPS_WORLDWIDE_EXPEDITED_SM == '08') echo "checked=\"checked\""?> value="08" />UPS Worldwide Expedited SM
  </td>
  <td>&nbsp;
  </td>
</tr>


key changes:

UPS_WW_EXPEDITED_SM ---> UPS_WORLDWIDE_EXPEDITED_SM

and

08 ---> '08'

Daniel Wagner

Deneb,

Thanks so much for figuring this out! This was driving me nuts...I wasted so much time on this.

Thanks again!
Dan

Elkaholic

Will this hack allow for multiple vendor shipping address "Ship from". I will be setting up a site that will have several drop ship categories and would like each category, or even item to have the item calculate shipping charges based on the vendors location. I know at checkout time this is where things could get tricky and I am looking at attacking this type of mod, unless it's already been done?

VirtueMart Is a Great Product,

Thanks!!


Simon A.

You'd somehow have to have a ZIP associated with each item, so I'd say this probably doesn't do that.