Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


imageanative

Recommended Posts

The PHP strtotime() function will convert most time/date strings to a timestamp. You can then add the desired amount of time (in seconds) and convert the result back to a string using date(). If strtotime doesn't work you'll probably need a messy regex to parse the date, so try that first.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I now have the handling fee fix.

 

I also noticed and corrected the way rates are where being received - the original author had set to receive the rate including taxes (due) - when they are typically added by the store owner using a Tax Class.

 

Rates are now received without taxes (base) - and (as mentioned above) are added by the store owner by setting a tax in the module.

 

One more issue found and fixed... The service exclusions was not working on USA or INT quotes.

 

I'll keep testing and then upload a new module

Link to comment
Share on other sites

Added new package here; http://addons.oscommerce.com/info/8887

 

Now labeled v1.1

Tested on 2.3.4 Responsive Gold

1) Fixed service exclusions config - was not working on USA or INT quotes.

2) Corrected the way rates are where being received - the original author had set to receive the rate including taxes (due) - when they are typically added by the store owner using a Tax Class.
Rates are now received without taxes (base) - and (as mentioned above) are added by the store owner by setting a tax in the module.

3) Handling fee for both fixed and percent fixed

4) Removed duplicate $this->title

5) Added shipping zone config.

6) Added expected delivery date and a Enter Turn Around Time Config.

Full Package

To update "remove" old module in admin (be sure to write down your; Canada Post Customer Number, Canada Post API Username, Canada Post API Password, Canada Post Contract ID - they WILL be removed when the module is removed). Then replace includes/modules/shipping/canadapost.php and re-install.

Link to comment
Share on other sites

Great work! Much appreciated!!

 

Like many I've found that CP has broken sellonline, and it appears to be something related to port 30000 - I was chatting with tech support today and they said a number of clients were all saying much the same thing, so sellonline should be fixed soon - I hope.

 

That said I have to confess that I am not a fan of the packaging addition as it doesn't sound anywhere near as good as the one found on sellonline, but until CP fixes that interface I shall see what happens with your latest REST version.

 

I am running osCmax 2.5.4, but the changes are usually minor to get contributions for osCommerce to work properly.

Link to comment
Share on other sites

@@Pinball I'm using this without the dimensional support (I have almost a 3000 sku's.... Rather impossible as far as I can tell to use box sizing when ppl purchase any combination of those sku's)

 

That said, it installs just fin without the additional sql to support dimensional. Just install the module as normal and make the changes to admin/modules.php (which I need to figure out why these are needed).

 

Btw, I've found a couple more issues:

 

1) the module disables when you reach 25kg (canada posts max box weight)

 

2) the math (or at least the IF statement) used to convert from lbs and in to kg and cm is wrong

Link to comment
Share on other sites

correction... it was my admin setting for Enter the Maximum Package Weight you will ship. - Set to 50 (kg).

 

This needs to be below this Canada Post limit of 30kg.

 

Hey Scott,

 

