Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

First post here. Please help me !


16 replies to this topic

#1 over700songs.com

  • Community Member
  • 1 posts
  • Real Name:earl kayoss

Posted 02 October 2009, 01:20

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:

over700songs@hotmail.com.

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

#2 germ

  • Community Member
  • 13,584 posts
  • Real Name:Jim
  • Gender:Male
  • Location:USA (GMT-6)

Posted 02 October 2009, 02:08

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.

"Headers already sent" - The definitive help

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

SSL Implementation Help

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

#3 MrPhil

  • Community Member
  • 3,281 posts
  • Real Name:Phil
  • Gender:Male

Posted 02 October 2009, 02:24

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.

#4 germ

  • Community Member
  • 13,584 posts
  • Real Name:Jim
  • Gender:Male
  • Location:USA (GMT-6)

Posted 02 October 2009, 02:36

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.

"Headers already sent" - The definitive help

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

SSL Implementation Help

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

#5 MrPhil

  • Community Member
  • 3,281 posts
  • Real Name:Phil
  • Gender:Male

Posted 03 October 2009, 17:46

Apparently others have known about it for four years: http://forums.oscommerce.com/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.

#6 peter222

  • Community Member
  • 106 posts
  • Real Name:Peter Grom

Posted 03 October 2009, 17:54

View Postgerm, on Oct 2 2009, 03:36 AM, said:

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


#7 MrPhil

  • Community Member
  • 3,281 posts
  • Real Name:Phil
  • Gender:Male

Posted 04 October 2009, 04:28

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.

Quote

...so I hesitate to suggest a code change.

Edited by MrPhil, 04 October 2009, 04:32.


#8 peter222

  • Community Member
  • 106 posts
  • Real Name:Peter Grom

Posted 04 October 2009, 08:30

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

#9 satish

  • Community Member
  • 5,325 posts
  • Real Name:Satish Mantri
  • Gender:Male
  • Location:Nagpur(India)

Posted 04 October 2009, 08:43

// 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 for osCommerce value addon suggestion tips for your site.
Check My About US For who am I and what My company does.


#10 MrPhil

  • Community Member
  • 3,281 posts
  • Real Name:Phil
  • Gender:Male

Posted 05 October 2009, 03:29

View Postpeter222, on Oct 4 2009, 04:30 AM, said:

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.

#11 satish

  • Community Member
  • 5,325 posts
  • Real Name:Satish Mantri
  • Gender:Male
  • Location:Nagpur(India)

Posted 05 October 2009, 04:39

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 for osCommerce value addon suggestion tips for your site.
Check My About US For who am I and what My company does.


#12 jfkafka

  • Community Member
  • 161 posts
  • Real Name:john kafka

Posted 24 October 2009, 14:16

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

Edited by jfkafka, 24 October 2009, 14:28.


#13 demoalt

  • Community Member
  • 15 posts
  • Real Name:Demoalt

Posted 01 June 2010, 09:15

View Postpeter222, on 03 October 2009, 17:54, said:

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.

#14 bkellum

  • Community Member
  • 4,893 posts
  • Real Name:Bill Kellum
  • Gender:Male
  • Location:Chicago

Posted 20 June 2010, 13:01

View Postdemoalt, on 01 June 2010, 09:15, said:

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

#15 alcyonemarketing

  • Community Member
  • 2 posts
  • Real Name:Alcyone Marketing

Posted 29 July 2010, 16:09

View Postbkellum, on 20 June 2010, 13:01, said:


This does not fix the login redirection issue however. The solution above still works best for that.

#16 23llbes

  • Community Member
  • 1 posts
  • Real Name:Lori Best

Posted 12 May 2011, 21:46

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.

Edited by 23llbes, 12 May 2011, 21:48.


#17 germ

  • Community Member
  • 13,584 posts
  • Real Name:Jim
  • Gender:Male
  • Location:USA (GMT-6)

Posted 12 May 2011, 22:34

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.

"Headers already sent" - The definitive help

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

SSL Implementation Help

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