Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Wishlist 3.0 Support Thread


dblake

Recommended Posts

Dennis,

 

Yup, thanks once again to you, I got it!

 

Your input, again, once again - worked like a charm!

 

As well thanks to you I am learning some here. It seems, after being pointed in the right direction by someone who knows what he's doing - what's been difficult for me to figure out and/or understand, becomes obvious.

 

Sorry that you had to, and at the same time thank you... for taking the time to read several times what I wrote earlier, before you were able to understand what I was trying to explain.

 

It seems like every time I think I am done, something else pops up. My newest dilema:

 

Apparently because of the way I substituted the delete (small delete button with a hidden field) function for the check box in wishlist.php:

<!-- Modification -->
<?php							if($products['products_status'] == 0) {
?>					<td width="15%" align="center"><?php echo tep_image_submit('small_delete.gif', ' Delete From Wish List ', 'name="delete_prod" value="delete_wishprod"'); ?></td>
				<input type="hidden" name="add_wishprod[]" value="<?php echo $wishlist_id; ?>" />
<?php			   } else {
?>					<td width="15%" align="center" class="productListing-data"><?php echo tep_draw_checkbox_field('add_wishprod[]',$wishlist_id); ?></td>
<?php			   }
?>
<!-- /Modification -->

 

when adding to the cart any remaing item(s), which has/have not been temporarily removed in the admin section... the item, which has been removed (and now has the small delete button next to it) is included in the cart without a name but with its price calculated.

 

Makes sense because it's acting as if it's checked.

 

I haven't yet tried to see if/how I can fix it, but because you mentioned earlier that you had done something similar before, I was wondering if you knew right off of a better way of including this function?

 

I sure hope that I explained this dilema better than the last one! I also hope it's the last dilema!

 

Carlos

Link to comment
Share on other sites

LOL your too funny. ;)

 

Ok, look at your code and you will see why its doing this. You gonna have to rewrite some functions to make this work like you want but its a real easy rewrite. All you need to do is change the input name. Ok look at this for you delete button.

 

 <input type="hidden" name="add_wishprod[]" value="<?php echo $wishlist_id; ?>" />

 

Thats also the same name as the checkbox. So its checked essentially. You need a diff input. Maybe delete_wishprod[]? Then you need to change the delete function for the form to reflect this and that should solve your problem

 

-Dennis

 

P.S. I bet your like Ohhhhhhhhhhhhhhhhhhh, duhhh ;)

Edited by dblake
Link to comment
Share on other sites

Actually you may have to do it differently. You may have to specify the value (id number) in the delete button. Cuz if you were to press delete for one product, it will probably delete all the products. You know what I mean?

 

-Dennis

Link to comment
Share on other sites

Dennis,

 

I was hoping to get back here before you did so I could impress you!

 

I got to thinking along the same line you are pointing me in... what I've done is added:

/*******************************************************************
************* DELETE PRODUCT SEPARATELY FROM WISHLIST **************
*******************************************************************/

 if (isset($HTTP_POST_VARS['add_deleteprod'])) {
if(isset($HTTP_POST_VARS['delete_prod_x'])) {
	foreach ($HTTP_POST_VARS['add_deleteprod'] as $value) {
		$wishList->remove($value);
	}
}
 }

 

below:

/*******************************************************************
****************** DELETE PRODUCT FROM WISHLIST ********************
*******************************************************************/

 if (isset($HTTP_POST_VARS['add_wishprod'])) {
if(isset($HTTP_POST_VARS['delete_prod_x'])) {
	foreach ($HTTP_POST_VARS['add_wishprod'] as $value) {
		$wishList->remove($value);
	}
}
 }

 

and changed:

<input type="hidden" name="add_wishprod[]" value="<?php echo $wishlist_id; ?>" />

 

to:

<input type="hidden" name="add_deleteprod[]" value="<?php echo $wishlist_id; ?>" />

 

Seems to work!

 

Now I'm full of myself... until the next dilema anyways!

 

