Jump to content

Archived

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

madhukar_garg

Call To A Member Function Add_current_page() On A Non-object

Recommended Posts

Dear All,

 

I am getting this error "Call to a member function add_current_page() on a non-object in application_top.php on line 324".

 

Please help.

 

thanks in advance

 

madhukar garg

Share this post


Link to post
Share on other sites

It can have more than one reason.

 

What does your line 324 look like? Did you declare the variable you're deploying this function on as a new object? Is the class loaded the the object is referring to?

Share this post


Link to post
Share on other sites
It can have more than one reason.

 

What does your line 324 look like? Did you declare the variable you're deploying this function on as a new object? Is the class loaded the the object is referring to?

 

 

thanks for your reply sir, my code on line 324 is

 

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

 

upper underline line generates that error

Share this post


Link to post
Share on other sites

Around line 125 the should be this line:

 

require(DIR_WS_CLASSES . 'navigation_history.php');

 

Is it there? Is the file there? Is it altered by some contributions?

 

And which php version are you running?

Share this post


Link to post
Share on other sites
thanks for your reply sir, my code on line 324 is

 

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

 

upper underline line generates that error

 

Replace with:

 

// navigation history

// 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 {

tep_session_register('navigation');

$navigation = new navigationHistory;

}

 

$navigation->add_current_page();

 

This fixed it for me as I turned Register_globals off.

Share this post


Link to post
Share on other sites

This worked for me, too! Thanks, Xeorex!

Replace with:

 

// 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; //payoff

}

} else {

tep_session_register('navigation');

$navigation = new navigationHistory;

}

 

$navigation->add_current_page();

Share this post


Link to post
Share on other sites

Thank you! This worked for me as well. I installed Security Pro and this happened. Thank you again!

 

 

 

 

 

This worked for me, too! Thanks, Xeorex!

Share this post


Link to post
Share on other sites

Thanks worked great!


Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Share this post


Link to post
Share on other sites

worked for me too. but now i have

 

Fatal error: Call to a member function count_wishlist() on a non-object in (etc).

 

wonder what my host is doing. i mean i have 2 other exact same installs of RC2.2a without any of these problems. jeez


☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆

Share this post


Link to post
Share on other sites

worked for me too. but now i have

 

Fatal error: Call to a member function count_wishlist() on a non-object in (etc).

 

wonder what my host is doing. i mean i have 2 other exact same installs of RC2.2a without any of these problems. jeez

 

Thank you all for your contributions and comments. I think that has nothing to do with this contribution, I have this same error before installing this. Appeared to me when installing the contribution of IPU. If anyone knows how to correct would appreciate your help

Share this post


Link to post
Share on other sites

Hi,

 

I was using PayPal Standard, so I installed the PayPal IPN Module (contribution done on 2009/02/06). I followed instructions as per html file included in package.

 

First error I got was because of some duplicate function declaration. On the help html, they were telling you to paste a function on the bottom of general.php, but the same function was declared already.

 

So when I removed that duplicate function, I get this same error "Call to a member function add_current_page() on a non-object".

 

Does it have anything to do with the GlobalVars being off? Why get the error now, is there something missing in that contribution?

Share this post


Link to post
Share on other sites

So when I removed that duplicate function, I get this same error "Call to a member function add_current_page() on a non-object".

Change your includes/application_top.php according to these instruction on Github and the error will not return.

Share this post


Link to post
Share on other sites

Change your includes/application_top.php according to these instruction on Github and the error will not return.

 

Hi Jan,

 

Thanks for replying. I applied that amend and now I get a new error when trying to view my cart:

 

Fatal error: Cannot redeclare tep_set_banner_status() (previously declared in /home/wwwjcp/public_html/catalog/includes/functions/general.php:698) in /home/wwwjcp/public_html/catalog/includes/functions/banner.php on line 23

 

Why are all this errors happening? All I did was try to install the PayPal IPN module, and since then I've been having problem after problem. And now I want to revert to my previous stable condition and I can't.

 

How do I fix this new problem?

Share this post


Link to post
Share on other sites

Fatal error: Cannot redeclare tep_set_banner_status() (previously declared in /home/wwwjcp/public_html/catalog/includes/functions/general.php:698) in /home/wwwjcp/public_html/catalog/includes/functions/banner.php on line 23

 

Why are all this errors happening? All I did was try to install the PayPal IPN module, and since then I've been having problem after problem. And now I want to revert to my previous stable condition and I can't.

 

How do I fix this new problem?

The error tells you that in the PHP files that are loaded on a page request there are two instances of the function tep_set_banner_status(). The first one is in catalog/includes/functions/banner.php and that is where it belongs. You obviously added it to catalog/includes/functions/general.php yourself because in a default installation it is not there. Remove it or if it belongs to a contribution check the instructions of the contribution. Perhaps you had to remove the copy from banner.php. Hard to tell.

 

If you don't know what you are doing it is best to read a beginners book on PHP. It is an investment of time that will pay for itself very quickly. Stumbling on like this is very, very frustrating. Unfortunately, osC 2.2 is not like software like WordPress or Drupal where you don't really have to know PHP to make changes or add new functionality. A lot of time with osC 2.2 changes have to be made in the PHP code and a basic understanding of that programming language is really useful when doing that.

Share this post


Link to post
Share on other sites

The error tells you that in the PHP files that are loaded on a page request there are two instances of the function tep_set_banner_status(). The first one is in catalog/includes/functions/banner.php and that is where it belongs. You obviously added it to catalog/includes/functions/general.php yourself because in a default installation it is not there. Remove it or if it belongs to a contribution check the instructions of the contribution. Perhaps you had to remove the copy from banner.php. Hard to tell.

 

If you don't know what you are doing it is best to read a beginners book on PHP. It is an investment of time that will pay for itself very quickly. Stumbling on like this is very, very frustrating. Unfortunately, osC 2.2 is not like software like WordPress or Drupal where you don't really have to know PHP to make changes or add new functionality. A lot of time with osC 2.2 changes have to be made in the PHP code and a basic understanding of that programming language is really useful when doing that.

 

Thanks for the suggestions Jan, but I've been coding in PHP for years and understand the error perfectly. What I don't understand is why the error occurred if I didn't added it to the catalog/includes/functions/general.php.

 

I'm frustrated because I followed every installation instruction detailed in the osCommerce_PayPal_IPN_2_3_4_7 contribution, and it didn't work.

 

Anyhow, I download the osCommerce Online Merchant v2.2 Release Candidate 2a package, re-uploaded the native general.php file and everything is back to normal.

 

I'm gonna give the IPN Module another go. Have you had any experience with this?

 

Seb.

Share this post


Link to post
Share on other sites

What I don't understand is why the error occurred if I didn't added it to the catalog/includes/functions/general.php.

Perhaps you replaced that file with one from a contribution which was faulty? I'm sure you agree that it didn't get there without your intervention :)

 

I'm gonna give the IPN Module another go. Have you had any experience with this?

Absolutely zero experience with payment modules and certainly not PayPal modules. Most payment and shipping modules are just a matter of uploading a payment/shipping file and the accompanying language file and then enabling/entering some detail for the module in the admin (that part of osC is like Wordpress or Drupal).

Share this post


Link to post
Share on other sites

×