Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Call to a member function set_snapshot() on a non-object


zebraplayer

Recommended Posts

Hi,

 

I am getting the following error. I searched for the solution to this and found a post of a guy that said he fixed his own same problem, but did not bother to leave a clue as to what he did. This is the error message:

 

Fatal error: Call to a member function set_snapshot() on a non-object in /home/indie853/public_html/charlottefilmfestival/shop2/checkout_shipping.php on line 18

 

Any help is appreciated.

 

-Lou

Link to comment
Share on other sites

  • 1 month later...

anyone familiar with this, I'm getting it too. Happens to non-members when they hit checkout, rather then going to sign-up page.

Link to comment
Share on other sites

I found this thread on Google. Funny, I didn't even realize OsCommerce had this forum when I downloaded it. I have made some slight changes to my design, colors and whatnot, but I am running into this same problem. I believe this is part of a bigger issue, because if you search the exact function error on Google, you will find many shops that have it, but probably do not know they do. Ok, I'm ready for some help with this now. What information can I provide?

Link to comment
Share on other sites

This would indicate that the line at the top of checkout_shipping.php has been edited to remove require('includes/application_top.php'); as that includes the require(DIR_WS_CLASSES . 'navigation_history.php'); thats needed.

 

Is that line there?

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Thank you for such a quick response. Yes, btw, it is there. On other forums they use the quote tags for this, let me know what the procedure is here if incorrect. But here is what I have

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

require('includes/classes/http_client.php');

 

// if the customer is not logged on, redirect them to the login page

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

Link to comment
Share on other sites

Looking through other posts it appears this may occur on upgrade from php4 to 5 where a bug stops the class being instantiated.

 

Making this code change in application top may fix the issue:

 

Find:

 

// navigation history
 if (tep_session_is_registered('navigation')) {
if (PHP_VERSION < 4) {
  $broken_navigation = $navigation;
  $navigation = new navigationHistory;
  $navigation->unserialize($broken_navigation);
}
 } else {
tep_session_register('navigation');
$navigation = new navigationHistory;
 }
 $navigation->add_current_page();

 

Replace With:

 

// navigation history
 if (tep_session_is_registered('navigation') && is_object($navigation)) {
if (PHP_VERSION < 4) {
  $broken_navigation = $navigation;
  $navigation = new navigationHistory;
  $navigation->unserialize($broken_navigation);
} else {
  $navigation = new navigationHistory;
}
 } else {
tep_session_register('navigation');
$navigation = new navigationHistory;
 }
 $navigation->add_current_page();

 

Not my code, just combined from others, let me know if it works.

 

:)

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

  • 2 months later...

Hmm that hack doesn't make sense to me.

 

The original is saying ..

 

If the navigation variable (not object) exists and you have decent version of PHP {

// Do nothing

}

 

Add the current page to the navigation

################################

 

The hack is saying ..

 

If the navigation object exists and you have decent version of PHP {

//Recreate a new one even though it already exists

}

 

Add the current page to the navigation

################################

 

Wouldn't this mean that the snapshot history is lost?

Link to comment
Share on other sites

What about just testing for the object?

 

// navigation history
 if (tep_session_is_registered('navigation') && is_object($navigation)) {
if (PHP_VERSION < 4) {
  $broken_navigation = $navigation;
  $navigation = new navigationHistory;
  $navigation->unserialize($broken_navigation);
}
 } else {
tep_session_register('navigation');
$navigation = new navigationHistory;
 }
 $navigation->add_current_page();

Link to comment
Share on other sites

Actually the following would be more correct ..

 

// navigation history
 if (tep_session_is_registered('navigation')) {
if (PHP_VERSION < 4) {
  $broken_navigation = $navigation;
  $navigation = new navigationHistory;
  $navigation->unserialize($broken_navigation);
}
if( false === is_object($navigation) ) {
  $navigation = new navigationHistory;
}
 } else {
tep_session_register('navigation');
$navigation = new navigationHistory;
 }
 $navigation->add_current_page();

