Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / cloned table shipping in v.1.5.5

cloned table shipping in v.1.5.5

Views: 1,092

Results 1 to 3 of 3
1 Jun 2016, 6:33 PM
#1
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

cloned table shipping in v.1.5.5

Hi!

I'm in the process of upgrading a client's store from 1.5.4 to 1.5.5a. He uses cloned table rate shipping (table is cloned to usaground, usa2day, canadaair, etc.) I've done this many times and figured this wouldn't be much of a big deal to duplicate in this upgrade. But I noticed a key change in the table shipping module file. The line near the top of the file that used to say:

function table() {

now says:

function __construct() {

In the past when I cloned the table file for other methods, I would change function table() to ```
functio usaground()


I'm a bit confused!

Thanks!
1 Jun 2016, 6:57 PM
#2
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Re: cloned table shipping in v.1.5.5

I went ahead and cloned everything else but left the```
function __construct()

12 Jun 2016, 2:41 AM
#3
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: cloned table shipping in v.1.5.5

Unfortunately no one got back to you to explain why that was a good idea/method.

As of one or more of the earlier PHP 5.x versions, a class (something like a data structure that can have its own features applied to it) could be declared (initialized) using a function that more clearly indicates it's purpose. In this case to construct the class. Before this time, the class was initiated by a function having the same name as the class.

Currently this "older" method still works even in PHP 5.6, but in PHP 7.0 (ZC 1.5.5 is compatible with it), the use of the class to initiate the function is now considered a separate function and in certain conditions will cause an error. So in order to maintain compatibility of your code moving forward, use of __construct() just after the class is named is the "better" way to go.