Contributions
Additional Shipping Options for Table Module
Simple modification that demonstrates how you can add multiple shipping options (2-day, next day, etc.) to the table rate module.
This example adds 2-day shipping, but you could conceivably use the same method to add as many other options as you want.
Just replace your existing files (2) with the ones included in the archive. The included files are based on 2.2MS2.
Expand All / Collapse All
What's been changed from the previous distribution:
File Name: catalogincludesmodulesshippingtable.php
1. After line "function quote($method = '') {"
Change "global $order, $cart, $shipping_weight, $shipping_num_boxes;"
To "global $order, $cart,$shipping_num_boxes,$order_total;"
2. Change the if statement:
if (MODULE_SHIPPING_TABLE_MODE == 'price') {
$order_total = $cart->show_total();
} else {
$order_total = $shipping_weight;
}
to:
if (MODULE_SHIPPING_TABLE_MODE == 'Price') {
$order_total = $cart->show_total();
} else {
$order_total = $cart->show_weight();
}
Tested OK on
Apache/2.0.54 (Unix) PHP/4.4.2 mod_ssl/2.0.54 OpenSSL/0.9.7e mod_fastcgi/2.4.2 DAV/2 SVN/1.3.2
Some of you were having problems with installation, so I've updated that part of the code. I've tested install/uninstall over and over, changed config, made a test order on my site and have no problems. I've attached the full zip again, for the folks who had problems with this earlier please d/l this and tell me if it fixes them.
I jumped the gun on the last upload, left a debugging line in there...it's been a long day, here's the same zip with debuggin code removed...
Sorry folks, I mis-understood some details of the shipping module algorithm used in oscommerce. I did not do very good testing on the last upload and some of you have pointed out a bug where it always uses the first method no matter what you select during checkout.
I have spent some extra time comparing my work to another shipping module and testing this module as I should have done earlier to make sure I'm interfacing with oscommerce correctly.
Attached is the full zip again...
This is the entire package again, this one includes a fix for a minor bug, pointed out by "GloomM", which would've revealed itself when the module got uninstalled.
This extends on the previous enhancements made to the shipping module demonstrating how to extend it to provide multiple shipping methods, and a table rate for each method.
The part I didn't like about that extension was that I had to modify both the languages/..../modules/shipping/table.php and
modules/shipping/table.php files to add/remove/edit a shipping method.
While the file in languages is easy to edit, I didn't feel it was
appropriate for people to have hack php code to administer the methods.
So I've respun much of this module so that users only need to maintain languages/..../modules/shipping/table.php. I've placed several methods in this file already to show the pattern, but basically you just need to define a MODULE_SHIPPING_TABLE_TEXT_METHOD_x for each shipping method you want to offer. The module, WHEN INSTALLED, will hunt for these definitions in sequence, starting at METHOD_1. When it detects a break in the sequence, it stops hunting and will register the appropriate defines for the methods discovered up to that point. In other words, don't skip method numbers.
The last weight/price in the table acts as a cap. If the order total goes beyond that then that particular method is not offered as a valid shipping option. I also added special recognition for 'infinity' as a weight/price to remove this cap for a given method. See the readme.txt for details.
Fixed two bugs and added more options so now this module includes Ground, 3-Day, 2-Day and Next-Day tables by default.
This file replaces the original contribution and contains necessary updates for this feature to function properly.
You can see this feature in action at www.shelburnefarms.org - but please do not place test orders (unless you want some delicioous cheese:), this is a live production site!
Simple modification that demonstrates how you can add multiple shipping options (2-day, next day, etc.) to the table rate module.
This example adds 2-day shipping, but you could conceivably use the same method to add as many other options as you want.
Just replace your existing files (2) with the ones included in the archive. The included files are based on 2.2MS2.
Note: Contributions are used at own risk.