Thanks for all your help!

 

Carlos

Link to comment
Share on other sites

Dennis,

 

I was so busy congratulating myself, that I didn't take in your last words fully, till for some reason now - I'm still gonna have a problem if there is more than one product set inactive - aren't I...

 

Any advice as to how I can

specify the value (id number) in the delete button
?

 

Carlos

Link to comment
Share on other sites

Best way is to make it a link. I dont think there is another way. Basically you have your delete button next to each one. You gonna have to link it to a page to delete the product then redirect back to the wishlist. Like so:

 

<a href="<? echo tep_href_link('delete_prod.php', 'delete_id=' . $$idvalueofthatprod); ?>"><img src-"delete.gif"></a>

//delete_prod.php

/* regular beginning code */
$delete_id = $_GET['delete_id'];
$wishList->remove($delete_id);

tep_redirect(tep_href_link('wishlist.php'));

/* regular footer code */

 

That way it can be dynamic without having to redesign the forms on your page.

 

-Dennis

Link to comment
Share on other sites

Hi all ! I'm getting errors, one other person posted here, and I could not find the response.....

 

Warning: Invalid argument supplied for foreach() in /home/site/www/catalog/wishlist.php on line 117

 

Warning: Invalid argument supplied for foreach() in /home/site/www/catalog/wishlist.php on line 145

 

The lines are :

 

		//Check each posted name => email for errors.
	$j = 0;
	[b]foreach($HTTP_POST_VARS['friend'] as $friendx) {[/b]			if($j == 0) {
			if($friend[0] == '' && $email[0] == '') {
				$error = true;
				$email_errors .= "<div class=\"messageStackError\"><img src=\"images/icons/error.gif\" /> " . ERROR_ONE_EMAIL . "</div>";
			}
		}

 

and

 

		if($error == false) {
		$j = 0;
		[b]foreach($HTTP_POST_VARS['friend'] as $friendx) {[/b]
			if($friendx != '') {
				tep_mail($friendx, $email[$j], $subject, $friendx . ",\n\n" . $body, $from_name, $from_email);
			}

 

HELP ! ;-p

 

:thumbsup: I figured out what the problem was. (At least it works now for me ;) )

 

This is in reference to Installation instruction STEP 3 - Edit catalog/product_info.php

 

When I copied and pasted the code from the installation instructions, into my Product_Info.php file, it put all of the code on one line.

 

 

 

//DISPLAY PRODUCT WAS ADDED TO WISHLIST IF WISHLIST REDIRECT IS ENABLED if(tep_session_is_registered('wishlist_id')) { ?> <tr> <td class="messageStackSuccess"><?php echo PRODUCT_ADDED_TO_WISHLIST; ?></td> </tr> <?php tep_session_unregister('wishlist_id'); }

 

 

Like the above example^^

 

As you can see from the "//" it REM'd the entire line out.

 

 

 

Solution:

 

I broke up the code up so it was correctly layed out. (See Example below)vvvv

 

//DISPLAY PRODUCT WAS ADDED TO WISHLIST IF WISHLIST REDIRECT IS ENABLED

if(tep_session_is_registered('wishlist_id')) {

?>

<tr>

<td class="messageStackSuccess"><?php echo PRODUCT_ADDED_TO_WISHLIST; ?></td>

</tr>

<?php tep_session_unregister('wishlist_id');

}

 

If your code is correctly layed out, then I would run another SQL Query on with the following code:

(Pulled and copied from Wishlist 3d) You can grab it from the zip or use the below snip.

 

 

 

 

#

# Database table for `customers_wishlist`

#

 

CREATE TABLE `customers_wishlist` (

`products_id` tinytext NOT NULL,

`customers_id` int(13) NOT NULL default '0'

) TYPE=MyISAM;

 

#

# Database table for `customers_wishlist_attributes`

#

 

CREATE TABLE `customers_wishlist_attributes` (

`customers_wishlist_attributes_id` int(11) NOT NULL auto_increment,

`customers_id` int(11) NOT NULL default '0',

`products_id` tinytext NOT NULL,

`products_options_id` int(11) NOT NULL default '0',

`products_options_value_id` int(11) NOT NULL default '0',

PRIMARY KEY (`customers_wishlist_attributes_id`)

) TYPE=MyISAM;

 

 

INSERT INTO `configuration_group` ( `configuration_group_id` , `configuration_group_title` , `configuration_group_description` , `sort_order` , `visible` ) VALUES ( '12954', 'Wish List Settings', 'Settings for your Wish List', '25', '1' );

INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) VALUES ( '', 'Max Wish List', 'MAX_DISPLAY_WISHLIST_PRODUCTS', '12', 'How many wish list items to show per page on the main wishlist.php file', '12954', '', now(), now(), NULL , NULL );

INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) VALUES ( '', 'Max Wish List Box', 'MAX_DISPLAY_WISHLIST_BOX', '4', 'How many wish list items to display in the infobox before it changes to a counter', '12954', '', now(), now(), NULL , NULL );

INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) VALUES ( '', 'Display Emails', 'DISPLAY_WISHLIST_EMAILS', '10', 'How many emails to display when the customer emails their wishlist link', '12954', '', now(), now(), NULL , NULL );

INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) VALUES ( '', 'Wishlist Redirect', 'WISHLIST_REDIRECT', 'No', 'Do you want to redirect back to the product_info.php page when a customer adds a product to their wishlist?', '12954', '', now(), now(), NULL , 'tep_cfg_select_option(array(\'Yes\', \'No\'),' );

 

 

Hope this helps you out. Good luck.

 

John

Link to comment
Share on other sites

Hi,

 

It's me again. I noticed that after I add a product to a wishlist and then from a wishlist go to that product_info page, the link is http://store.com/osCommerce/product_info.php?products_id=44{3}5. Where is this "{3}5" coming from? Almost all my products when added to a wishlist have "{3}5". That curly brackets are not suppose to be there. This is what causes my error. Again my question is: is it somehow related to "wishlist" contrib?

 

Any ideas on that?

Thanks,

Irina.

Link to comment
Share on other sites

Dennis,

 

Basically you have your delete button next to each one.

I'm lost here. I just don't understand.

 

$$idvalueofthatprod

I have no idea what to do with this.

 

I have tried a whole bunch of different ways to mske a go of this, and nothing works, nothing makes sense to me.

 

Can you elaborate some?

 

Carlos

Link to comment
Share on other sites

Dennis,

 

For a few reasons, not the least of which is that I don't want to take up any more of your time with this, I have decided to take another approach.

 

Maybe when you have some free moments, you can let me know if you see any flaws in this somewhat different approach.

 

It seems, if I leave in the original slight modification, the addition of what I have now renamed from: DELETE PRODUCT SEPARATELY FROM WISHLIST" to "DELETE INACTIVE PRODUCTS FROM WISHLIST":

/*******************************************************************
************* DELETE INACTIVE PRODUCTS FROM WISHLIST ***************
*******************************************************************/

 if (isset($HTTP_POST_VARS['add_deleteprod'])) {
if(isset($HTTP_POST_VARS['delete_prod_x'])) {
	foreach ($HTTP_POST_VARS['add_deleteprod'] as $value) {
		$wishList->remove($value);
	}
}
 }

 

And then instead of removing the check box and adding a hidden field for the small delete graphic, I have just changed the values of the checkbox for products that have been set to inactive - to match the values in "DELETE INACTIVE PRODUCTS FROM WISHLIST":

<!-- Modification -->
<?php							if($products['products_status'] == 0) {
?>					<td width="15%" align="center" class="productListing-data"><?php echo tep_draw_checkbox_field('add_deleteprod[]',$wishlist_id); ?></td>
<?php			   } else {
?>					<td width="15%" align="center" class="productListing-data"><?php echo tep_draw_checkbox_field('add_wishprod[]',$wishlist_id); ?></td>
<?php			   }
?>
<!-- /Modification -->

