Jump to content
Sign in to follow this  
tmcca

Wishlist For Phoenix

Recommended Posts

After doing that see what happens. If it works than it is hook function issue with 1.0.5.2

Share this post


Link to post
Share on other sites

I will look into this further you getting any errors? Can you show me a screenshot as what's happening?

Share this post


Link to post
Share on other sites

I had that happening and had to do with that function I gave you. I will download 1.0.5.2 and see if I can figure it out

Share this post


Link to post
Share on other sites
Posted (edited)

Did you replace the files in the wishlist directory to your store? you can't do that since this is for version 1.0.5.0 those files have changed since example application_top.. I am curious if that's issue here

Search for //BOF Wishlist and replace those in the files on 1.0.5.2

 

 

Edited by tmcca

Share this post


Link to post
Share on other sites
Posted (edited)

I see one issue

try changing this

// BOF WISHLIST		 
 // wishlist data		 
         if (!tep_session_is_registered('wishList') || !is_object($wishList)) {		
                 tep_session_register('wishList');		
                 $wishList = new wishlist;		
         }		

  //Wishlist actions (must be before shopping cart actions)		
   if (isset($_POST['wishlist'])) {		
           if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) {		
       $attributes = isset($_POST['id']) ? $_POST['id'] : '';		
       $wishList->add_wishlist($_POST['products_id'], $wishList->get_quantity(tep_get_uprid($_POST['products_id'], $attributes))+1, $attributes);		
           }		
                 if (WISHLIST_REDIRECT ==  'No') tep_redirect(tep_href_link('product_info.php', 'products_id=' . $_POST['products_id']));		
           tep_redirect(tep_href_link('wishlist.php'));		
   }

to this:

// BOF WISHLIST		 
 // wishlist data		 
         if (!isset($_SESSION['wishList']) || !is_object($wishList)) {		
                 $_SESSION['wishList'];		
                 $wishList = new wishlist;		
         }		

  //Wishlist actions (must be before shopping cart actions)		
   if (isset($_POST['wishlist'])) {		
           if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) {		
       $attributes = isset($_POST['id']) ? $_POST['id'] : '';		
       $wishList->add_wishlist($_POST['products_id'], $wishList->get_quantity(tep_get_uprid($_POST['products_id'], $attributes))+1, $attributes);		
           }		
                 if (WISHLIST_REDIRECT ==  'No') tep_redirect(tep_href_link('product_info.php', 'products_id=' . $_POST['products_id']));		
           tep_redirect(tep_href_link('wishlist.php'));		
   }

