You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
A while back I edited a file to add $1.00 onto the realtime USPS shipping... I want to change it to $2.00 but I can't remember the file I edited. Any idea?
Also, how can I control which international shipping methods are displayed by USPS?
Craig Elliott
Offline
You probably made that edit in ./cgi-bin/library/modules/ste_chkout.pl. You could make the limitation edit in the same file, or you may find it easier to edit the USPS perl module directly. That module is file ./cgi-bin/modules/Business/USPS.pm.
Your edit would be in the routine 'handleconnectint'. Look for the lines:
###
@return_servicedet = ($return_service,$return_postage);
push(@return_service,<@return_servicedet>);
###
And change to:
###
if ($return_service ne "XXX" && $return_service ne "YYY") {
@return_servicedet = ($return_service,$return_postage);
push(@return_service,<@return_servicedet>);
} ######### End of if statement.
###
Change the XXX, YYY, ZZZ to the service names you wish to exclude.
Offline
<font size="1" color="#FF0000">LAST EDITED ON 09-19-02 AT 10:04 PM (EST)</font><p>How come I can't list the entries I don't want to see in the "USPS - US to non-US" section of "Update Realtime Shipping Method"... like it's done for the US to US shipping options.
Craig Elliott
Offline
Because USPS's foreign method is set up so that they send the program available services - they are never requested from the script. It's a little weird how they've done it that way, but that's how their whole international setup is done.
Offline
I have tried to make the edit you suggested in USPS.pm and nothing seems to change. Below is my modified code. Was I naming the services incorrectly?
Thanks, for this and all the other help you've given me.
alison
#########
######### Get information from the Postage node.
#########
$reply_contents =~ s/<Postage>(.*?)</Postage>//gs;
$return_postage = "$1";
if ($return_service ne "Global Priority Mail - Flat-rate Envelope (small):5.00" && $return_postage ne "Economy (Surface) Letter Post:7.50") {
@return_servicedet = ($return_service,$return_postage);
push(@return_service,<@return_servicedet>);
} ######### End of if statement.
} ######### End of while statement.
Got another one for ya.
Is there a way to add a label to a service postage? The dilemma is that when a customer orders 4 shirts the weight is light enough to qualify for:
Global Priority Mail - Flat-rate Envelope (large) - $9.00
Global Priority Mail - Variable Weight Envelope (single) - $18.00
Now there is no way to stuff four 6-ounce cotton shirts into a flat rate envelope so we need customers to select the "variable weight envelope" option.
My idea is to add a small text label to the end of the flat rate service name like this:
Global Priority Mail - Flat-rate Envelope (large) - $9.00 --TWO items or less--
Is this possible?
Offline
That would be done like this:
Right behind:
###
if ($return_service ne "Global Priority Mail - Flat-rate Envelope (small)" && $return_postage ne "Economy (Surface) Letter Post") {
###
add:
###
if ($return_service eq "Global Priority Mail - Flat-rate Envelope (large)") {
$return_service .= " TWO items or less";
} ######### End of if statement.
###
___________________________
Nick Hendler
Webmaster, Kryptronic, Inc.
Offline
Hello Nick,
I've been making some changes to our business and recently switched over from UPS to USPS on all shipments. Also started shipping international.
I wanted to limit what options customers had for international shipping, and found this thread while reading in the archives and implemented the changes. Worked great.... archives sure are a great thing!
Now I'd like to fine tune things a little further....
I'd like to have some sort of IF/THEN that is based on order value. For example, I'd like to do something like:
IF order total (products only) less than or equal to $50, THEN offer BOTH Global Priority - Variable Weight AND Global Express Mail (EMS).
IF order total greater than $50, THEN offer ONLY Global Express Mail (EMS).
Reason for this is because for lower value shipments, I'm willing to risk shipping international without tracking ability. There is no tracking available for Global Priority. However, for higher dollar orders, I want the ability to track and verify delivery, and so that's why I'd like to only offer Global Express Mail for these shipments.
I figured it would probably be 1 or 2 lines of code to add, but I'm not sure how to do this properly since I am "programming challenged".
Global Priority is only good for 4 lbs or less, but I expect that this IF/THEN logic is already embedded in the Postal Service routine that returns the options to CCP.
Thanks again Nick! You offer outstanding support for CCP! Not sure how you keep up with it all... you must be very busy at times!
Edward
Offline
What you're really asking to do is to exclude 'Global Priority - Variable Weight' if the order is over $50.00. This is done like so:
######### ######### Get information from the Postage node. ######### $reply_contents =~ s/<Postage>(.*?)<\/Postage>//gs; $return_postage = "$1"; if ($return_service ne "Global Priority Mail - Flat-rate Envelope (small)" && $return_postage ne "Economy (Surface) Letter Post") { if ($return_service eq "Global Priority Mail - Flat-rate Envelope (large)") { $return_service .= " TWO items or less"; } ######### End of if statement. if ($tracking_total >= "50" && $return_service ne "Global Priority - Variable Weight") { @return_servicedet = ($return_service,$return_postage); push(@return_service,<@return_servicedet>); } else { @return_servicedet = ($return_service,$return_postage); push(@return_service,<@return_servicedet>); } ######### End of if statement. } ######### End of if statement. } ######### End of while statement.
Offline
Thanks Nick. I made some code changes but came up with a Script Execution error. Here's what the code looked like when the error appeared...
######### ######### Get information from the Postage node. ######### $reply_contents =~ s/<Postage>(.*?)<\/Postage>//gs; $return_postage = "$1"; if ($return_service ne "Economy (Surface) Letter-post" && $return_service ne "Airmail Letter-post" && $return_service ne "Global Priority Mail - Flat-rate Envelope (Small)" && $return_service ne "Global Priority Mail - Flat-rate Envelope (Large)" && $return_service ne "Global Express Guaranteed Non-Document Service" && $return_service ne "Global Express Guaranteed Document Service" && $return_service ne "Economy (Surface) Parcel Post" && $return_service ne "Airmail Parcel Post") { if ($return_service eq "Global Express Mail (EMS)") { $return_service .= " 3-5 business days"; } ######### End of if statement. if ($return_service eq "Global Priority Mail - Variable Weight Envelope (Single)") { $return_service .= " 5-7 business days"; } ######### End of if statement. if ($tracking_total >= "50" && $return_service ne "Global Priority Mail - Variable Weight Envelope (Single)") { @return_servicedet = ($return_service,$return_postage); push(@return_service,<@return_servicedet>); } else { @return_servicedet = ($return_service,$return_postage); push(@return_service,[@return_servicedet]); } ######### End of if statement. } ######### End of if statement. } ######### End of while statement.
I did add the following code at the same time, but later removed it to see if that affected the Script Excecution Error, but it didn't make a difference...
if ($return_service eq "Global Priority Mail - Variable Weight Envelope (Single)") { $return_service .= " 5-7 business days"; } ######### End of if statement.
Any ideas of where I might have went wrong?
Appreciate your help,
Edward
Offline
Nick, Just for reference, here the exact Script Execution Error that came up when I made the code change in the USPS.pm module...
Script Execution Error
The following error was just encountered:
Global symbol "$tracking_total" requires explicit package name at /home/extreme/public_html/cgi-bin/ccp5/modules/Business/USPS.pm line 334. BEGIN not safe after errors--compilation aborted at /home/extreme/public_html/cgi-bin/ccp5/modules/Business/USPS.pm line 338. Compilation failed in require at /home/extreme/public_html/cgi-bin/ccp5/library/modules/ste_chkout.pl line 1886. BEGIN failed--compilation aborted at /home/extreme/public_html/cgi-bin/ccp5/library/modules/ste_chkout.pl line 1886.
Thanks,
Edward
Offline
Thanks again Nick!
- Edward
Offline
No problem. Sorry - I forgot USPS.pm was written using the strict pragma, so we needed the full package name there for the global variable (or we needed to remove use strict;).
Offline