Zen Cart Logo
Forums / General Questions / PHP Fatal error: Call to a member function credit_selection()

PHP Fatal error: Call to a member function credit_selection()

Views: 1,178

Results 1 to 7 of 7
19 Jun 2012, 3:15 PM
#1
ajmn avatar

ajmn

New Zenner

Join Date:
Sep 2010
Posts:
50
Plugin Contributions:
0

PHP Fatal error: Call to a member function credit_selection()

error log:

[01-Jun-2012 14:56:38] PHP Fatal error: Call to a member function credit_selection() on a non-object in /var/www/vhosts/mydomain.co.uk/httpdocs/mystore/includes/templates/mytemplate/templates/tpl_modules_shipping_estimator.php on line 187
i seem to have a few of these messages all identical (except the time and date!)
also there seem to be many created on each occasion <-- all identical bar the logged at seconds
eg
[13-May-2012 00:36:24]....php on line 187
[13-May-2012 00:36:17]....php on line 187
[13-May-2012 00:36:07]....php on line 187

you can see from the gif image that on 13May and 5 May many were created in a short space of time, and yet on other days only a few were created

Attachment #10655

i've looked at the mentioned file, the line numbers only go to 164, so i'm a little confused!

any clues to how to track the problem down and fix ???

EDIT: :) mm, pretty pointless attaching a picture file if the forum software 1. reduces it in size to be unviewable and 2. changes the format from gif to jpg !

19 Jun 2012, 5:26 PM
#3
ajmn avatar

ajmn

New Zenner

Join Date:
Sep 2010
Posts:
50
Plugin Contributions:
0

Re: PHP Fatal error: Call to a member function credit_selection()

okay thanks for the quick reply,

just for information i looked at the original file from zen-cart-v150-full-release-12302011.zip and it only has 164 lines too!
i guess the first methodical route would be to disable 'mytemplate' ~ but how to induce the error after that?
i guess the problem is with files at the cart->checkout stage since the function is related to quantity discounts, group discounts etc

19 Jun 2012, 10:17 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: PHP Fatal error: Call to a member function credit_selection()

I suspect you're missing files from your server.

But I have no way to tell. The first thing I'd do is a complete compare of ALL files on your server vs the original Zen Cart files for your version. Hence the content of my previous reply.
The compare is very quick if you use a tool like WinMerge as suggested in that article.
Take action on all discrepancies.

If fixing all the discrepancies doesn't resolve your problem, then please describe, step by step, what I would need to do to my site, a fresh clean uncustomized install, from scratch, to recreate your exact same symptoms on my site. Once it's consistently reproducable on another site, then it's much easier to fix. In truth, usually in the process of attempting to recreate the site one quickly discovers exactly the cause of the original problem, and then it's easily fixed.

19 Jun 2012, 11:18 PM
#5
ajmn avatar

ajmn

New Zenner

Join Date:
Sep 2010
Posts:
50
Plugin Contributions:
0

Re: PHP Fatal error: Call to a member function credit_selection()

Thanks DrByte

20 Jun 2012, 12:55 PM
#6
ajmn avatar

ajmn

New Zenner

Join Date:
Sep 2010
Posts:
50
Plugin Contributions:
0

Re: PHP Fatal error: Call to a member function credit_selection()

>complete compare of ALL files on your server vs the original Zen Cart files for your version

apart from the mods and my layout changes (the changed files are in mytemplate folder) there's nothing to report. all files are identical etc.
with regard to the layout changes i've been through the code to check syntax is correct and again i see nothing amiss.
the one mod i was concerned with was the 'sign in as customer', where the only altered file in admin, customers.php, looked like it had lots of changes (use of htmlentities etc)
the file i'm using is
"@version $Id: customers.php 16167 2010-05-01 01:48:50Z drbyte $"
whereas the new/original zc1.5 file is
"@version $Id: customers.php 19775 2011-10-11 15:51:52Z kuroi $"
the concern was merely on security rather than broken code, the mod works fine and the one time it was used does not correspond to the list of identical errors given above.

>suspect you're missing files from your server

i downloaded and compared the live file set, rather than compare the files on the PC, yes it could have been missing or broken files, but as the compare was okay then this also has been ruled out too.

***>then please describe, step by step, what I would need to do to my site, ***

that's going to be seriously arduous, but eventually do-able! let's leave that option until i've tested the next statement

>a fresh clean un-customized install, from scratch, to recreate your exact same symptoms on my site. Once it's consistently reproducible on another site

but how to 'simply' recreate the error on demand?
since i cannot see if it was a single user/ip, (that data not contained within the log files), ...that was having a problem and the fact that it does not happen daily or indeed often,
shown in the jpg above, the error was logged at;
49 logs on 05/03/12 all at 05:51
2 logs on 12/05/12 all at 07:23
39 logs on 13/05/12 , between 00:23 and 00:49
3 logs on 15/05/12 , at 15:06, 15:08 and 20:35

(as you can see there does not seem to be a pattern), ...i'm now even suspecting it may even have nothing to do with the software but was a brief server error instead,

which comes back to the need to better understanding the error message.
the only logical thing i can think of is working backward from the points where the function is called, from my reading of the log it's when it gets to the function call it is there that an error is detected, not sure what a non-object is just yet ~ wrong type of variable etc? but that's just a guess at this stage.

20 Jun 2012, 11:16 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: PHP Fatal error: Call to a member function credit_selection()

Perhaps check to see whether you have any purchases that completed around the same time as those log entries? Then see whether any patterns exist in those customers' purchase activities, such as selected shipping method, which payment module used, what tax rule was used and therefore what zone definition they belong to if any, any sales/discounts/specials/coupons used on the orders, etc.

The "non-object" is referring to the programming logic that's accessing a variable which is supposed to exist as a class object but doesn't, or doesn't have the requested method/function available in it because it's either not defined or not defined properly. If you're not a programmer then none of that will make sense, nor should you worry about what it means technically.
All you need to know is that it was attempting to do things related to payment modules and discounts and couldn't.
And that's usually a result of having outdated payment or order-total modules on your site, or incorrect/incompletely installed payment/ot addons.

Or it could be that your template is designed for an older version and needs some updating.