Jump to content
Sign in to follow this  
olsonsp4c

USPS Priority Mail Flat Rate Shipping

Recommended Posts

Installed this and it works great... No buts!

 

Thank you. Just what I was looking for!

 

Frank

Share this post


Link to post
Share on other sites
Anyone know how to get this to work when you have Order Editor installed? I am getting a error message when i try and edit a order

 

Hmmm...I don't get an error message - I get a blank screen when trying to edit in Order Editor. I've also lost the ability to edit the USPS Flat Rate settings after installing order editor.

 

Can you edit all your module settings?

 

Andy

Share this post


Link to post
Share on other sites

This contribution worked out great for me and the install worked without any problems. I did as I always do with the first two steps, that is, backup, and then make sure the backup is good.

 

Here's my problem. I got gutsy and daring so I decided to alter the desctiptions of the shipping methods so they would say first class, priority, express international, instead of the envelope, small box, regular box, etc.... and so on. Well that didn't work out too well so I retreated and decided to just stick with the provided code. I replaced the two php files in their proper place. I also uninstalled the module.

 

I went back into admin to install the module but when I click on the install button, nothing happens. There is no confirmation that the new shipping module is installed. I'm assuming its not becuase the install button is still there after I click on it. I checked the database to see if there is something left over from the first install but nothing. I checked all the modified files to see if they still existed but I've replaced the modified files with their original version before the modification.

 

I' ve been racking my brain for the past 3 hours and don't understand what the hell is going on. It worked fine when I first installed and it should work fine after the original files were restored. Am I missing something with the uninstall and reinstall?

Share this post


Link to post
Share on other sites

Omg....an error has occurred!

This is the message I am getting:

Parse error: syntax error, unexpected '>' in /home/petzones/public_html/includes/modules/shipping/usps.php on line 111

What do I do now?? I copy/pasted and backed up the original USPS module that was already on the site, tryed to edit it, didn't work out, so I pasted back the original coding and now I am still getting this error! It shows that error when I am in the admin - module - shipping section and even when I try to check-out my shopping cart it shows the same error on a blank page.

 

What to do, please help folks!

Share this post


Link to post
Share on other sites
Parse error: syntax error, unexpected '>' in /home/petzones/public_html/includes/modules/shipping/usps.php on line 111
What's on line 111 of usps.php? Preferably with some context (say lines 100-115).

Always backup before making changes.

Share this post


Link to post
Share on other sites

The module states that it can handle multiple boxes/envelopes.

 

When I put in an order that uses multiple boxes, though, it doesn't work. There are no options presented under the shipping method. Clicking on the continue button just cycles back to the same page instead of continuing with the checkout process.

 

The patch notes for 1.1 state: "* Added the ability to quote the correct amount if multiple shipping boxes are to be shipped for 1 order".

 

Any ideas?

Share this post


Link to post
Share on other sites

Ok, I figured that out. I had to use the OSCommerce core configuration to set a low enough maximum package weight and zero out the Tare weight.

 

New problems, then: It's pretty unintelligent about which boxes it selects.

 

Using boxes and envelopes, I'd like it to select the big boxes for most of the order, then use envelopes for the little bit left over. Is there any way to do that?

 

Also, I don't want to give the customer a choice of which boxes and envelopes to use. I just want it to tell the customer what he'll be getting and what the price will be. Any way to do that?

Share this post


Link to post
Share on other sites

i dont know if this has been answered, but i want to have it so that each item is linked to 1 box type.

 

So if they order 3 items, it will look like this:

 

3 itemes (each a differnt size) + Shipping [(2 Priority Mail® Regular/Medium Flat-Rate Boxes * 9.85) + (1 Priority Mail® Small Flat-Rate Box * 4.80)] = Total Cost

Share this post


Link to post
Share on other sites

After installing per the download instructions, I see the module in the Shipping admin and when I try and edit the module in the osc admin, I get this error message:

 

Fatal error: Call to undefined function tep_cfg_multiinput_duallist_lb() in /home/creation/public_html/_aa/osc/admin/modules.php(213) : eval()'d code on line 1

 

What did I miss? Thanks.

Share this post


