Latest News: (loading..)
Sign in to follow this  
Followers 0
olsonsp4c

USPS Shipping Insurance

113 posts in this topic

it's going to be a while until I am able to take a look at Paypal integration - could someone else chime in who's successfully done it?

 

thanks! also, you might want to put specifically which Paypal addon or module you are using - the stock osC rc2a Paypal? Paypal Pro? the old "official" Paypal addon?

 

Scott

Edited by olsonsp4c

Share this post


Link to post
Share on other sites
1) The order history doesn't show that insurance was ordered.

3) If I move from "Confirmation" back to "Payment", it doesn't retain the fact that insurance was requested.

I believe the solutions to 1 and 3 are as follows:

1) The order history doesn't show that insurance was ordered.

In catalog/includes/classes/order.php, change the following:

$shipping_method_query = tep_db_query("select title from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_shipping'");

$shipping_method = tep_db_fetch_array($shipping_method_query);

$uspsinsurance_method_query = tep_db_query("select title from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_uspsinsurance'");

$uspsinsurance_method = tep_db_fetch_array($uspsinsurance_method_query);

'shipping_method' => ((substr($shipping_method['title'], -1) == ':') ? substr(strip_tags($shipping_method['title']), 0, -1) : strip_tags($shipping_method['title'])),
'uspsinsurance_method' => ((substr($uspsinsurance_method['title'], -1) == ':') ? substr(strip_tags($uspsinsurance_method['title']), 0, -1) : strip_tags($uspsinsurance_method['title']))
'shipping_method' => $shipping['title'],

'shipping_cost' => $shipping['cost'],

'uspsinsurance_method' => $uspsinsurance['title'],

'uspsinsurance_cost' => $uspsinsurance['cost'],

3) If I move from "Confirmation" back to "Payment", it doesn't retain the fact that insurance was requested.

In catalog/checkout_confirmation.php:

$_SESSION['choose_insurance'] = $_POST[$choose_insurance];
$_SESSION['choose_insurance'] = $order->info['choose_insurance'];

 

I think that captures all my changes.

 

I hope that helps,

Rich

Edited by VITW

Share this post


Link to post
Share on other sites

Yes, that really helps. thanks Rich - I'll test the code on my store too at some point soon - and integrate it into the code.

 

Scott

Share this post


Link to post
Share on other sites

Tested and slightly adjusted the code above. It works! Thanks so much!

 

I've updated the addon to 1.4 and made a few other minor changes.

 

http://addons.oscommerce.com/info/5782

 

Changes since v1.3

------------------

* Fixed the issue: the order history doesn't show that insurance was ordered (thanks VITW)

* Fixed the issue: going from "Confirmation" back to "Payment" doesn't retain the fact that insurance was requested (thanks VITW)

* Updated insurance rates to current prices (taken from usps.com)

* I have confirmed that 1.4 does work with the osC rc2a PayPal Website Payments Standard, properly carrying over the insurance value

* Updated the Upgrade section

 

Still could use help with the 2 other known issues in the "What I could use help with" section...

 

Scott

Share this post


Link to post
Share on other sites

So far it's been working as planned, although does anyone know if I can make insurance required, and not allow a customer to uncheck the box at the checkout stage?

Share this post


Link to post
Share on other sites
So far it's been working as planned, although does anyone know if I can make insurance required, and not allow a customer to uncheck the box at the checkout stage?

 

 

You should just install USPS Methods and use the "with insurance" option and choose that you want insurance included in the admin - that way, all price quotes from usps include shipping insurance automatically.

 

Scott

Share this post


Link to post
Share on other sites

i found a problem in the script but i don't know how to fix it, if somebody can do it, please post the fix..

The problem is that if you have checked insurance and you are on checkout_confirmation.php or checkout_payment.php and you go back to checkout_shipping, the option of the insurance is UNchecked. And it doesn't matter if you leave it unchecked or if you checked it again. In the confirmation page the insurance will be as checked. So if you want to uncheck it you can't...

