Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shipping Insurance for UPS and whatever else....


rbartz

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.

Link to comment
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!

Link to comment
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.

Link to comment
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.

Link to comment
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

Link to comment
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

Link to comment
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!

Link to comment
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.

Link to comment
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

Link to comment
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.

Link to comment
Share on other sites

  • 3 months later...
  • 3 months later...

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.

Link to comment
Share on other sites

  • 3 months later...
  • 6 months later...
  • 2 months later...

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

Link to comment
Share on other sites

  • 1 month later...

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
Link to comment
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

Link to comment
Share on other sites

  • 4 weeks later...
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?

Link to comment
Share on other sites

  • 2 weeks later...
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...