Link to post
Share on other sites

My business ships stuff in both flat rate envelopes and flat rate medium boxes.

 

When there's an order that will fit in an envelope, the module also gives the option to ship it in the (much more expensive) medium box.

 

That's silly. I just want it to show the envelope, which is the cheaper option. Show me the box for bigger orders only, please.

 

How do I make it do that?

Share this post


Link to post
Share on other sites

After installing per the download instructions, I see the module in the Shipping admin and when I try and edit the module in the osc admin, I get this error message:

 

Fatal error: Call to undefined function tep_cfg_multiinput_duallist_lb() in /home/creation/public_html/_aa/osc/admin/modules.php(213) : eval()'d code on line 1

 

What did I miss? Thanks.

 

any luck on this problem? I am getting the exact same one. any help would be great. I am fairly new to the OS Commerce package from a back end standpoint. I can't figure this one out as I do not know a whole lot about PHP programming.

Share this post


Link to post
Share on other sites

any luck on this problem? I am getting the exact same one. any help would be great. I am fairly new to the OS Commerce package from a back end standpoint. I can't figure this one out as I do not know a whole lot about PHP programming.

you have to edit the .php files it talks about in the istallation txt. it is not real clear but I had the same problem.

 

First one is

 

In catalog/includes/functions/general.php

 

Find this:

 

////

// Wrapper function for round()

function tep_round($number, $precision) {

if (strpos($number, '.') && (strlen(substr($number, strpos($number, '.')+1)) > $precision)) {

$number = substr($number, 0, strpos($number, '.') + 1 + $precision + 1);

 

if (substr($number, -1) >= 5) {

if ($precision > 1) {

$number = substr($number, 0, -1) + ('0.' . str_repeat(0, $precision-1) . '1');

} elseif ($precision == 1) {

$number = substr($number, 0, -1) + 0.1;

} else {

$number = substr($number, 0, -1) + 1;

}

} else {

$number = substr($number, 0, -1);

}

}

 

return $number;

}

 

Insert this AFTER: the below has to be inserted directly after the"}" above.

 

////

// USPS Priority Mail Flat Rate Shipping

// Round up function for non whole numbers

// The value for the precision variable determines how many digits after the decimal and rounds the last digit up to the next value

// Precision = 0 -> xx.xxxx = x+

// Precision = 1 -> xx.xxxx = xx.+

// Precision = 2 -> xx.xxxx = xx.x+

function tep_round_up($number, $precision) {

$number_whole = '';

$num_left_dec = 0;

$num_right_dec = 0;

$num_digits = strlen($number);

$number_out = '';

$i = 0;

while ($i + 1 <= strlen($number))

{

$current_digit = substr($number, $i, ($i + 1) - $num_digits);

if ($current_digit == '.') {

$i = $num_digits + 1;

$num_left_dec = strlen($number_whole);

$num_right_dec = ($num_left_dec + 1) - $num_digits;

} else {

$number_whole = $number_whole . $current_digit;

$i = $i + 1;

}

}

if ($num_digits > 3 && $precision < ($num_digits - $num_left_dec - 1) && $precision >= 0) {

$i = $precision;

$addable = 1;

while ($i > 0) {

$addable = $addable * .1;

$i = $i - 1;

}

$number_out = substr($number, 0, $num_right_dec + $precision) + $addable;

} else {

$number_out = $number;

}

return $number_out;

}

 

second one is

 

In catalog/admin/includes/functions/general.php

 

Find this:

 

////

// Alias function for module configuration keys

function tep_mod_select_option($select_array, $key_name, $key_value) {

reset($select_array);

while (list($key, $value) = each($select_array)) {

if (is_int($key)) $key = $value;

$string .= '<br><input type="radio" name="configuration[' . $key_name . ']" value="' . $key . '"';

if ($key_value == $key) $string .= ' CHECKED';

$string .= '> ' . $value;

}

 

return $string;

}

 

Insert this AFTER: all of the below has to be inserted on the line below the "}"

 

////

// USPS Priority Mail Flat Rate Shipping

// Alias function for Store configuration values in the Administration Tool

