Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Wishlist For Phoenix


tmcca

Recommended Posts

Finally got this on a live site and now getting the below error on the first visit to the site.

Quote

Fatal error: Uncaught Error: Call to a member function count_contents() on null in /customers/2/b/b/360wargaming.com/httpd.www/includes/modules/navbar_modules/templates/tpl_nb_wish_list.php:3 
Stack trace: #0 /customers/2/b/b/360wargaming.com/httpd.www/includes/modules/block_template.php(14): include() 
#1 /customers/2/b/b/360wargaming.com/httpd.www/includes/modules/navbar_modules/nb_wish_list.php(52): include('/customers/2/b/...') 
#2 /customers/2/b/b/360wargaming.com/httpd.www/includes/modules/content/navigation/cm_navbar.php(60): nb_wish_list->getOutput() 
#3 /customers/2/b/b/360wargaming.com/httpd.www/includes/system/versioned/1.0.4.0/osc_template.php(146): cm_navbar->execute() 
#4 /customers/2/b/b/360wargaming.com/httpd.www/includes/template_top.php(45): oscTemplate->getContent('navigation') 
#5 /customers/2/b/b/360wargaming.com/httpd.www/index.php(35): require('/customers/2/b/...') 
#6 {main} thrown in /customers/2/b/b/360wargaming.com/httpd.www/includes/modules/navbar_modules/templates/tpl_nb_wish_list.php on line 3 

Any ideas? Or can I just suppress it?

Link to comment
Share on other sites

14 minutes ago, burt said:

That may lead to other problems or it may fix it.

Did neither, I'll carry on looking though.

The wishlist addon has its class file that contains it's own count_contents function.

 

Edited by LeeFoster
Link to comment
Share on other sites

When you make wishlist into a hook, I am curious how you ensure the wishlist action is executed before the shopping cart action. This order of execution is important as you do not want shopping cart to act first leaving nothing for the wishlist.

Link to comment
Share on other sites

20 minutes ago, kgtee said:

When you make wishlist into a hook, I am curious how you ensure the wishlist action is executed before the shopping cart action. This order of execution is important as you do not want shopping cart to act first leaving nothing for the wishlist.

Put it in the hook before the shopping cart action is processed? 

This will be a little more complicated in 1.0.7.4, as the shopping cart actions are also processed by a hook.  But in 1.0.7.3, there is a hook call immediately prior to the processing of the shopping cart actions. 

22 hours ago, LeeFoster said:

The wishlist addon has its class file that contains its own count_contents function.

Then it seems to be saying that the $wishlist object is not set.  I would probably replace it with $_SESSION['wishlist'] and it's possible that it is not triggering the wishlist creation for some reason.  Or perhaps it needs to be gated by

