Jump to content
rbartz

Shipping Insurance for UPS and whatever else....

Recommended Posts

Here is a contribution that calculates Shipping Insurance based on a RATE times the TOTAL order (less tax, including shipping) minus any EXEMPT amount. I needed it for UPS but it should work well with any other shipping method that uses a similar scheme for calculating the fees.

 

http://www.oscommerce.com/community/contributions,1069

 

UPS gives insurance free on the first $100 of value, and charges 50 cents per $100 after that... so this calculates a shipping insurance fee of 50 cents (RATE) for each $100 or part thereof (INCREMENT) on the amount above $100 (EXEMPT).

 

The RATE, EXEMPT amount and INCREMENT amounts are all configurable in the Modules->Order Total Modules-> Shipping Insurance Edit panel.

 

The customer CANNOT choose whether to add it or not if you turn it on. That seemed dumb to me since I end up with the loss if they don't insure. I ought to be the one to choose...

 

You can turn the module on or off, and choose if it is for national, international, or both shipments, and even set a tax rate on the shipping insurance if needed.

 

Gunter Sammet rewrote Harold Ponce de Leon's ot_loworderfee.php to start this, I rewrote his work. Hope it works for you! I am using it live with a 11 November 2002 snapshot and authorizenet and mail order payment modules.

Share this post


Link to post
Share on other sites

This is just what I have been waiting for. It would have been nice if it included a admin controlled option to add special fees like delivery confirmation......... but I am not complaining!

 

The instructions are vague. I added the files to the order_total directories in the catalog directory............ now what? The special instructions - do they apply if you are not using the low order fee module or do the instruction apply only to the placement of the added part and should be added by everyone?

 

HELP I've got all sorts of errors happening?

Warning: main(/www/m/xxxxx/htdocs/store/includes/languages/english/modules/order_total/ot_insurance.php) [function.main]: failed to create stream: No such file or directory in /www/m/xxxx/htdocs/admin/modules.php on line 120

 

Warning: order_total(includes/languages/english/modules/order_total/ot_insurance.php) [function.order-total]: failed to create stream: No such file or directory in /www/m/xxxxx/htdocs/store/includes/classes/order_total.php on line 25

 

HELP!

Share this post


Link to post
Share on other sites

Hi...

 

There are only two files and the readme...

 

You evidently did not install the language file.

 

When you unzip the package, you should have the correct directory stucture in a directory named "shipping_insurance". You may have unzipped the files NOT using folder names... no good. Unzip preserving the directory structure.

 

Then copy the two files into the two directories where you find then....

 

One is /includes/languages/english/modules/order_total/ot_insurance.php

The other is /includes/modules/order_total/ot_insurance.php

 

After that it is just a matter of going to admin, turning it on, and adjusting the values... the defaults are for UPS.

 

If you do not know how to unzip a file preserving directory structure, e-mail me and I will send you a self-executing zip that will do it for you.

Share this post


Link to post
Share on other sites

This is exactly what I have wanted as well... I use authorize.net to take the money from user's credit card, though. Is this going to add the additional charge amount to authorize.net also?

 

I've heard about people modifying the "total" value and (while it SHOWS the correct price) it charges the "pre-modification" price (without added insurance) to authorize.net

 

What I mean is will authorize.net recieve the total price with insurance included, or will it also need to be modified to grab the new total price (with insurance)

 

Tell me if I've made it clear enough.

 

I'm trying to say that I'm afraid that it might LOOK right (on the invoice) but authorize.net will charge the TOTAL to the credit card WITHOUT (!) insurance.

 

Thanks for your time,

 

Brandon


- - - -

Sometimes, ignorance is bliss.

Share this post


Link to post
Share on other sites

Thanks, the file did open without a file directory structure. I downloaded it again with a different program and it worked out fine.

 

This is just what I have been waiting for. It would have been nice if it included a admin controlled option to add special fees like delivery confirmation......... but I am not complaining!

 

Can you think about adding anther feature like delivery confirmation?

 

Thanks again for all of your effort!

 

Annette

Share this post


Link to post
Share on other sites

Brandon,

 

Just do "Step 3" in the readme.txt installation, and it will work perfectly with the authorize_direct ADC Payment Module. There are some other posts about all that the last few days.

 

Annete,

 

IF I have some time this weekend, I will look into that...

 

 

RDB

Share this post


Link to post
Share on other sites