Link to comment
Share on other sites

  • 9 months later...
  • 7 months later...

Looking through other posts it appears this may occur on upgrade from php4 to 5 where a bug stops the class being instantiated.

 

Making this code change in application top may fix the issue:

 

Find:

 

// navigation history
 if (tep_session_is_registered('navigation')) {
if (PHP_VERSION < 4) {
  $broken_navigation = $navigation;
  $navigation = new navigationHistory;
  $navigation->unserialize($broken_navigation);
}
 } else {
tep_session_register('navigation');
$navigation = new navigationHistory;
 }
 $navigation->add_current_page();

 

Replace With:

 

// navigation history
 if (tep_session_is_registered('navigation') && is_object($navigation)) {
if (PHP_VERSION < 4) {
  $broken_navigation = $navigation;
  $navigation = new navigationHistory;
  $navigation->unserialize($broken_navigation);
} else {
  $navigation = new navigationHistory;
}
 } else {
tep_session_register('navigation');
$navigation = new navigationHistory;
 }
 $navigation->add_current_page();

 

Not my code, just combined from others, let me know if it works.

 

:)

 

I feel so good!thanks!

Link to comment
Share on other sites

  • 1 month later...

Looking through other posts it appears this may occur on upgrade from php4 to 5 where a bug stops the class being instantiated.

 

Making this code change in application top may fix the issue:

 

Find:

 

// navigation history
 if (tep_session_is_registered('navigation')) {
if (PHP_VERSION < 4) {
  $broken_navigation = $navigation;
  $navigation = new navigationHistory;
  $navigation->unserialize($broken_navigation);
}
 } else {
tep_session_register('navigation');
$navigation = new navigationHistory;
 }
 $navigation->add_current_page();

 

Replace With:

 

// navigation history
 if (tep_session_is_registered('navigation') && is_object($navigation)) {
if (PHP_VERSION < 4) {
  $broken_navigation = $navigation;
  $navigation = new navigationHistory;
  $navigation->unserialize($broken_navigation);
} else {
  $navigation = new navigationHistory;
}
 } else {
tep_session_register('navigation');
$navigation = new navigationHistory;
 }
 $navigation->add_current_page();

 

Not my code, just combined from others, let me know if it works.

 

:)

Hello All,

 

I'm having the same problem, I changed the code to what Sam suggested, but i'm still getting the error :( Any other suggestions?? Thanks so much!!!

I Hate PHP, LoLssss

Visit My Site, Any constructive comments and suggestions Welcome :)

WARNING: IT'S STILL UNDER CONSTRUCTION, LOLS

Link to comment
Share on other sites

hey Mr. Phil:

 

thanks so much for responding. I did visit the post that you refered to me, I tried all of the fixes!!!, Nothing worked :( . I also tried the advices on this post Click here. No luck either. I'm really exhausted with all of this :wacko: . I've decided to just star all overrrr againnnn. But I just wanted to ask you, or anyone who can help. What may cause this issue??? I read it could be related to the PHP being used. Are their any other causes? how can it be avoided? Stuff like that. Just asking because I would like to avoid or be more precautious about this issue, in the future. Again thanks so much for responding :)

I Hate PHP, LoLssss

Visit My Site, Any constructive comments and suggestions Welcome :)

WARNING: IT'S STILL UNDER CONSTRUCTION, LOLS

Link to comment
Share on other sites

So you tried the following and it still fails (add_current_page() member function on non-object)?

// navigation history
if (tep_session_is_registered('navigation')) {
  if (PHP_VERSION < 4) {
        $broken_navigation = $navigation;
        $navigation = new navigationHistory;
        $navigation->unserialize($broken_navigation);
  } elseif (!is_object($navigation)) {
        $navigation = new navigationHistory;
  }
} else {
  tep_session_register('navigation');
  $navigation = new navigationHistory;
}
$navigation->add_current_page();