Canada post sellonline has been down since saturday for us. They announced they would be down for the weekend but have been down since (it's tuesday now) Our online shipping has been totally busted.

 

I just saw you posted this new version. Is this a coincidence? Do you have it functioning right now? 

 

Thanks,

 

Rob

 

 

EDIT: Sorry I just read the rest of the posts I got anxious and wrote in right away. So do you think that sellonline will be coming back? Or since hte blackout have they moved onto only the REST module?

Edited by sackling
Link to comment
Share on other sites

 

EDIT: Sorry I just read the rest of the posts I got anxious and wrote in right away. So do you think that sellonline will be coming back? Or since hte blackout have they moved onto only the REST module?

 My guess is sellonline will come back - but it will be LOW priority for CP....

 

I`ve switched to this new REST module and its working very well.

 

Upgrade is very simple.... as long as you have API user name and Password (they are different than sellonline).

Link to comment
Share on other sites

 My guess is sellonline will come back - but it will be LOW priority for CP....

 

I`ve switched to this new REST module and its working very well.

 

Upgrade is very simple.... as long as you have API user name and Password (they are different than sellonline).

Yep Still not online. I activated fedex calculator in the mean time even though we ship with canada post, just so that we can get the orders pushed through online.

 

I eventually got this reply from them admitting there might be an issue with sellonline:

 

"We are working hard to get to the bottom of the issue.  We are aware of a technical constraint when using TCP protocol - do you fall into that category?  If so, we're investigating a viable workaround to save customers a few hours of recoding.  Http protocol seems to be working fine."

 

Not sure if that applies. I had to update my server to php5.4 as well as update my oscommerce site to the newest version to comply with the new php. 

 

All of that was due anyways (though I am probably switching to magento within the year),. but it would have been nice to have some warning and not just downtime with no fix.

Link to comment
Share on other sites

Sellonline is back up now. I know that CP still considers sellonline as a moderate priority as I did get a few tech support notices after calling to complain on Monday.

 

I still prefer sellonline as it does the box calculations better than the UPS packages.php module. I am thinking that it might be a way to do the best packaging setup for other programs - in other words, use CPs packing methods, and then take the boxes it selects and run them through REDEX, UPS, etc. to get the closest rates for our customers. Not sure how to implement this, but CP does send back the box(es) needed to ship the items, and I see no reason a sectioncan be added to other shipping modules to use that as the weight and size of the box for getting a quote.

This will only work for Canadians who are registered with sellonline.canadapost.ca, however we are all Cunuks here anyway!

Link to comment
Share on other sites

@@Pinball I'm using this without the dimensional support (I have almost a 3000 sku's.... Rather impossible as far as I can tell to use box sizing when ppl purchase any combination of those sku's)

 

I have about 2500 items in my store and have dimensions for all of them, it just takes time to generate that data. So does your contribution only work by using weight? I thought CP lost a class action lawsuit over that very issue - Volumetric Weight. and they have to change by Oct 30, 2015. Are you finding the quotes accurate though when you just use the weight of the items? If your items are all small that is fine, but mine range from items about 1 cubic cc to things 30 x 20 x 15cm in size, and sellonline handles that very well and figures out the correct box from my posted list.

I may have to install the SOAP or REST process for generating labels unless I can fix the existing contribution that used HTML scripts...I have found a workaround that is very nice for that - at least when I enter it manually after logging in and arriving at the select page.

Edited by Pinball
Link to comment
Share on other sites

@@Pinball

 

I see.

 

What I have done is set the weight for each item at the (approx) dimensional weight.

 

Example a large but light time (example: block of styrofoam) might have a weight of 10kg.

 

So... It's working well as long as the weights are set correctly. Make sense?

 

That said I plan to update my rest labels mod to work with this... when I get time.

Link to comment
Share on other sites

Yes, I understand the logic, however I am not about to recalculate all my weights just yet.

 

Mind you the FedEx Web Services contribution only works from weight and I have to wonder if that (volumetric weight of each item) is the way to go...what I thought would be fun was to use the box as defined by sellonline as the same box for Fedex, however this is getting off topic now...

Link to comment
Share on other sites

  • 11 months later...

I've been having a small problem since installing this module in Osc 2.3.4 BS Gold.

 

It all works in calculating the rates and such and displays them properly, so, that's not a problem.

 

However, since shipping costs are so high now-a-days, I never noticed this until someone needed something shipped by the fastest option and emailed me.

 

It seems that, no matter what option radio dial you check, only the lowest cost one is passed to the purchase summary.

 

It worked fine in MS2.2.

 

Has anyone had this problem or know what the cause is?

 

TIA

No Good Deed EVER Goes Unpunished

Link to comment
Share on other sites

@@Druid6900 this is going to take a little work.

 

For some reason the shipping session is not being set correctly.... no matter what options I choose the id is set in array correctly, but the title and cost are always Expedited - which is ID DOM.EP not DOM.XP as selected.

 

I don't where that could be messed up.... is $_SESSION['shipping'] NOT set?

Array
(
    [id] => canadapost
    [module] => Canada & US Post (1 box(es) to be shipped)
    [tax] => 13
    [methods] => Array
        (
            [0] => Array
                (
                    [id] => DOM.EP
                    [title] => Expedited Parcel, 2016-09-02
                    [cost] => 8.09
                )

            [1] => Array
                (
                    [id] => DOM.XP
                    [title] => Xpresspost, 2016-09-02
                    [cost] => 8.14
                )

        )

)
Array
(
    [id] => canadapost_DOM.XP
    [title] => Canada & US Post (1 box(es) to be shipped) (Expedited Parcel, 2016-09-02)
    [cost] => 8.09
)
Link to comment
Share on other sites

@@Druid6900 ok I found it... Please test.... and confirm and i will update the package.

 

in includes/modules/shipping/canadapost.php

 

Find (at line 242)

                if ($this->exclude_choices($basetype)) continue;

				$_type = $type;

				// changed to make handling percentage based
				if ($this->handling_type == "Percentage") {
					if ($_type) $methods[] = array('id' => $basetype, 'title' => $_type. ', '. $ddate, 'cost' => ((($this->handling_fee * $cost)/100) + $cost));
				} else {
					if ($_type) $methods[] = array('id' => $basetype, 'title' => $_type. ', '. $ddate, 'cost' => ($this->handling_fee + $cost));
				}
            }

