Topic: Xajax Shipping (Designed for Canada)

Alright, let's get this party started, first and foremost I made this program for a company I am working for and took the final construction of the program before adding it to the actual website and formed this package along with documentation used and the versions of MiniXML and Xajax (0.5B4) used in it's construction, theoretically it could be used with 0.5 Final however I haven't tested it yet.

The reason why MiniXML is included is because the program that Canada Post made that I cannibalized used MiniXML, everything else uses cURL & the PHP 5 XML handling functions.

This is far from a final version, it isn't very customizable and currently is set to handle packages by count, not by individual weight calculations, you see this program was designed for a clothing manufacturer, and shipping rarely goes above the cubed weight for the boxes that they ship in, as such it made more sense to simply count how many of them there are, add a multiplier for larger items of clothing, and set a count for each box of the amount of base items each box type can handle. (in this case a full body item would be 1 item, some items were larger and were 3 times as big as the full body item and the largest box could handle 25 full body items.)

More on editing that can be found in the readme.txt file found in the ShippingAJAX.rar file.

Now then, there have been some adjustments to make variables global for the various functions but some are required to stay with the program due to the fact that even though they are variables, they only have static values at this time (weight is one variable that is currently still in the Fedex function for example.) More details on these changes can be found in either the file itself (comments) or in the readme.txt file.

Database structure has been saved to an xls document that you can build the database from these sheets, it also has data for all the countries and most of their associated provinces/states (or the closest thing I could find that relate to provinces or states.)

The data in there is what the program will be looking for, the structure is set up and on display, feel free to change whatever you want, remember though, ID fields in that database are related to other pages, for example, the country ID in the province table is related to the country ID in the country table, the Company ID in services is related to the company ID in Companies, etc. If you start muddling around in there, pay CLOSE attention to this.

Now then, even though there is a pile of provinces/states/regions, I decided against using all those and stuck with making the user type it in if they aren't in North America, I would have made them type it in regardless but Fedex requires a two character province or state code to properly calculate shipping in North America. The reason why I didn't use all of them is because I can't be sure if that is actually the name of the province/state/region or if it is a misinterpretation.

If you feel confident that they are either correct or that you have corrected them, you can change the setup for each one in setCountry, on line number 731, that is where it figures out if it is in North America by ID number and finds the provinces by ID number of the country selected, simply add the country you want to display by ID number in the various checks, you may need to monkey around a bit to get it to fully run, also if you are going to add a dropdown for any country, you HAVE to give it a Province code, even if it is the same name as the province because that is what is going to go into the value of your option.

Implementation is fairly simple if you want to use it in your website, as-is, without playing with weights, as it is all database work. In the example (AJAXcountrynship.php) I have set a static quantity at the top, clearly commented just after the session starts. That is where you tell it what item id there is, and how many there are, however the program will be looking for a database table titled 'product_types' and looking for a field 'perBach' by the field 'Product_Type_ID'. You can change this on line 116, and put in your own database field and table names if you wish for your products. The other tables it will look for are the tables named after the XLS sheet names, pay attention to those, especially the underscores in the names.

Included also is a database constructor for MySQL for the database tables, as this was designed in MySQL, to make life easier in creating the tables.

Anything else may be found in the readme.txt including credits for work I had help with or that I cannibalized from other sources and squeezed into this mold.

If there are ANY questions, concerns, comments, or whatnot feel free to post here, my only request is to keep it constructive.

edited by q_no:
Here's the download link:


Re: Xajax Shipping (Designed for Canada)

Added download link smile

Re: Xajax Shipping (Designed for Canada)

Thanks q_no, you're my hero! big_smile