Kryptronic Software Support Forum

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.

#1 09-17-2002 00:13:07

craigelliott
Member
Registered: 06-24-2002
Posts: 45

Two questions about shipping

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

 

#2 09-17-2002 09:20:27

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Two questions about shipping

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.


Nick Hendler

Offline

 

#3 09-17-2002 09:21:16

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Two questions about shipping

Just realized that the fourm deleted the bracketed code behind the push - make sure you include @return_servicedet in brackets in the push. 


Nick Hendler

Offline

 

#4 09-19-2002 21:04:12

craigelliott
Member
Registered: 06-24-2002
Posts: 45

Re: Two questions about shipping

<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

 

#5 09-20-2002 07:55:42

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Two questions about shipping

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.


Nick Hendler

Offline

 

#6 09-26-2002 23:08:08

Guest
Guest

Re: Two questions about shipping

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.

 

#7 09-27-2002 06:08:03

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Two questions about shipping

Just use the names that are displayed back to you and do not trail them with a colon or price.


Nick Hendler

Offline

 

#8 04-12-2003 19:42:39

thekiko
Member
Registered: 07-11-2002
Posts: 126

Re: Two questions about shipping

Got another one for ya. smile

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?


TheKiko

Offline

 

#9 04-14-2003 13:56:59

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Two questions about shipping

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.


Nick Hendler

Offline

 

#10 10-21-2004 11:38:43

edward
Member
Registered: 03-13-2003
Posts: 121

Re: Two questions about shipping

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

 

#11 10-27-2004 09:54:58

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Two questions about shipping

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:

Code:


#########
######### 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. 


Nick Hendler

Offline

 

#12 10-27-2004 21:33:34

edward
Member
Registered: 03-13-2003
Posts: 121

Re: Two questions about shipping

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...

Code:

#########
######### 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...

Code:

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

 

#13 11-02-2004 17:27:14

edward
Member
Registered: 03-13-2003
Posts: 121

Re: Two questions about shipping

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

 

#14 11-11-2004 16:21:07

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Two questions about shipping

Instead of using $tracking_total in the if statement, change that to $main::tracking_total.


Nick Hendler

Offline

 

#15 11-12-2004 12:34:40

edward
Member
Registered: 03-13-2003
Posts: 121

Re: Two questions about shipping

Thanks again Nick!

- Edward

Offline

 

#16 11-12-2004 13:10:33

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Two questions about shipping

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;).


Nick Hendler

Offline

 

Board footer