and replace with

                if ($this->exclude_choices($basetype)) continue;
				if ( $method == '' || $method == $basetype ) {
				$_type = $type;

				// changed to make handling percentage based
				if ($this->handling_type == "Percentage") {
					if ($_type) $methods[] = array('id' => $basetype, 'title' => $_type. ', '. $ddate, 'cost' => ((($this->handling_fee * $cost)/100) + $cost));
				} else {
					if ($_type) $methods[] = array('id' => $basetype, 'title' => $_type. ', '. $ddate, 'cost' => ($this->handling_fee + $cost));
				}
			  }	
            }
Link to comment
Share on other sites

  • 8 months later...

Anyone have trouble getting some of the rates from Canada Post?

 

I know that over the last little while, CP has dropped some things, like Small Packet US Surface and added other things, like Tracked Packet that aren't in the Define file, but I'm not getting prices for Small Packet Air USA or International which some of my items clearly fall under.

 

I have no idea what's going on because I used to get a price for it and it's killing my small item sales.

No Good Deed EVER Goes Unpunished

Link to comment
Share on other sites

@@Druid6900 I don't use small packet or tracked package to the US any longer.... but on a quick look small package is not returning rates (if I recall tracked package was not an option last I looked at it).

 

I'll see what I can dig up.

 

In the mean while you can always set up a flat rate to the US with a weight restriction.

Link to comment
Share on other sites

Yes, usually I don't either, but, I got some small stuff in and, because expedited works out to 3 times the small packet price, they aren't being bought.

 

There is a canadapost.php file in include\languages\English\modules\shipping directory that defines service and display names, but, I don't know what it defines them for, so, I didn't want to play with it adding or subtracting services in case that's not what it's for.

 

There is a list in the developers area on CP that shows a list of the (fairly) current service tags and the ones that are the same look identical.

 

I'm not a coder though, I can just follow instructions...

 

I don't know how the flat rate thing can be restricted and I would have to pick some price were I got more half the time and less the other half.

Edited by Druid6900

No Good Deed EVER Goes Unpunished

Link to comment
Share on other sites

Here's the list from the developers forum;

 

May occur  1 … 20 times.

A specific service to be rated. If no instances of service-code are included in the request, all services applicable to the shipment and destination will be rated and returned.

 

Code Description

DOM.RP Regular Parcel

DOM.EP Expedited Parcel

DOM.XP Xpresspost

DOM.XP.CERT Xpresspost Certified

DOM.PC Priority

DOM.DT Delivered Tonight

DOM.LIB Library Materials

USA.EP Expedited Parcel

USA USA.PW.ENV Priority Worldwide Envelope

USA USA.PW.PAK Priority Worldwide pak

USA USA.PW.PARCEL Priority Worldwide Parcel USA

USA.SP.AIR Small Packet USA Air

USA.TP Tracked Packet – USA

USA.TP.LVM Tracked Packet – USA (LVM) (large volume mailers)

USA.XP Xpresspost USA

INT.XP Xpresspost International

INT.IP.AIR International Parcel Air

INT.IP.SURF International Parcel Surface

INT.PW.ENV Priority Worldwide Envelope Int’l

INT.PW.PAK Priority Worldwide pak Int’l

INT.PW.PARCEL Priority Worldwide parcel Int’l

INT.SP.AIR Small Packet International Air

INT.SP.SURF Small Packet International Surface

INT.TP Tracked Packet – International

 

However, if it doesn't show up for me, and it doesn't show up for you, I'm thinking it may not be on our end, GM.

Edited by Druid6900

No Good Deed EVER Goes Unpunished

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