The fix i think must do this :

First of all, if you go back to the checkout_shipping, the box of the insurance must be checked (if you have checked it before)

And last, if you uncheck it and you proceed to the next pages, the insurance must turn off..

 

I think you understand what i am telling..

Share this post


Link to post
Share on other sites

I have confirmed the problem; however, I am leaving out of town for a week or so and won't be able to work on it. Can someone else look into this as this could be frustrating to customers?

 

Scott

Share this post


Link to post
Share on other sites

I made some cosmetic changes to script. I wanted to seem like all the other option in the checkout. I mean the rollover colour and the fuction that you click everywhere inside the <tr> and the option is getting checked .(radio in all options, at this time checkbox). For everyone who want to do it i am giving the code..

 

After this :

function rowOutEffect(object) {
if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}

Add that function :

function insurancecheck(oRow){
if(oRow.getElementsByTagName('input')[0]&&oRow.getElementsByTagName('input')[0].type=='checkbox'){
var c = oRow.getElementsByTagName('input')[0];
c.checked=(c.checked==false)?true:false;	
}
else{alert('There is not any checkbox on that <tr>')}
}

And then find this :

<tr>
			<td class="main" align="right" valign="middle"><input type="checkbox" name="choose_insurance" value="1" ></td>
			<td class="main" align="left" valign="middle"><? echo TEXT_USPSSHIPPING_INSURANCE_QUOTE; ?></td>
			<td class="main" align="center"><?php echo TEXT_USPSSHIPPING_INSURANCE_DISCLAIMER2; ?></td>

And change it to this :

<tr class="moduleRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onClick="insurancecheck(this)">
			<td class="main" align="right" valign="middle"><input type="checkbox" name="choose_insurance" value="1" ></td>
			<td class="main" align="left" valign="middle"><? echo TEXT_USPSSHIPPING_INSURANCE_QUOTE; ?></td>
			<td class="main" align="center"><?php echo TEXT_USPSSHIPPING_INSURANCE_DISCLAIMER2; ?></td>

To the contibuter : I think it's a good idea to add it in the next version.. Also if you have any news for the bug, please post it!

Share this post


Link to post
Share on other sites

Thanks! I like the addition and will integrate it. I am back and will make some time this week to work on the back/forth checked/unchecked value continuing to be retained issue mentioned above, though I'm not an expert at those kind of issues and could use help.

Edited by olsonsp4c

Share this post


Link to post
Share on other sites

thank you:) if you have any good news for the back problem, please inform us :)

Share this post


Link to post
Share on other sites

NOTICE : I am using this very good script not as USPS Insuranse, but as gift wrapping option.. I made to it some very small changes, and i am using it as an option for giftwrapping the items of my customers :) I m telling this just to give an idea to other people who may need this thing, because there isn't any script for giftwrapping.. (only one very old, bad made, junk code!)

Share this post


Link to post
Share on other sites
Thanks! I like the addition and will integrate it. I am back and will make some time this week to work on the back/forth checked/unchecked value continuing to be retained issue mentioned above, though I'm not an expert at those kind of issues and could use help.

 

Any luck on the back/forth checked/unchecked value issue yet?

Share this post


Link to post
Share on other sites

sorry guys, i've been otherwise occupied, I hope to get to it soon...

 

Scott

Share this post


Link to post
Share on other sites

Hi Scott,

 

Sorry if this is the wrong thread to ask this, but I don't know where else to ask for help. :blush:

 

What I am looking to do:

  • Add (manditory) insurance to USPS domestic shipping. I do NOT want to give the customer the choice.
  • Show USPS transit times in checkout.
  • Be able to update insurance rates from Admin when USPS changes rates.
  • I do not charge tax.

