Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

First post here. Please help me !


over700songs.com

Recommended Posts

Hi, this is my first post here and I am totally freaking out because I lost my whole main page. Specifically, when folks go to my website and click on the "shop" button, it used to take you right to the main page where you can shop via this osCommerce module.

 

this is the rror message that now appears when you click the button:

 

Fatal error: Call to a member function add_current_page() on a non-object in /home/overson1/public_html/shop/includes/application_top.php on line 313

 

I know it is probably something simple but I have no idea at all what to do.

I was only in there changing the copy/words that peoplesaw. I didn't touch any of the html stuff or any of that. Well, I didn't think I did but I obviously did and now I am at a complete loss.

 

I have an album coming out in 2 weeks and desperately need to restore it to what it was but don't know how.

 

if anyone can help me, please send info to:

 

[email protected].

 

i am so lame with this stuff and if I can fix it, i will never go in there again.

and no, i do not believe i have a backup saved anywhere, of an earlier version, before the destruction.

 

thanx so much if you can polease help me.

 

- Earl

Link to comment
Share on other sites

Look at the links in my posts here: Click Me

 

(Different line number but the fix is the same)

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Hopefully that will do it -- and someone has learned to make backup copies before editing files! Although, there may have been system changes going on at the same time (register global variables being turned off, PHP version upgrade, etc.), or just an interrupted session that needed to be cleaned out.

 

germ, I was looking at the same code (you beat me to the punch). There's something there that puzzles me:

// 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();

It looks to me as though if the session is registered, AND the PHP version is >= 4, that $navigation will not be created! What do you think? I'm not sure what the original intent was (it's been that way at least since 2.2 MS2), so I hesitate to suggest a code change.

Link to comment
Share on other sites

You hit the nail on the head.

 

Following one of the links in my posts you end up with this code (posted by enigma1) that fixes the problem:

 

// navigation history
 if (tep_session_is_registered('navigation')) {
   if (PHP_VERSION < 4) {
     $broken_navigation = $navigation;
     $navigation = new navigationHistory;
     $navigation->unserialize($broken_navigation);
   }[b][color="#FF0000"] else {
     $navigation = new navigationHistory;
   }[/color][/b]
 } else {
   tep_session_register('navigation');
   $navigation = new navigationHistory;
 }
 $navigation->add_current_page();

The "else" in RED fixes the problem.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Apparently others have known about it for four years: http://www.oscommerce.com/forums/index.php?showtopic=168369. Apparently there are some refinements that might need to be applied to this, rather than just adding the else clause.

 

What we need is a board with errata like this to apply to various levels of osC. It's silly for people to be discovering such problems at least 4 years after a correction is mentioned.

Link to comment
Share on other sites

You hit the nail on the head.

 

Following one of the links in my posts you end up with this code (posted by enigma1) that fixes the problem:

 

// navigation history
 if (tep_session_is_registered('navigation')) {
   if (PHP_VERSION < 4) {
     $broken_navigation = $navigation;
     $navigation = new navigationHistory;
     $navigation->unserialize($broken_navigation);
   }[b][color="#FF0000"] else {
     $navigation = new navigationHistory;
   }[/color][/b]
 } else {
   tep_session_register('navigation');
   $navigation = new navigationHistory;
 }
 $navigation->add_current_page();

The "else" in RED fixes the problem.

this code (above) is wrong, you should use:

// 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();

Link to comment
Share on other sites

Hmm. Can we get a ruling from the judges on this? I've seen 3 different fixes for this now... the third one (floating around this forum somewhere) is

// 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();

Do any of these behave the same way, or are they all different?

 

			   navigation	navigation  PHP	  result
		   registered?   object	  version
						 exists?

original code	   Y		  Y		 <4	 new navigation created, old unserialized		  
				Y		  Y		 >=4	navigation NOT created, object error
				Y		  N		 <4	 new navigation created, old unserialized
				Y		  N		 >=4	navigation NOT created, object error
				N		  Y		 <4	 new navigation created, register session -- overwrite old object?
				N		  Y		 >=4	new navigation created, register session -- overwrite old object?
				N		  N		 <4	 new navigation created, register session
				N		  N		 >=4	new navigation created, register session

germ's fix		  Y		  Y		 <4	 new navigation created, old unserialized		  
				Y		  Y		 >=4	new navigation created, ???? old object replaced?
				Y		  N		 <4	 new navigation created, old unserialized
				Y		  N		 >=4	new navigation created, ???? old object replaced?
				N		  Y		 <4	 new navigation created, register session -- overwrite old object?
				N		  Y		 >=4	new navigation created, register session -- overwrite old object?
				N		  N		 <4	 new navigation created, register session
				N		  N		 >=4	new navigation created, register session

