Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Wishlist For Phoenix


tmcca

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

  • 2 weeks later...

@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
Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
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.

Link to comment
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

Link to comment
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

Link to comment
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.

Link to comment
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.

Link to comment
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.

 

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...