Now, it seems anyways, when a customer checks the check box of an inactive product and trys to add the product to the shopping cart - nothing happens, but if they delete it - it deletes, individually even!

 

Thanks again for all your generous attention and time in helping me get this marvelous Wish List contribution set-up in my heavily modified OSC application... It is much appreciated!

 

Regards,

 

Carlos

Link to comment
Share on other sites

Hi,

 

I have an old code left from "Wishlist 2.3" in my files. Should I keep it or remove it. Is Wishlist 3.5 supports previous Wishlist 2.3? Are they two independent modes? May be this is what causes my problems: "<osCsid>" in my product path http://store.com/osCommerce/product_info.p...&<osCsid> and curly brackets in url, http://store.com/osCommerce/product_info.p...ducts_id=44{3}5. I didn't have these problems before.

 

Thanks,

Irina.

Link to comment
Share on other sites

Ok Irin,

 

the <osCsid> is your session id name and then the number following that is the session id. This is not a problem and normally is gone after a cookie is set for the user and the will remove that number. The number is still there only stored in the cookie. If you disable cookies, that number will always be present.

 

Now about the 44{3}5:

 

That is the actual product number. Main product is 44, attribute id is 3, and the attribute value is 5.

 

Now are you clicking from the wishlist page on the product name? Then its taking your to product_info.php and giving you that error? What happens if instead of adding to wishlist you add a product to the shopping cart that has attributes? Then click on that link and go back to the product_info.php page from the shopping cart. Do you get the same error? I am pretty sure you do because of the product bundle modification.

 

Let me know,

Dennis

Link to comment
Share on other sites

Hi All,

 

Just added the latest version of the Wishlist - thanks for taking the time to repackage it, Dennis. I will get working on the new help file right away.

 

I have 2 quick questions:

 

On the wishlist.php page, the form for putting in your friend's name and address is titled "Your Name" and "Your E-mail". This should be "Friends Name" and "Friends E-mail", but I can't seem to find where it's defined - can anyone give me a quick hint. :-)

 

Also, after I go through check-out, I have to log out, close the browser, bring up a new browser and log back in before the products leave my Wishlist. So they are getting deleted, but it's not registering immediately. Does anyone else have this problem? Any ideas where I might find the source of this if it's just me? I can't figure out why it doesn't immediately register that the products should go away.

 

Thanks for any help!

Adrienne

Link to comment
Share on other sites

Ok I will look at that, I think I know why. The wishlist for customers is stored in the database and in the session. I think when the checkout goes, it deletes from the db, but doesn't delete from the current session. Dunno if that makes sense to you, but i know why and I will have a fix up today.

 

Also if your a guest, thats the only time you should see "Your Name" and "Your Email" right? Those are "your" information because the server needs to know who is sending the information. Make sense?

 

-Dennis

Link to comment
Share on other sites

Ok Jeff I think I have a fix for you, I havent tried it so do you mind? ;)

 

Open checkout_process.php find

 

  $wishList->remove();

Change to:

  $wishList->clear();

 

 

Then open up includes/classes/wishlist.php Find this function

	function clear() {
global $customer_id;

	// Remove all from database
	  if (tep_session_is_registered('customer_id')) {
			  $wishlist_products_query = tep_db_query("select products_id from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . $customer_id . "'");
		  while($wishlist_products = tep_db_fetch_array($wishlist_products_query)) {
			tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $wishlist_products[products_id] . "' and customers_id = '" . $customer_id . "'");
			tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $wishlist_products[products_id] . "' and customers_id = '" . $customer_id . "'");
		  }
	}
}