function tep_cfg_select_multioption($select_array, $key_value, $key = '') {

for ($i=0; $i<sizeof($select_array); $i++) {

$name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value');

$string .= '<br><input type="checkbox" name="' . $name . '" value="' . $select_array[$i] . '"';

$key_values = explode( ", ", $key_value);

if ( in_array($select_array[$i], $key_values) ) $string .= ' CHECKED';

$string .= '> ' . $select_array[$i];

}

$string .= '<input type="hidden" name="' . $name . '" value="--none--">';

return $string;

}

 

// USPS Priority Mail Flat Rate Shipping

// Alias function for Store configuration values in the Administration Tool.

// Creates multiple text input boxes in a list.

// Remember to add blank default values: 1, 2, , , 5, 6, ...

function tep_cfg_multiinput_list($select_array, $key_value, $key = '') {

$key_values = explode( ", ", $key_value);

 

for ($i=0; $i<sizeof($select_array); $i++) {

$name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value');

$string .= '<br><input type="text" name="' . $name . '" value="' . $key_values[$i] . '"> ' . $select_array[$i];

}

$string .= '<input type="hidden" name="' . $name . '" value="--none--">';

return $string;

}

 

////

// USPS Priority Mail Flat Rate Shipping

// Alias function for Store configuration values in the Administration Tool.

// Creates a text input box on either side of the option, adds <= OPTION <= and makes a list.

// Remember to add blank default values: 1, 2, , , 5, 6, ...

function tep_cfg_multiinput_duallist_oz($select_array, $key_value, $key = '') {

$key_values = explode( ", ", $key_value);

$string .= '<center>';

 

for ($i=0; $i<sizeof($select_array); $i++) {

$current_key_value = current($key_values);

 

$name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value');

$string .= '<br><input type="text" name="' . $name . '" size="3" value="' . $current_key_value . '"><i>oz</i>';

$string .= ' <b><</b> ' . $select_array[$i] . ' <u><b><</b></u>';

next($key_values);

$current_key_value = current($key_values);

$string .= '<input type="text" name="' . $name . '" size="3" value="' . $current_key_value . '"><i>oz</i>';

next($key_values);

}

$string .= '<input type="hidden" name="' . $name . '" value="--none--">';

 

$string .= '</center>';

return $string;

}

function tep_cfg_multiinput_duallist_lb($select_array, $key_value, $key = '') {

$key_values = explode( ", ", $key_value);

$string .= '<center>';

 

for ($i=0; $i<sizeof($select_array); $i++) {

$current_key_value = current($key_values);

 

$name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value');

$string .= '<br><input type="text" name="' . $name . '" size="3" value="' . $current_key_value . '"><i>lbs</i>';

$string .= ' <b><</b> ' . $select_array[$i] . ' <u><b><</b></u>';

next($key_values);

$current_key_value = current($key_values);

$string .= '<input type="text" name="' . $name . '" size="3" value="' . $current_key_value . '"><i>lbs</i>';

next($key_values);

}

$string .= '<input type="hidden" name="' . $name . '" value="--none--">';

 

$string .= '</center>';

return $string;

}

 

third one is kind of tricky

 

In catalog/admin/modules.php

 

Find this:

 