Here's my problems:

 

 

  • I am using USPS Methods 2.9.2 Upper Case Fix2
  • Although ticked in Admin Panel, transit times do not show (weight does).
  • I am using PayPal IPN v2.3.3 (having insurance combined with shipping is fine).

Looking at my options, I'm guessing USPS Methods v3.0 would be my closest/best choice.

The only couple of issues that I am concerned with:

 

 

  • I have never been able to display transit times. Will that be an issue that might carry over with this contribution although it states it was added?
  • It sounds like it is giving the option of adding insurance to the customer - "Added the optional shipping insurance order totals module (checkbox)". Can that feature be left out so that insurance is automatically calculated in to the shipping cost? Something showing on the checkout page something like -

I really would appreciate your opinion and ideas on this.

TIA ;)

Share this post


Link to post
Share on other sites
Hi Scott,

 

Sorry if this is the wrong thread to ask this, but I don't know where else to ask for help. :blush:

 

What I am looking to do:

  • Add (manditory) insurance to USPS domestic shipping. I do NOT want to give the customer the choice.
  • Show USPS transit times in checkout.
  • Be able to update insurance rates from Admin when USPS changes rates.
  • I do not charge tax.

Here's my problems:

 

 

  • I am using USPS Methods 2.9.2 Upper Case Fix2
  • Although ticked in Admin Panel, transit times do not show (weight does).
  • I am using PayPal IPN v2.3.3 (having insurance combined with shipping is fine).

Looking at my options, I'm guessing USPS Methods v3.0 would be my closest/best choice.

The only couple of issues that I am concerned with:

 

 

  • I have never been able to display transit times. Will that be an issue that might carry over with this contribution although it states it was added?
  • It sounds like it is giving the option of adding insurance to the customer - "Added the optional shipping insurance order totals module (checkbox)". Can that feature be left out so that insurance is automatically calculated in to the shipping cost? Something showing on the checkout page something like -

I really would appreciate your opinion and ideas on this.

TIA ;)

 

My opinion is to use usps methods 3.0 - i still use it on my site - you can update the domestic and international insurance rates with this addon (I wrote it, so I think i'm remembering correctly) - you can choose to include insurance rates as mandatory for customers - estimated shipping times show properly on my site currently. make sure you remove and delete the stock osC usps module before installing. To be safe, remove and delete usps 2.9.2 as well and go into your mysql database and ensure it deleted the usps fields in the configuration table manually (open the configuration table and search for USPS).

 

Scott

Share this post


Link to post
Share on other sites

Thank you Scott! ;)

 

I believe the database should be fine. I just compared the SQL updates of the v2.9.2 by tarheit and your v3.0, they are identical.

 

Oh, oh... just installed the contribution and double checked myself.

 

In admin panel, when I click on Edit (for USPS) I receive this message along the top:

 

Parse error: syntax error, unexpected T_GLOBAL, expecting ')' in /home/handesho/public_html/catalog/admin/modules.php(216) : eval()'d code on line 1

Also although I selected all the options; I lost my handling fee and insurance does not get added. :(

 

Any ideas what to look for?

Share this post


Link to post
Share on other sites
Thank you Scott! ;)

 

I believe the database should be fine. I just compared the SQL updates of the v2.9.2 by tarheit and your v3.0, they are identical.

 

Oh, oh... just installed the contribution and double checked myself.

 

In admin panel, when I click on Edit (for USPS) I receive this message along the top:

 

Parse error: syntax error, unexpected T_GLOBAL, expecting ')' in /home/handesho/public_html/catalog/admin/modules.php(216) : eval()'d code on line 1

Also although I selected all the options; I lost my handling fee and insurance does not get added. :(

 

Any ideas what to look for?

 

Did you try the troubleshooting tip 1?

 

Scott

Share this post


Link to post
Share on other sites
Did you try the troubleshooting tip 1?

 

Scott

 

:huh: :unsure:

 

Thank you Scott... my bad! :blush:

 

That fixed my problem. :)

 