And change to

	function clear() {
global $customer_id;

	// Remove all from database
	  if (tep_session_is_registered('customer_id')) {
			  $wishlist_products_query = tep_db_query("select products_id from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . $customer_id . "'");
		  while($wishlist_products = tep_db_fetch_array($wishlist_products_query)) {
			tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $wishlist_products[products_id] . "' and customers_id = '" . $customer_id . "'");
			tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $wishlist_products[products_id] . "' and customers_id = '" . $customer_id . "'");

			// Remove from session
			unset($this->wishID[$wishlist_products[products_id]]);				
		  }
	}
}

 

Let me know if that works, then I will update the files to 3.5e.

 

-Dennis

Link to comment
Share on other sites

Dennis,

 

Wow, thanks for the quick response! Yes, I understand about the session versus db, but have no idea how to fix that. Thanks for looking into it. :D

 

The Your Name and Your E-mail that I was referring to is showing up on every line of the list of boxes that the Wishlist will be sent TO. So I see it 5 times on a page - it should say Friends Name and Friends E-mail I imagine, but can't figure out where that's set or what I did wrong to make it just say Your Name over and over again instead of Friends Name.

 

Any ideas?

Adrienne

Link to comment
Share on other sites

I didnt notice your name on the end of the post and went off "Jeff" thats in your profile info. My appologies Adrienne.

 

That information your referring to is in the language file. Ill look into why that says "your" instead of just name.

 

-Dennis

Link to comment
Share on other sites

Dennis,

 

No problem - Jeff is my husband, he does most of the coding, but it's my shop and I do the design/layout and everything else. He signed up for an account here, and I just started piggy backing on it rather than creating a new one. :-)

 

That code didn't work. The Wishlist was already set to Clear, not to remove - so there was no change to that first line. This code did accidently remove the "Item in Cart" message from the Wishlist.php page, but it didn't fix the session problem. I'd like to help you with some ideas that might fix this, but I'm at a loss (and so is Jeff, I asked him first. :-)

 

Thanks for the help,

Adrienne

Link to comment
Share on other sites

Hmm, that should of worked i thought LOL, ok let me test this myself and I will post what i find.

 

//UPDATE

 

Hmm, this worked for me. What exactly is the problem? Here is what I did. Logged into a test account (my test site), added three things to my wishlist, then from the wishlist added two things to the cart. The items showed, "Item in Cart" then I checked out. It removed the two products I added to the wishlist from the session and the db. I even checked diff attributes with one product and that worked too.

 

-Dennis

Edited by dblake
Link to comment
Share on other sites

Hmm, that should of worked i thought LOL, ok let me test this myself and I will post what i find.

 

//UPDATE

 

Hmm, this worked for me. What exactly is the problem? Here is what I did. Logged into a test account (my test site), added three things to my wishlist, then from the wishlist added two things to the cart. The items showed, "Item in Cart" then I checked out. It removed the two products I added to the wishlist from the session and the db. I even checked diff attributes with one product and that worked too.

 

-Dennis

 

Ok, let me try it again. There is always the chance that it is conflicting with another contribution from my checkout system. What happened the first time was that I added things to checkout, lost the "Item in Cart" message that worked fine before, checked out and still had the items in my wishlist until I logged out and logged back in. But as I said - I have made some changes to the checkout, so perhaps it's on my end.

 

Will post an update after more testing...

 

Adrienne

Link to comment
Share on other sites

Na shouldn't conflict with anything in the checkout. All the function does is query the table customers basket, to get the contents of whats in there cart. Then it removes that product number out of the wishlist table and out of the session. Nothing should conflict.

 

-Dennis

Link to comment
Share on other sites

Ok, one problem solved. It turns out I had another contribution that had already defined "TEXT_NAME", which just so happed to be set as "Your Name". DOH! So I changed the variable to "TEXT_WISHLIST_NAME" in both Wishlist.php files, and now it works fine. Ah, the challenges of heavily modified stores!

 

Anyway, this was not a problem with your code. Sorry for the false alarm.

 

Still testing the second problem...

 

Adrienne

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.
Note: Your post will require moderator approval before it will be visible.

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