News:

Support the VirtueMart project and become a member

Main Menu

Patches to allow two forms of USPS shipping

Started by durian, December 29, 2005, 21:19:52 PM

Previous topic - Next topic

durian

The attaches patches allow you to configure two types of USPS shipping.  For our purposes, we wanted Priority and Express.  I'm sure someone a bit more PHP savvy than I am could easily adjust this to support N different types of USPS shipping.

mike

[attachment cleanup by admin]

koltz

Thanks for the post :), been wanting to do this myself.  Question, looks like you just duplicated some of the code and did you hardcode in Express and Priority?  Or is taht selectable by typing in what service you want like previously(I haven't installed it yet, getting to that question)?  What I have done with my previous site is offer Priority, Parcel, Express, First Class (for under 1 pound), Global Priority, Global Express.  How difficult would it be to add these to those files.  I know some PHP, but want a better understanding how you got this working.

Next, the files have a .patch on them.  How do I upload?

Last, where can I find a place for the keywords on what services to select?  I know Priority, but that is about it :)

Thanks,

Corey

durian

By now, you've probably answered your own questions, but I'll follow up anyway.

Express and Priority are not hard-coded.  I've hard-coded two USPS shipping types, but
the types can be anything you want.

Yes, you type in the services you want just like the original version.  For each type, you select
a shipping method, a package type and a description (e.g. "(2-3 days)").

I'm sure you wouldn't have too much difficulty expanding the number of shipping methods.
Just take what I did and extend it.  Basically, my code just builds an array of enabled shipping
methods (based on the configuration file setting) and then walks through the array one shipping
method at a time to gather rate quotes.  You'd just add more possible shipping methods in
the usps.cfg.php file and add as necessary to the array of shipping methods.  The part that
walks the array shouldn't need any changes.

The patch files were generated using 'diff -u'.  I come from the Unix world and used tools I
am familiar with.  To apply the patches, you get a command line prompt, change to the directory
containing the file requiring the patch and then use the patch(1) utility.  E.g. "patch < file.patch".

I'm not sure what to tell you if you don't have access to a command line prompt.  I pretty sure
you can find a Windows build of the patch utility.

I don't recall where I found the list of shipping methods (and more importantly the package types
that can be used with each).  Nor can I remember what I did with said list.  I do know I found
both the type list and package list by searching the web though.

mike