Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Multiple cloned USPS modules?

Multiple cloned USPS modules?

Locked

Views: 983

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
5 Jan 2010, 6:15 AM
#1
swingandmiss avatar

swingandmiss

Zen Follower

Join Date:
Apr 2007
Posts:
138
Plugin Contributions:
0

Multiple cloned USPS modules?

I'd like to create a USPS shipping module for each USPS service (don't ask why...3rd party software restriction). I thought it was possible to copy the usps.php file to something like usps_priority.php and place it in the /includes/modules/shipping directory, but that doesn't seem to be working. I'm getting a few errors. One error is about not being able to redeclare the class, so I'm assuming I can rename it. The other is about missing english files, so I'm thinking I can copy those as well. Am I missing something? Is this possible?

5 Jan 2010, 6:20 AM
#2
swingandmiss avatar

swingandmiss

Zen Follower

Join Date:
Apr 2007
Posts:
138
Plugin Contributions:
0

Re: Multiple cloned USPS modules?

Well, doing the rename partially worked. No more errors in the admin shipping module section, but it's coming up without any description or module name and a red dot. So something isn't working.

6 Jan 2010, 3:45 PM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Multiple cloned USPS modules?

It's necessary, but insufficient, to simply create a copy of the usps.php file. You also need to change the names of the fields associated with the module.

For example, if your usps clone is usps_priority, you'd edit \includes\modules\shipping\usps_priority.php and \includes\english\modules\shipping\usps_priority.php and change all occurrences of USPS to USPS_PRIORITY.

6 Jan 2010, 4:47 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Multiple cloned USPS modules?

Be careful on the use of the underscore ...

For example, cloning Flat you would NOT use:
flat_us FLAT_US
flat_priority FLAT_PRIORITY

you would use:
flatus FLATUS
flatpriority FLATPRIORITY

On the clone of USPS be careful on global variables so they do not get mixed up with one another as the modules run ...