osCommerce Shipping Modules Programming

December 21, 2007 by hejian

Shipping Modules give the store owner a way to change which shipping options are available to the customer at checkout time. During the checkout process, these modules are called to calculate the final shipping and packaging costs for the order. The price can be affected by how many products have been ordered, how much they weigh, as well as any other configuration settings set either in the shipping module itself or in the administrative tool settings.

The shipping modules just has one important function:

quote($method = '', $module = '')

This function will return the quotes array:

[id] = module ID
[module] = module name
[methods] = Array (
[id] = method ID
[title] = method name
[cost] = the price of this shipping method
)

These are the global variables can be used in this function:

$order->delivery['country']['iso_code_2']
$order->delivery['postcode']
$order->delivery['zone_id']
$shipping_weight : this value is caculated by the shipping class
$shipping_num_boxes : this value is calculated by the shipping class, $shipping_num_boxes = ceil($shipping_weight/SHIPPING_MAX_WEIGHT);

Leave a Reply

You must be logged in to post a comment.

Wordpress template made by HeJian