if (tep_not_null($action)) {

switch ($action) {

case 'save':

while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) {

 

Insert this AFTER: put this in the line just under the above

 

// BOE: USPS Priority Mail Flat Rate Shipping

if( is_array( $value ) ){

$value = implode( ", ", $value);YOU WILL FIND THESE FOUR LINES ALREADY EXIST, CUT THEM BEFORE INSERTING

$value = ereg_replace (", --none--", "", $value);

}

// EOE: USPS Priority Mail Flat Rate Shipping

 

It should now look like this:

 

if (tep_not_null($action)) {

switch ($action) {

case 'save':

while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) {

// BOE: USPS Priority Mail Flat Rate Shipping

if( is_array( $value ) ){

$value = implode( ", ", $value);

$value = ereg_replace (", --none--", "", $value);

}

// EOE: USPS Priority Mail Flat Rate Shipping

tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $value . "' where configuration_key = '" . $key . "'");

}

tep_redirect(tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module']));

break;

case 'install':

 

 

 

hope this helps this is what i did to make it work

Share this post


Link to post
Share on other sites

Here is a question for anyone who can answer it. I am sure its probably a simple answer too. Is there a way to set it so that certain products that are in my stores will not be able to ship in certain size flat rate boxes due to size and what not? How do I force larger orders that won't obviously fit in to smaller flat rate boxes not allow them to select the smaller box still for shipping? Is there a way to do this? Thanks in advance!

Share this post


Link to post
Share on other sites

I've installed the latest versions of both USPS Methods and the Priority Mail Flat. Both appear to be installed properly. I can activate each one in the admin panel, but when I hit EDIT... I get this error:

 

Fatal error: Call to undefined function tep_cfg_multiinput_list() in /home/(mydirectory)/public_html/admin/modules.php(214) : eval()'d code on line 1

 

Not sure what I'm missing... thoughts?

Share this post


Link to post
Share on other sites

I've installed the latest versions of both USPS Methods and the Priority Mail Flat. Both appear to be installed properly. I can activate each one in the admin panel, but when I hit EDIT... I get this error:

 

Fatal error: Call to undefined function tep_cfg_multiinput_list() in /home/(mydirectory)/public_html/admin/modules.php(214) : eval()'d code on line 1

 

Not sure what I'm missing... thoughts?

 

Nevermind. Got it working... Thx!

Share this post


Link to post
Share on other sites

Hello,

 

Added this module. Everything seems to work with one exception. Ordering a quantity 1 gives me a shipping price (e.g. $10) and USPS size. If I select a quantity for 2, 3, 4, etc. of the product it still gives me the shipping price for a quantity of 1.

 

Thanks.

 

Update: I think I see what is going on. I've adjusted weights to try to "fit" my products in the different size envelop/boxes. Unfortunately, my example product "fits" into a large box - if I order quantity 2 (or 3 or 4) the weight doesn't matter. Its the size that is important. I can fit 1 item into a large box, can't fit 2 or more - weight isn't the issue.

 

Anybody have an idea of how to remedy or a shipping solution for USPS Priority Flat Rate shipping that works on size and not weight?

 

Thanks again.

Edited by babakt

Share this post


Link to post
Share on other sites

Any way to change the pricing output?

 

Priority Large box is now $14.50 for USA and $10.70 for medium.

Edited by beanzy

Share this post


Link to post
Share on other sites

Also

 

Free items are directed to PayPal, then return to the checkout_confirmation.php.

After installing this mod, the confirmation page shows USPS shipping charge.

 

I clicked on the edit shipping button and then back to the confirmation page

and the shipping disappeared. Very strange and bothersome because if the customer

doesn't know to click the edit shipping button and then back, they will get charged

for shipping on a free ship item.

 

Any ideas on this?

Share this post


Link to post
Share on other sites

Any way to change the pricing output?

 

Priority Large box is now $14.50 for USA and $10.70 for medium.

 

 

Never mind, found it. Is in the admin configuration section... Too cool

Share this post


Link to post
Share on other sites

Hi there,

I've recently added this module into my shopping cart and it appears to be working, and shows in the shipping selections. When click on the continue button, it appears to refresh instead of moving to the next shipping step. What should I do?

Thanks

Steff

Share this post


Link to post
Share on other sites

Having the same problem as steffanih. It gets stuck at the checkout_shipping page. But only if usps in enabled.

Any advice?

Share this post


Link to post
Share on other sites

Ok :)

I guess - Me an steffanih just posed this in the wrong topic.

This was about the integrated usps module - Not the flat rate usps module.

 

@ steffanih: Creating a normal usps accountis not enough.

YOu have to call them ask for an API username and password.

They will then send you that in an email confirmation with a NEW username and password

 

But with that you are not done: After that you will call them on more time and ask them to move your API account to their production server.

Share this post


Link to post
Share on other sites

I have it installed, but when I go to edit, I get the following

 

Fatal error: Call to undefined function tep_cfg_multiinput_duallist_lb() in /data/(my directories)/admin/modules.php(212) : eval()'d code on line 1

 

Ideas?

 

Thanks

 

Dan

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  

×