if (isset($_SESSION['wishlist'])) {

somewhere. 

Always back up before making changes.

Link to comment
Share on other sites

  • 1 month later...
2 minutes ago, LeeFoster said:

The upgrade to 1.0.7.5 has caused issues with this add on, is any one interested in working together to get this fixed?

1.0.7.5?  Or 1.0.7.4?  You should be able to just change the hook to run just before the shopping cart actions.  I did this recently, so I should probably be able to look up the new hook name/location later. 

Always back up before making changes.

Link to comment
Share on other sites

2 minutes ago, ecartz said:

1.0.7.5?  Or 1.0.7.4?  You should be able to just change the hook to run just before the shopping cart actions.  I did this recently, so I should probably be able to look up the new hook name/location later. 

1.0.7.5, the issue seems to be with get_products() function

Link to comment
Share on other sites

16 hours ago, ecartz said:

But the get_products function hasn't changed since 1.0.7.3

The hook I couldn't remember off hand was hook_shop_system__23_parse_actions and listen_startApplication

Yeah I think the issue is that the hook I was using has been removed/replaced

$OSCOM_Hooks->call('system', 'preActionApp');

Link to comment
Share on other sites

  • 2 months later...

Hello,

I have Phoenix 1.0.7.7 and I dont know, how to solve the problem " Fatal error: Uncaught Error: Call to a member function count_contents() " in this version.

Can you please help me ?

best regards A. Maischein

Link to comment
Share on other sites

Thank you for the reply and sorry, I copied an pasted the wrong error (this one I have found). The correct error is:

Uncaught Error: Call to a member function count_contents() on null in /homepages/42/d33248359/htdocs/s4/catalog/includes/modules/navbar/templates/tpl_nb_wishlist.php

wishlist is uploaded in classes.

Link to comment
Share on other sites

The function call has been converted to a session call. You should have this in the template file:

Quote

    <div class="dropdown-menu dropdown-menu-lg-right" aria-labelledby="navDropdownCart">
      <?php echo '<a class="dropdown-item" href="' . tep_href_link('wishlist.php') . '">' . sprintf(MODULE_NAVBAR_WISH_LIST_HAS_CONTENTS, $_SESSION['wishList']->count_contents(), $GLOBALS['currencies']->format($_SESSION['wishList']->show_total())) . '</a>';
    if ($_SESSION['wishList']->count_contents() > 0) {
      echo '<div class="dropdown-divider"></div>' . PHP_EOL;
      $products = $_SESSION['wishList']->get_products();
      foreach ($products as $k => $v) {
        echo sprintf(MODULE_NAVBAR_WISH_LIST_PRODUCT, $v['id'], $v['quantity'], $v['name']);
      }
    }
    ?>
    </div>

 

Edited by kgtee
Link to comment
Share on other sites

I copied the mentioned <div>...</div> to tpl_nb_wishlist.php in includes/modules/navbar/templates. Now I receive an empty page and inside I can find:

<div class="dropdown-menu dropdown-menu-lg-right" aria-labelledby="navDropdownCart">
      <br>
<b>Warning</b>:  Use of undefined constant MODULE_NAVBAR_WISH_LIST_HAS_CONTENTS - assumed 'MODULE_NAVBAR_WISH_LIST_HAS_CONTENTS' (this will throw an Error in a future version of PHP) in <b>/xx/s4/catalog/includes/modules/navbar/templates/tpl_nb_wishlist.php</b> on line <b>4</b><br>
<br>
<b>Notice</b>:  Undefined index: wishList in <b>/xx/s4/catalog/includes/modules/navbar/templates/tpl_nb_wishlist.php</b> on line <b>4</b><br>
<br>
<b>Fatal error</b>:  Uncaught Error: Call to a member function count_contents() on null in /xx/s4/catalog/includes/modules/navbar/templates/tpl_nb_wishlist.php:4
Stack trace:
#0 /xx/s4/catalog/includes/modules/block_template.php(14): include()
#1 /xx/s4/catalog/includes/modules/navbar/nb_wishlist.php(51): include('/homepages/42/d...')
#2 /xx/s4/catalog/includes/modules/content/navigation/cm_navbar.php(60): nb_wishlist-&gt;getOutput()
#3 /xx/s4/catalog/includes/system/versioned/1.0.7.6/osc_template.php(106): cm_navbar-&gt;execute()
#4 /xx/s4/catalog/templates/default/includes/components/template_top.php(46): oscTemplate-&gt;getContent('navigation')
#5 /xx/s4/catalog/templates/default/includes/pages/index.php(13): require('/homepages/42/d...')
#6 /xx/s4/catalog/index.php(35): require('/homepages/42/d...')
#7 {main}
  thrown in <b>/xx/s4/catalog/includes/modules/navbar/templates/tpl_nb_wishlist.php</b> on line <b>4</b><br>
</div>

I dont have anywhere the MODULE_NAVBAR_WISH_LIST_HAST_CONTENTS besides in the copied part.

Link to comment
Share on other sites

@amaische I used this wishlist navbar module

    https://apps.oscommerce.com/cl8JP&amp;wishlist-module-for-modular-navigation-b

which is different from yours. This module has the MODULE_NAVBAR_WISH_LIST_HAST_CONTENTS.

However, your error "Uncaught Error: Call to a member function count_contents() on null" is more difficult to solve. It can be due to an error (typo?) in the wishlist class. Perhaps you want to check the class functions therein more thoroughly.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...