Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

canada.post.rest.rate.service.oscommerce.V2.3


imageanative

Recommended Posts

On 2018-01-19 at 8:32 AM, luvubeauty said:

I am having issues with the Small Packet Air showing up in the shipping quotes when someone goes to checkout.  I do have insurance turned off and CP tech support is useless, so here I am.  I saw that there were the same issues, but I tried the suggested and still didn't work.  Any other suggestions? 

Why not just “dis-allow” the service in the modules configuration?

 

(side note: I believe the insurance issue was related to the Tracked Package service)

Link to comment
Share on other sites

On 1/21/2018 at 8:05 AM, greasemonkey said:

Why not just “dis-allow” the service in the modules configuration?

 

(side note: I believe the insurance issue was related to the Tracked Package service)

The small packet is extremely cheaper than tracked package and am positive I am loosing sales because the shipping to the US is so high (tracked package is $25 and small packet is $9).  When it is calling for quotes, it just isn't returning a quote for Small Packet, all other options are available.

Link to comment
Share on other sites

51 minutes ago, luvubeauty said:

Yes, correct.  I have the weight all under 1kg, I tried with a few different items (individually) and each weigh under a lbs.  

in includes/modules/shipping/canadapost.php

Find

	return $xmlRequest;

And just above "as a test" add

	echo $weight;

What is the weight printed to the screen?

Link to comment
Share on other sites

36 minutes ago, luvubeauty said:

It's showing as 1.364  Not sure why because I have the weight at zero, then I changed it to .1 and it is still showing the same.  Sooo...somewhere down the line it isn't allowing for the weight change?

Yes, small packet air will not show with a weight of 1.364....  (has a max of 1.0 kg - see below note about lbs/kg)

Double check in your admin -> Configurations -> Shipping/Packaging -> Package Tare Weight.... Should be blank or 0.

36 minutes ago, luvubeauty said:

However, it is set for lbs, not kg so it still should be ok? It does change the weight when I go higher, just not lower and it does convert when I change it to KG instead of LBS

If I recall the lbs/kg config in the current version did not work (and cannot work - as Canada Post only accepts kg... so no matter the number sent CP see's it as kg).

I had been working on a new version to fix a bunch of other bugs where I have removed lbs as an option.

Please confirm (once you have checked the tare weight): edit one product from your store to a weight of 1 - then add that same item to your cart (so it is the only item in your cart) and navigate to checkout_shipping.php.

What number shows when you "echo" the weight (still 1.364)?

Triple check by changing config in shipping module from lbs to kg.

Link to comment
Share on other sites

  • 5 weeks later...
On 7/5/2014 at 6:24 AM, RS Designs said:

Hello,

I am also getting the same error as "simple190"

 

 

It is happening in the checkout when try to show sipping options.

 

Also is there any way to make it print out the error code it is getting?

 

I am running this on Version: 2.3.3.4

 

Thanks,

I can fix it

Link to comment
Share on other sites

  • 1 year later...

Yeah, I'll do that.

I'm just playing with Phoenix in (what little) spare time I have.
I haven't decided if it's going to be worth the trouble, but, I suppose this will be a good first test....

No Good Deed EVER Goes Unpunished

Link to comment
Share on other sites

  • 4 weeks later...

Well, I'm in Hamilton, and I was one of the people that helped keep this going, way back when. but 2.2 is a long time ago.

You might be better upgrading your database through a number of versions (there are scripts) to something like 2.3.3.4 BS reactive and install GreaseMonkey's latest iteration.

That's what I'm running on my shop and I started with 2.2 and cranked it up through the versions just as I mentioned above.

No Good Deed EVER Goes Unpunished

Link to comment
Share on other sites

Working on updating this for Phoenix - and I'm having one issue (which I believe I've confused with a similar issue on the UPS XML thread)

Thank you @azpro and @ecartz for your help... and sorry if I caused any additional confusion...

The issue I'm having is when "disallowing" a shipping service I'm receiving the following error:

Quote

Warning: constant(): Couldn't find constant CANADA_POST_Array in /home/********/public_html/*********/includes/modules/shipping/canadapost.php on line 452