A word of warning...

 

When you get to be my age, do NOT pull all-nighters. :wacko:

Also remember to write down your USPS username before de-activating the module. :(

 

Thanks again Scott for both the contribution and your help. ;)

 

And thanks to the USPS for assigning me a new username\password so quick! :rolleyes:

Share this post


Link to post
Share on other sites
:huh: :unsure:

 

Thank you Scott... my bad! :blush:

 

That fixed my problem. :)

 

A word of warning...

 

When you get to be my age, do NOT pull all-nighters. :wacko:

Also remember to write down your USPS username before de-activating the module. :(

 

Thanks again Scott for both the contribution and your help. ;)

 

And thanks to the USPS for assigning me a new username\password so quick! :rolleyes:

 

You're welcome!

Share this post


Link to post
Share on other sites

Hey Scott,

 

Sorry but I'm back to rattle your brain a little. I tried posting this elsewhere but got no replies...

 

I would like to rearrange how some text is displayed on the checkout_confirmation page.

Specifically:

Shipping Method (Edit)

United States Postal Service (1 x 2.25lbs) (Parcel Post:

Estimated 2 - 9 Days)

 

To this:

Shipping Method (Edit)

U.S.P.S. (1 x 2.25lbs)

(Parcel Post: Est. 2 - 9 Days)

 

And this:

United States Postal Service (1 x 2.25lbs) (Parcel Post: Estimated 2 - 9 Days): $10.41

Total: $30.91

 

To this:

U.S.P.S.: $10.41

Total: $30.91

 

 

I found this - $time = 'Estimated 1 - 2 ' . MODULE_SHIPPING_USPS_TEXT_DAYS; in includes\modules\shipping_usps.php so I think if I change all instances of Estimated to Est. that might work for that edit. But I can't figure out how to add a line break between the shipping weight and the transit time or where to change "United States Postal Service" to "USPS". I'm not even sure if the last part of my edit could be done (next to the price).

 

Any ideas or helpful hints?

Share this post


Link to post
Share on other sites
Hey Scott,

 

Sorry but I'm back to rattle your brain a little. I tried posting this elsewhere but got no replies...

 

I would like to rearrange how some text is displayed on the checkout_confirmation page.

Specifically:

Shipping Method (Edit)

United States Postal Service (1 x 2.25lbs) (Parcel Post:

Estimated 2 - 9 Days)

 

To this:

Shipping Method (Edit)

U.S.P.S. (1 x 2.25lbs)

(Parcel Post: Est. 2 - 9 Days)

 

And this:

United States Postal Service (1 x 2.25lbs) (Parcel Post: Estimated 2 - 9 Days): $10.41

Total: $30.91

 

To this:

U.S.P.S.: $10.41

Total: $30.91

 

 

I found this - $time = 'Estimated 1 - 2 ' . MODULE_SHIPPING_USPS_TEXT_DAYS; in includes\modules\shipping_usps.php so I think if I change all instances of Estimated to Est. that might work for that edit. But I can't figure out how to add a line break between the shipping weight and the transit time or where to change "United States Postal Service" to "USPS". I'm not even sure if the last part of my edit could be done (next to the price).

 

Any ideas or helpful hints?

 

I'll take a crack at it...

 

Changing United States Postal Service to USPS

 

In catalog/includes/languages/english/modules/shipping/usps.php (in usps methods 3.0 or less)

 

define('MODULE_SHIPPING_USPS_TEXT_TITLE', 'United States Postal Service');

 

to this:

 

define('MODULE_SHIPPING_USPS_TEXT_TITLE', 'U.S.P.S.');

 

for the rest of it, I'm clueless at this point...

 

Scott

Share this post


Link to post
Share on other sites

Thank you Scott! ;)

 

I'll play around with the other edits until I except defeat LOL.

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
Sign in to follow this  
Followers 0