rbartz, I ran into a snag! I'm using PayPal IPN - I have the option of including shipping in the order total but PayPal IPN won't allow me to include the insurance. Since I'm without a Merchants Account I guess this it was just not to be.

 

Thanks,

 

Annette

 

BTW - It works perfectly with checks/moneyorder payments!

Share this post


Link to post
Share on other sites

I don't use Paypal, so am not familiar with where that module gets its totals. Most payment modules use a final total (like AuthNet) and get authorization for that amount. If Paypal gets a total as parts (subtotal, tax, shipping, etc.) then the module would need to look at all the parts.

 

The author of the PayPal IPN would probably be glad to help you do this. "Ask and you (probably) will receive."

 

It would seem like good programmig for a payment module to look at all order_total modules like the OSC program does so that discounts, add-ons like this, and other adjustments to totals would all be considered without having to alter the payment module for each variant.

 

Since this is an order_total module it is processed and included in the "totaling" table on an order automatically, and thus it should work with almost all of the payment modules automatically with no adjustments necessary.

Share this post


Link to post
Share on other sites

rbartz,

 

Thanks for the reply. I honestly thought my understanding of how any the order_total_modules were processed was flawed.

 

I include the url of this post in another post I made to the PayPal IPN contrib post - your response clearly laid out exactly what I could not express. Thanks!

 

I'll keep you posted.

 

Annette

Share this post


Link to post
Share on other sites

This is a newbie and actually embarrasing Q.

 

I haven't kept track of what modules I add to the software (I know that's bad) I didn't think I'd need more than one or two... Incorrect thinking. Anyone making a new site KEEP TRACK OF EVERYTHING YOU DO.

 

I haven't done too much and may even go to MS1 before I go live so i can track everything I add... But anyway...

 

How do I know if I've added the ADC connection to my osC? I don't think I have, but I called up authorize.net and the guy checked my account and said i was using the best and most current method of connecting to them (He called it AIM)

 

Thanks, Brandon

 

PS: Anyone know of serious changes since the checkout process was revamped in november (I've got a December snapshot)?


- - - -

Sometimes, ignorance is bliss.

Share this post


Link to post
Share on other sites

Unless you use AuthorizeNet to process your credit card orders, you have no use for the Authorize Net ADC payment module.... and would thus not have any reason to install it.

 

:)

 

rdb

Share this post


Link to post
Share on other sites

Sorry, I didn't finish...

 

If you use the AuthorizeNet ADC payment module, then you are using what they call AIM...

 

Sorry for not answering all in one note.

Share this post


Link to post
Share on other sites

has anyone modified this code so the customer does have the option of selecting insurance or not ?

 

thanks in advance


-caz

-----------

... trying to prove that I am a Believer :)

-----------

Share this post


Link to post
Share on other sites

Same quesiton as 'caz' above.

 

I will find this useful only if I can let the customer choose whether they want insurance or not. You can't force them to pay for insurance if they are collecting the goods from a pickup point/brick and mortar store. Besides that, not all people want insurance...and if you have a secure enough trading policy, they are aware that if an order gets lost/broken etc, it's their problem.

 

Come on guys, enabling "insurance? Yes/No" on the shipping page can't be too much hassle for the people who know how to code these things. Thanks.

Share this post


Link to post
Share on other sites

Anyone got an idea to make this optional for customers at checkout rather than forcing it upon them? Thanks.

Share this post


Link to post
Share on other sites

Hello rbartz, this contribution works very well for me except for two problems.

 

1) Speedpost (i.e the carrier I will be using) offers an insurance premium of $1 for every $100. But the minimum insurance premium is $5.

2) They also have a maximum insurance limit (which I have not found out yet).

 

Do you any suggestions as to how I can get around this?

 

Thank You

Share this post


Link to post
Share on other sites

hi thanks for the nice mod. if you guys want the easiest way to allow the customer to chose if they want insurance just add this code some where on your checkout payment page:

 

 ?
<tr>
? ? ? ?<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
? ? ? ? ?<tr class="infoBoxContents">
? ? ? ? ? ?<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
? ? ? ? ? ? ?<tr>
? ? ? ? ? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
? ? ? ? ? ? ? ?<td class="main" width="100%" valign="top"><b>Add Shipping Insurance? <input name="ship_insurance" type="checkbox" value="1"></b></td>
? ? ? ? ? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
? ? ? ? ? ? ?</tr>
? ? ? ? ? ?</table></td>
? ? ? ? ?</tr>
? ? ? ?</table></td>
? ? ?</tr>

i added it just below the payment option.

 

