Zen Cart Logo
Forums / All Other Contributions/Addons / Fatal error: Using $this when not in object context (one-page-checkout)

Fatal error: Using $this when not in object context (one-page-checkout)

Locked

Views: 6,005

Results 1 to 15 of 15
This thread is locked. New replies are disabled.
28 Feb 2008, 12:25 AM
#1
gsdcypher avatar

gsdcypher

Totally Zenned

Join Date:
Feb 2007
Posts:
816
Plugin Contributions:
0

Fatal error: Using $this when not in object context (one-page-checkout)

they say they have fixed everything, but when someone tries to go through the checkout process they get this error:

Fatal error: Using $this when not in object context in /public_html/includes/modules/ALLK9/create_account.php on line 413

Please help... :frusty:

28 Feb 2008, 1:19 AM
#2
gsdcypher avatar

gsdcypher

Totally Zenned

Join Date:
Feb 2007
Posts:
816
Plugin Contributions:
0

Re: Fatal error: Using $this when not in object context (one-page-checkout)

if i should post this somewhere else please let me know. my site has been down all day and i really need to get it working asap. it was working yesterday, they did something overnight and that's when the problems started (security errors, create account errors, etc.) Here is what i have been told by my host so far...

I added the following directives to the .htaccess file i your public_html folder:
AddHandler application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml .htm .html
AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml .htm .html

and

We updated PHP on your server with SUEXEC support by secure reason. It caused the problem.

but someone still cannot purchase an item due to the fatal error noted above...

Thanks.

28 Feb 2008, 3:22 AM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Fatal error: Using $this when not in object context (one-page-checkout)

What version Zen Cart are you running?

28 Feb 2008, 3:24 AM
#4
gsdcypher avatar

gsdcypher

Totally Zenned

Join Date:
Feb 2007
Posts:
816
Plugin Contributions:
0

Re: Fatal error: Using $this when not in object context (one-page-checkout)

this is my live site and it is running 1.3.7.

*i am working on a 1.8.8a test site to make sure everything works before i upgrade.

28 Feb 2008, 3:25 AM
#5
gsdcypher avatar

gsdcypher

Totally Zenned

Join Date:
Feb 2007
Posts:
816
Plugin Contributions:
0

Re: Fatal error: Using $this when not in object context (one-page-checkout)

do you need to log in?

28 Feb 2008, 3:53 AM
#6
gsdcypher avatar

gsdcypher

Totally Zenned

Join Date:
Feb 2007
Posts:
816
Plugin Contributions:
0

Re: Fatal error: Using $this when not in object context (one-page-checkout)

sorry i meant to say that my live site (the one that is down) is 1.3.7 and that my test site is 1.3.8a (not 1.8.8).... :oops:

so the site that is popping the fatal error is 1.3.7.

28 Feb 2008, 4:30 AM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Fatal error: Using $this when not in object context (one-page-checkout)

What happens if you rename this file:
l/includes/modules/ALLK9/create_account.php

to be:
l/includes/modules/ALLK9/create_account.php_HIDE

Does it start working for you?

28 Feb 2008, 4:51 AM
#8
gsdcypher avatar

gsdcypher

Totally Zenned

Join Date:
Feb 2007
Posts:
816
Plugin Contributions:
0

Re: Fatal error: Using $this when not in object context (one-page-checkout)

whoa... weird.:huh:

yep it works now.
first i want to give you a big thank you. :clap:

but what did that do???

what happened?

28 Feb 2008, 4:55 AM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Fatal error: Using $this when not in object context (one-page-checkout)

You appear to not have an upgraded file to match the version that you are running or some other error is in it ...

You might try running something like Beyond Comare from scootersoftware.com on a clean copy of the file and compare it to your file that you renamed to _HIDE ...

28 Feb 2008, 6:19 AM
#10
gsdcypher avatar

gsdcypher

Totally Zenned

Join Date:
Feb 2007
Posts:
816
Plugin Contributions:
0

Re: Fatal error: Using $this when not in object context (one-page-checkout)

hmmmm...

what does that do to my cart? will it still function as normal if i leave that file as _HIDE?

can i overwrite that file with a 1.3.8a file???

28 Feb 2008, 6:29 AM
#11
gsdcypher avatar

gsdcypher

Totally Zenned

Join Date:
Feb 2007
Posts:
816
Plugin Contributions:
0

Re: Fatal error: Using $this when not in object context (one-page-checkout)

here is the code that is differnt from the clean file:

//The following bypasses the Create Account Success page if items are in the cart.
if (is_array($this->contents)) { // if items in cart, then by pass create account success
zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); // Redirects the user to the "Shipping Information" part of the checkout (more streamlined).
} else { // no items in cart to show create account success page
zen_redirect(zen_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL')); // Original line of code that redirects the user to the "create account success" page. Adds another step to the checkout process, and is not needed for a mroe streamlined approach.
}
// *******************************************************************************

It was working just fine... what do you think is the problem in the code?

28 Feb 2008, 6:35 AM
#12
drbyte avatar

drbyte

Sensei

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

Re: Fatal error: Using $this when not in object context (one-page-checkout)

gsdcypher:

they say they have fixed everything, but when someone tries to go through the checkout process they get this error:

Fatal error: Using $this when not in object context in /home/allk9/public_html/includes/modules/ALLK9/create_account.php on line 413

Please help... :frusty:

gsdcypher:

here is the code that is differnt from the clean file:

//The following bypasses the Create Account Success page if items are in the cart.
if (is_array($this->contents)) { // if items in cart, then by pass create account success
zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); // Redirects the user to the "Shipping Information" part of the checkout (more streamlined).
} else { // no items in cart to show create account success page
zen_redirect(zen_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL')); // Original line of code that redirects the user to the "create account success" page. Adds another step to the checkout process, and is not needed for a mroe streamlined approach.
}
// *******************************************************************************

It was working just fine... what do you think is the problem in the code?

According to the error message you first reported, the $this->content is the problem referenced.

One of your addons/contributions has likely added some extra code to the file, but you're missing a dependency from elsewhere for one reason or another.

28 Feb 2008, 6:47 AM
#13
gsdcypher avatar

gsdcypher

Totally Zenned

Join Date:
Feb 2007
Posts:
816
Plugin Contributions:
0

Re: Fatal error: Using $this when not in object context (one-page-checkout)

any ideas on how to find and fix?

would it be something in the CHECKOUT_SHIPPING or CREATE_ACCOUNT _SUCCESS files???

the crazy thing is that all of this was working just fine until the host made some changes (as noted).

28 Feb 2008, 7:04 AM
#14
drbyte avatar

drbyte

Sensei

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

Re: Fatal error: Using $this when not in object context (one-page-checkout)

I would imagine that you're dealing with a similar problem to this thread where the same create-account error was mentioned:
http://www.zen-cart.com/forum/showthread.php?t=89428

Seems they're using a one-page-checkout addon that was causing them similar grief.

28 Feb 2008, 7:08 AM
#15
drbyte avatar

drbyte

Sensei

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

Re: Fatal error: Using $this when not in object context (one-page-checkout)

NOTE: Moved relevant posts to new thread in Contributions area