Well, it's a coding error in osC. Nothing really to do with PHP, except that possibly some versions may have it show up more easily than other versions. But in the end, the osC code has to be fixed.

 

If your "same problem" is the set_snapshot() error, of course this will not fix it! It's for a different problem!

Link to comment
Share on other sites

So you tried the following and it still fails (add_current_page() member function on non-object)?

// navigation history
if (tep_session_is_registered('navigation')) {
  if (PHP_VERSION < 4) {
        $broken_navigation = $navigation;
        $navigation = new navigationHistory;
        $navigation->unserialize($broken_navigation);
  } elseif (!is_object($navigation)) {
        $navigation = new navigationHistory;
  }
} else {
  tep_session_register('navigation');
  $navigation = new navigationHistory;
}
$navigation->add_current_page();

Well, it's a coding error in osC. Nothing really to do with PHP, except that possibly some versions may have it show up more easily than other versions. But in the end, the osC code has to be fixed.

 

If your "same problem" is the set_snapshot() error, of course this will not fix it! It's for a different problem!

Hello:

 

I did try all of the codes offered, unfortunately to no avail. I just started the whole thing over from scratch. I really appreciate your help though!!! Hopefully this will help someone else, researching the topic. Have a good one!!! Once again many many thanks!!!

I Hate PHP, LoLssss

Visit My Site, Any constructive comments and suggestions Welcome :)

WARNING: IT'S STILL UNDER CONSTRUCTION, LOLS

Link to comment
Share on other sites

  • 3 weeks later...

spooks, you're a hero. it worked perfectly for me.

 

Thank you so much for posting that code.

 

Looking through other posts it appears this may occur on upgrade from php4 to 5 where a bug stops the class being instantiated.

 

Making this code change in application top may fix the issue:

 

Find:

 

// navigation history
 if (tep_session_is_registered('navigation')) {
if (PHP_VERSION < 4) {
  $broken_navigation = $navigation;
  $navigation = new navigationHistory;
  $navigation->unserialize($broken_navigation);
}
 } else {
tep_session_register('navigation');
$navigation = new navigationHistory;
 }
 $navigation->add_current_page();

 

Replace With:

 

// navigation history
 if (tep_session_is_registered('navigation') && is_object($navigation)) {
if (PHP_VERSION < 4) {
  $broken_navigation = $navigation;
  $navigation = new navigationHistory;
  $navigation->unserialize($broken_navigation);
} else {
  $navigation = new navigationHistory;
}
 } else {
tep_session_register('navigation');
$navigation = new navigationHistory;
 }
 $navigation->add_current_page();

 

Not my code, just combined from others, let me know if it works.

 

:)

Link to comment
Share on other sites

  • 4 months later...

Looking through other posts it appears this may occur on upgrade from php4 to 5 where a bug stops the class being instantiated.

 

Making this code change in application top may fix the issue:

 

Find:

 

// navigation history
 if (tep_session_is_registered('navigation')) {
if (PHP_VERSION < 4) {
  $broken_navigation = $navigation;
  $navigation = new navigationHistory;
  $navigation->unserialize($broken_navigation);
}
 } else {
tep_session_register('navigation');
$navigation = new navigationHistory;
 }
 $navigation->add_current_page();

 

Replace With:

 

// navigation history
 if (tep_session_is_registered('navigation') && is_object($navigation)) {
if (PHP_VERSION < 4) {
  $broken_navigation = $navigation;
  $navigation = new navigationHistory;
  $navigation->unserialize($broken_navigation);
} else {
  $navigation = new navigationHistory;
}
 } else {
tep_session_register('navigation');
$navigation = new navigationHistory;
 }
 $navigation->add_current_page();

 

Not my code, just combined from others, let me know if it works.

 

:)

 

You're wonderful! I had the same problem and it fixed it immediately, thank you so much, really appreciate it.

x

Link to comment
Share on other sites

  • 3 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...