tell me what happens. Some of this maybe not needed. it maybe enough to use only if (!isset($_SESSION['wishlist])) { I have to check that code. 1.0.5.2 uses $_SESSION variables most likely issue here.

Edited by tmcca

Share this post


Link to post
Share on other sites

1.0.5.2 does not change how the tep_session functions work.  But if you want to write them out, the code would look like

         if (!isset($_SESSION['wishList']) || !($wishList instanceof wishlist)) {
                 $_SESSION['wishList'] = new wishlist();
                 $wishList =& $_SESSION['wishlist'];
         }

But I don't think that has anything to do with the issue.  Note that the part that prevents the add to cart action is

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

If that condition is true, then it redirects the page.  If it is not true, it keeps going until it reaches the add to cart action.  So there's really only two things that can be going wrong.  One, that condition is not being set.  Two, the redirect is failing in some fashion without showing an error.  The first is far more likely and suggests some kind of browser issue.  For example, Lee may be using a different browser than you.  Or have different browser settings.  Or perhaps some other issue unrelated to the browser. 

For example, if Lee is using Internet Explorer, perhaps you are hitting https://stackoverflow.com/a/1903505


Always back up before making changes.

Share this post


Link to post
Share on other sites
8 hours ago, tmcca said:

Did you try that fix?

Will start from the beginning and try again later today. Might be worth adding instructions for adding the hooks to core as opposed to including overwritten files.

Share this post


Link to post
Share on other sites

The files are included that are overwritten but for 1.0.5.0 I will write instructions though instead of actually giving the files I guess.

Share this post


Link to post
Share on other sites
19 hours ago, tmcca said:

The files are included that are overwritten but for 1.0.5.0 I will write instructions though instead of actually giving the files I guess.

Doing it this way would mean you are not restricted to a specific version.

Share this post


Link to post
Share on other sites
Posted (edited)

@tmcca @LeeFoster the wishlist button on product_info adds the item to cart.

Has this issue been solved?

I'm using latest version of Phoenix and php 7.3

I'm curious. Is the code for Wishlist button correct? 

Edited by discxpress

Share this post


Link to post
Share on other sites
3 hours ago, discxpress said:

@tmcca @LeeFoster the wishlist button on product_info adds the item to cart.

Has this issue been solved?

I'm using latest version of Phoenix and php 7.3

I'm curious. Is the code for Wishlist button correct? 

Not as far as I'm aware

Share this post


Link to post
Share on other sites
Posted (edited)

@LeeFoster looking through error logs, it's something about

$wishList->count_contents()

that Phoenix doesn't like.

Here's what my error logs report

[17-Mar-2020 08:26:56 UTC] PHP Warning:  Use of undefined constant HEADER_ACCOUNT_WISHLIST - assumed 'HEADER_ACCOUNT_WISHLIST' (this will throw an Error in a future version of PHP) in /home/q4p7grzvy49t/public_html/includes/languages/english/modules/navbar/nb_wishlist.php on line 16
[17-Mar-2020 08:26:56 UTC] PHP Fatal error:  Uncaught Error: Call to a member function count_contents() on null in /home/q4p7grzvy49t/public_html/includes/modules/navbar/templates/tpl_nb_wishlist.php:3
Stack trace:
#0 /home/q4p7grzvy49t/public_html/includes/modules/block_template.php(14): include()
#1 /home/q4p7grzvy49t/public_html/includes/modules/navbar/nb_wishlist.php(51): include('/home/q4p7grzvy...')
#2 /home/q4p7grzvy49t/public_html/includes/modules/content/navigation/cm_navbar.php(60): nb_wishlist->getOutput()
#3 /home/q4p7grzvy49t/public_html/includes/system/versioned/1.0.4.0/osc_template.php(147): cm_navbar->execute()
#4 /home/q4p7grzvy49t/public_html/includes/template_top.php(58): oscTemplate->getContent('navigation')
#5 /home/q4p7grzvy49t/public_html/product_info.php(24): require('/home/q4p7grzvy...')
#6 {main}
  thrown in /home/q4p7grzvy49t/public_html/includes/modules/navbar/templates/tpl_nb_wishlist.php on line 3

 

Edited by discxpress

Share this post


Link to post
Share on other sites

I have been using the wishlist addon on my heavily modified 1.0.1.3 without any issue. Today I tried to migrate it to 1.0.5.2 and there seems to be no problem. Anyone interested may try this version.

Wishlist.zip

Share this post


Link to post
Share on other sites
Posted (edited)
5 hours ago, kgtee said:

I have been using the wishlist addon on my heavily modified 1.0.1.3 without any issue. Today I tried to migrate it to 1.0.5.2 and there seems to be no problem. Anyone interested may try this version.

Wishlist.zip

I just installed your version. here's the errors:

Stack trace:
#0 /home/xxxxxxxxxx/public_html/includes/system/versioned/1.0.4.0/osc_template.php(147): cm_navbar->execute()
#1 /home/xxxxxxxxxx/public_html/includes/template_top.php(58): oscTemplate->getContent('navigation')
#2 /home/xxxxxxxxxx/public_html/index.php(35): require('/home/q4p7grzvy...')
#3 {main}
  thrown in /home/xxxxxxxxxx/public_html/includes/modules/content/navigation/cm_navbar.php on line 58
[18-Mar-2020 06:02:02 UTC] PHP Fatal error:  Uncaught Error: Class 'nb_wishlist' not found in /home/xxxxxxxxxx/public_html/includes/modules/content/navigation/cm_navbar.php:58
Stack trace:
#0 /home/xxxxxxxxxx/public_html/includes/system/versioned/1.0.4.0/osc_template.php(147): cm_navbar->execute()
#1 /home/xxxxxxxxxx/public_html/includes/template_top.php(58): oscTemplate->getContent('navigation')
#2 /home/xxxxxxxxxx/public_html/index.php(35): require('/home/q4p7grzvy...')
#3 {main}
  thrown in /home/xxxxxxxxxx/public_html/includes/modules/content/navigation/cm_navbar.php on line 58

Also note that when you click save to favorites, an item is added to shopping cart. Thanks

Edited by discxpress

Share this post


Link to post
Share on other sites
49 minutes ago, discxpress said:

Also note that when you click save to favorites, an item is added to shopping cart. Thanks

I'm pretty sure that this only happens in some browsers.  You may want to find out where @kgtee has this installed and check the behavior there. 

Or post what browser you're using so people trying to debug can use the same one. 


Always back up before making changes.

Share this post


Link to post
Share on other sites
1 minute ago, ecartz said:

I'm pretty sure that this only happens in some browsers.  You may want to find out where @kgtee has this installed and check the behavior there. 

Or post what browser you're using so people trying to debug can use the same one. 

I use latest version of Chrome.

Share this post


Link to post
Share on other sites
28 minutes ago, ecartz said:

I'm pretty sure that this only happens in some browsers.  You may want to find out where @kgtee has this installed and check the behavior there. 

Or post what browser you're using so people trying to debug can use the same one. 

Same behavior in Firefox @ecartz

Share this post


Link to post
Share on other sites

From my understanding, all the work is done from this block of code

// BOF WISHLIST
// wishlist data
	if (!tep_session_is_registered('wishList') || !is_object($wishList)) {
		tep_session_register('wishList');
		$wishList = new wishlist;
	}
	
//Wishlist actions (must be before shopping cart actions)
  if (isset($_POST['wishlist'])) {
	  if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) {
      $attributes = isset($_POST['id']) ? $_POST['id'] : '';

        // php 5
//        $qty = isset($_POST['qty']) ? (int)$_POST['qty'] : 1;
        // php 7
         $qty = (int)($_POST['qty'] ?? 1);

      $wishList->add_wishlist($_POST['products_id'], $wishList->get_quantity(tep_get_uprid($_POST['products_id'], $attributes))+$qty, $attributes);
	  }
		if (WISHLIST_REDIRECT ==  'No') tep_redirect(tep_href_link('product_info.php', 'products_id=' . $_POST['products_id']));
	  tep_redirect(tep_href_link('wishlist.php'));
  }
// EOF WISHLIST

@kgtee @ecartz my php version is 7.3

Share this post


Link to post
Share on other sites
6 hours ago, ecartz said:

I'm pretty sure that this only happens in some browsers.  You may want to find out where @kgtee has this installed and check the behavior there. 

Or post what browser you're using so people trying to debug can use the same one. 

I have this installed on Chrome and it's still adding it to the shopping cart.

Share this post


Link to post
Share on other sites
8 hours ago, discxpress said:

I just installed your version. here's the errors:


Stack trace:
#0 /home/xxxxxxxxxx/public_html/includes/system/versioned/1.0.4.0/osc_template.php(147): cm_navbar->execute()
#1 /home/xxxxxxxxxx/public_html/includes/template_top.php(58): oscTemplate->getContent('navigation')
#2 /home/xxxxxxxxxx/public_html/index.php(35): require('/home/q4p7grzvy...')
#3 {main}
  thrown in /home/xxxxxxxxxx/public_html/includes/modules/content/navigation/cm_navbar.php on line 58
[18-Mar-2020 06:02:02 UTC] PHP Fatal error:  Uncaught Error: Class 'nb_wishlist' not found in /home/xxxxxxxxxx/public_html/includes/modules/content/navigation/cm_navbar.php:58
Stack trace:
#0 /home/xxxxxxxxxx/public_html/includes/system/versioned/1.0.4.0/osc_template.php(147): cm_navbar->execute()
#1 /home/xxxxxxxxxx/public_html/includes/template_top.php(58): oscTemplate->getContent('navigation')
#2 /home/xxxxxxxxxx/public_html/index.php(35): require('/home/q4p7grzvy...')
#3 {main}
  thrown in /home/xxxxxxxxxx/public_html/includes/modules/content/navigation/cm_navbar.php on line 58

Also note that when you click save to favorites, an item is added to shopping cart. Thanks

The correct class is nb_wish_list, and not nb_wishlist in my version. You may want to check and ensure consistency of the class name.

Share this post


Link to post
Share on other sites
4 hours ago, discxpress said:

From my understanding, all the work is done from this block of code


// BOF WISHLIST
// wishlist data
	if (!tep_session_is_registered('wishList') || !is_object($wishList)) {
		tep_session_register('wishList');
		$wishList = new wishlist;
	}
	
//Wishlist actions (must be before shopping cart actions)
  if (isset($_POST['wishlist'])) {
	  if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) {
      $attributes = isset($_POST['id']) ? $_POST['id'] : '';

        // php 5
//        $qty = isset($_POST['qty']) ? (int)$_POST['qty'] : 1;
        // php 7
         $qty = (int)($_POST['qty'] ?? 1);

      $wishList->add_wishlist($_POST['products_id'], $wishList->get_quantity(tep_get_uprid($_POST['products_id'], $attributes))+$qty, $attributes);
	  }
		if (WISHLIST_REDIRECT ==  'No') tep_redirect(tep_href_link('product_info.php', 'products_id=' . $_POST['products_id']));
	  tep_redirect(tep_href_link('wishlist.php'));
  }
// EOF WISHLIST

@kgtee @ecartz my php version is 7.3

The function of adding items to wishlist cart is done by the functions in includes/classes/wishlist.php. Just make sure you have this class file in the classes folder or any of the system/versioned folder so that it may be loaded by autoloader.php.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×