pete's fix		  Y		  Y		 <4	 new navigation created, old unserialized		  
				Y		  Y		 >=4	new navigation created if old one doesn't exist
				Y		  N		 <4	 new navigation created, old unserialized
				Y		  N		 >=4	new navigation created if old one doesn't exist
				N		  Y		 <4	 new navigation created, register session -- overwrite old object?
				N		  Y		 >=4	new navigation created, register session -- overwrite old object?
				N		  N		 <4	 new navigation created, register session
				N		  N		 >=4	new navigation created, register session

above fix		   Y		  Y		 <4	 new navigation created, old unserialized		  
				Y		  Y		 >=4	new navigation created, ??? old object overwritten?
				Y		  N		 <4	 new navigation created, register session -- double register session?
				Y		  N		 >=4	new navigation created, register session -- double register session?
				N		  Y		 <4	 new navigation created, register session -- overwrite old object?
				N		  Y		 >=4	new navigation created, register session -- overwrite old object?
				N		  N		 <4	 new navigation created, register session
				N		  N		 >=4	new navigation created, register session

(I don't know if all of the combinations are possible). I suspect pete222's code is closest to correct, but I'd like other people to review this.

...so I hesitate to suggest a code change.
Link to comment
Share on other sites

hi Phil,

 

my code is the one to be used, it doesn't break the history.

 

a simple check: put something in your cart, then go to the shopping_cart, you will miss the continue button with the 2 other codes, with my code it's still there.

 

or go to My Account, you need to login, after login you should be redirected to My Account

in case of the 2 'wrong' codes you are being redirected to index.php

Link to comment
Share on other sites

// 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();

 

explanation:

navigation is a sessin variable.

With register globals off its not available as a global variable so with this change You will get navigation object.

 

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

my code is the one to be used, it doesn't break the history.

My only concern is: is it possible to not have the 'navigation' session registered, but have a $navigation object existing? If so, the outer else is executed, which creates a new $navigation object when one already exists. Or is it impossible to have those prerequisites? If that can happen, should the old object (if it exists) be unserialized (or whatever) before creating the new object?

 

I just want to make sure that everyone (including me) understands this thoroughly before announcing code changes that need to be made. There's 8 combinations of session already registered (or not), object already existing (or not), and PHP version; unless some of those combinations are definitely impossible. If so, there should be a comment stating what combinations are impossible, so someone looking at the code later won't get worried.

Link to comment
Share on other sites

I also agree with peter

 

this code part

CODE

// navigation history

if (tep_session_is_registered('navigation')) {

if (PHP_VERSION < 4) {

$broken_navigation = $navigation;

$navigation = new navigationHistory;

$navigation->unserialize($broken_navigation);

} else {

$navigation = new navigationHistory;

}

} else

will solve the problem.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

  • 3 weeks later...

after trying numerous solutions,

peter's fix also worked for me,

using rc2a with register globals off

(which may be unnecessary to disable

for rc2a according to some posts but

the host said if it works then leave

disabled)

thanks for all solutions- it certainly

makes this a true osCOMmerceMUNITY

 

jk

Link to comment
Share on other sites

  • 7 months later...

this code (above) is wrong, you should use:

// 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();

 

I agree with this version. it helps me solved a problem throwing customers towards index.php page after creating an account or logging into.

this is the correct code to use, otherwise, with the other version (not checking that it is a object), it will simply each time erase/reset the navigation history, and losing the previous page 'snapshot value' to go to.

Link to comment
Share on other sites

  • 3 weeks later...

I agree with this version. it helps me solved a problem throwing customers towards index.php page after creating an account or logging into.

this is the correct code to use, otherwise, with the other version (not checking that it is a object), it will simply each time erase/reset the navigation history, and losing the previous page 'snapshot value' to go to.

 

 

Official Fix Here!

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

  • 1 month later...
  • 9 months later...

hello everyone,

I am new here and I have this same problem and I have done everything I see here in the post and nothing is working at all.

 

/ include cache functions if enabled

if (USE_CACHE == 'true') include(DIR_WS_FUNCTIONS . 'cache.php');

 

// 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();

 

// include navigation history class

require(DIR_WS_CLASSES . 'navigation_history.php');

 

 

 

What else can i do???? I get this when I try to put in my website:

Fatal error: Call to undefined function tep_session_is_registered() in /home2/mytimepi/public_html/includes/application_top.php on line 126

 

I can login into my admin but can not get into my site. Help me please.

Link to comment
Share on other sites

The code is in the wrong place.

 

Post the entire contents of the file and I'll rearrange it for you and repost it.

 

That's easier than trying to tell you how to fix it.

:)

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...