Disallow array is built here:

        tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Disallowed Shipping Methods', 'MODULE_SHIPPING_CANADA_POST_TYPES', '', 'Select the Canada Post services <span style=\'color: red; font-weight: bold\'>not</span> to be offered.', '6', '12', 'get_multioption_canadapost_xml',  'canadapost_cfg_select_multioption(array(\'D.RP\',\'D.EP\',\'D.XP\',\'D.XP.CERT\',\'D.PC\',\'D.LIB\',\'U.EP\',\'U.PW.ENV\',\'U.PW.PAK\',\'U.PW.PARCEL\',\'U.SP.AIR\',\'U.SP.SURF\',\'U.XP\',\'I.XP\',\'I.IP.AIR\',\'I.IP.SURF\',\'I.PW.ENV\', \'I.PW.PAK\',\'I.PW.PARCEL\',\'I.SP.AIR\',\'I.SP.SURF\'),',  now())");

With this function:

function canadapost_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="checked"';
	  $string .= '> ' . constant('CANADA_POST_' . get_canada_post_service_code($select_array[$i]));
	} 
	$string .= '<input type="hidden" name="' . $name . '" value="--none--">';
	return $string;
}	

It would seem the result of the function = Array ... Inputting "Array" into the DB as the "disallowed" service (in place of the service code) .... hence why it cannot find the constant....

As a test, I can manually remove Array from the DB and replace it with any (multiple service codes) and it works perfectly.

I have no issues on Gold, Edge/Frozen...

I've attached a screen cap....

canadapost.jpg

Link to comment
Share on other sites

So coders, assuming I'm correct (in my testing I am...lol).

How do we take the add to admin/modules.php

		  if (is_array($value) ) {
             $value = implode( ", ", $value);
		     $value = preg_replace ("/, --none--/", "", $value);
		  }

And incorporate it with the the actual shipping modules set function (in my very limited skill - the set function is building an array, which when saved, modules.php with the additional code above, is imploding the or replacing (???) the array before inserting into the configuration value)

  function upsxml_cfg_select_multioption($select_array, $key_value, $key = '') {
    $string = '';
    $key_values = explode( ", ", $key_value);
    for ($i=0, $n=sizeof($select_array); $i<$n; $i++) {
      $name = ((tep_not_null($key)) ? 'configuration[' . $key . '][]' : 'configuration_value');
      $string .= '<br /><input type="checkbox" name="' . $name . '" value="' . $select_array[$i] . '"';
      if (in_array($select_array[$i], $key_values)) $string .= ' CHECKED';
      $string .= '> ' . $select_array[$i];
    }
    return $string;
  }

Sorry for the cross post mods.... I was trying to keep this in one place but messed up....

 

Link to comment
Share on other sites

What the set_function does is it creates the form input that you use to edit it.  In this case, a bunch of checkboxes.  That is then saved in admin/modules.php .  It's the save case towards the top of the file.  Try changing it to look like

      case 'save':
        foreach ($_POST['configuration'] as $key => $value) {
          if (isset($value) && is_array($value)) {
            implode(', ', $value);
            $value = str_replace(', --none--', '', $value);
          }

          tep_db_query("update configuration set configuration_value = '" . tep_db_input(tep_db_prepare_input($value)) . "' where configuration_key = '" . tep_db_input(tep_db_prepare_input($key)) . "'");
        }
        tep_redirect(tep_href_link('modules.php', 'set=' . $set . '&module=' . $_GET['module']));
        break;
      case 'install':
      case 'remove':

Expect this to change in a future version of Phoenix. 

Sorry, I was getting distracted by the fact that this section of code has not significantly changed in a long time.  If the problem is that other Apps were changing admin/modules.php to add this code, then that makes a lot more sense. 

Edited by ecartz

Always back up before making changes.

Link to comment
Share on other sites

  • 1 year later...

@greasemonkey I'm having the same problem with the CanadaPost module not accepting the disallowed services, and storing 'array' in the DB instead.... I don't mind entering the disallowed services into the DB manually (unless there's an easy fix) but I can't figure out the proper format for the multiple choices. Specifically I entered those 2 services I need to disallow:

I.IP.SURF, I.SP.SURF

But when I look at the web interface it only seems to recognize Small Packet International Surface and not I.I P.SURF as "International Parcel Surface". Maybe it's not the format but the code... Is there a different code for that service now?

Cheers!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...