then in ot_insurance.php find this:

 if (MODULE_ORDER_TOTAL_INSURANCE_USE == 'true') {
? ? ? ?switch (MODULE_ORDER_TOTAL_INSURANCE_DESTINATION) {
? ? ? ? ?case 'national':
? ? ? ? ? ?if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;
? ? ? ? ?case 'international':
? ? ? ? ? ?if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;
? ? ? ? ?case 'both':
? ? ? ? ? ?$pass = true; break;
? ? ? ? ?default:
? ? ? ? ? ?$pass = false; break;
? ? ? ?}

replace with this:

 if($_POST['ship_insurance']=='1'){ if (MODULE_ORDER_TOTAL_INSURANCE_USE == 'true') {
? ? ? ?switch (MODULE_ORDER_TOTAL_INSURANCE_DESTINATION) {
? ? ? ? ?case 'national':
? ? ? ? ? ?if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;
? ? ? ? ?case 'international':
? ? ? ? ? ?if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;
? ? ? ? ?case 'both':
? ? ? ? ? ?$pass = true; break;
? ? ? ? ?default:
? ? ? ? ? ?$pass = false; break;
? ? ? ?}}

 

it works fine for me :)

Edited by adrenalinepcs

Share this post


Link to post
Share on other sites

sweet! This worked a treat, thank you!

 

Any idea how to exclude the shipping costs from the insurance calculation? The insurance to be calculated on goods total only, not including the shipping costs.

 

Thanks

Share this post


Link to post
Share on other sites
hi thanks for the nice mod. if you guys want the easiest way to allow the customer to chose if they want insurance just add this code some where on your checkout payment page:

 

 ?
<tr>
? ? ? ?<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
? ? ? ? ?<tr class="infoBoxContents">
? ? ? ? ? ?<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
? ? ? ? ? ? ?<tr>
? ? ? ? ? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
? ? ? ? ? ? ? ?<td class="main" width="100%" valign="top"><b>Add Shipping Insurance? <input name="ship_insurance" type="checkbox" value="1"></b></td>
? ? ? ? ? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
? ? ? ? ? ? ?</tr>
? ? ? ? ? ?</table></td>
? ? ? ? ?</tr>
? ? ? ?</table></td>
? ? ?</tr>

i added it just below the payment option.

 

then in ot_insurance.php find this:

 if (MODULE_ORDER_TOTAL_INSURANCE_USE == 'true') {
? ? ? ?switch (MODULE_ORDER_TOTAL_INSURANCE_DESTINATION) {
? ? ? ? ?case 'national':
? ? ? ? ? ?if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;
? ? ? ? ?case 'international':
? ? ? ? ? ?if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;
? ? ? ? ?case 'both':
? ? ? ? ? ?$pass = true; break;
? ? ? ? ?default:
? ? ? ? ? ?$pass = false; break;
? ? ? ?}

replace with this:

 if($_POST['ship_insurance']=='1'){ if (MODULE_ORDER_TOTAL_INSURANCE_USE == 'true') {
? ? ? ?switch (MODULE_ORDER_TOTAL_INSURANCE_DESTINATION) {
? ? ? ? ?case 'national':
? ? ? ? ? ?if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;
? ? ? ? ?case 'international':
? ? ? ? ? ?if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;
? ? ? ? ?case 'both':
? ? ? ? ? ?$pass = true; break;
? ? ? ? ?default:
? ? ? ? ? ?$pass = false; break;
? ? ? ?}}

 

it works fine for me :)

 

 

This in fact does NOT work.

If you actually process a dummy order, insurance is listed in the order totals on the checkout_confirmation.php page, but is dropped from the order after completion of order.

 

It does not appear in admin->orders, the order email or customers order history details online.

 

If you reverse the change you suggest in the ot_insurance.php, it works perfectly again.

 

Any suggestions?

Share this post


Link to post
Share on other sites

The code looks fine to me. You might can try to change

 

if($_POST['ship_insurance']=='1'){

 

to

 

if($HTTP_POST_VARS['ship_insurance']=='1'){

 

Otherwise I am not sure what it could be.

 

HTH

 

Gunter

Share this post


Link to post
Share on other sites
The code looks fine to me. You might can try to change

 

if($_POST['ship_insurance']=='1'){

 

to

 

if($HTTP_POST_VARS['ship_insurance']=='1'){

 

Otherwise I am not sure what it could be.

 

HTH

 

Gunter

 

Hehe, thanks but I have tried all variations and still get no joy.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×