Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Wishlist 3.0 Support Thread


dblake

Recommended Posts

Dennis,

 

It's coming along...

 

I cannot get the group to come up. If I insert the following query, mimicked from admin/customers.php:

$group_name_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id ");
$customers = tep_db_fetch_array($group_name_query);

 

It comes up, but not linked to the customer, so useless... what do I do so that it's linked and has the correct group?

 

Carlos

Link to comment
Share on other sites

Irin original message

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '{4}12 and language_id = '1'' at line 7

 

SELECT pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_price, p.products_image FROM products p INNER JOIN products_description pd ON p.products_id=pd.products_id INNER JOIN products_bundles pb ON pb.subproduct_id=pd.products_id WHERE pb.bundle_id = 56{4}12 and language_id = '1'

 

[TEP STOP]

 

Dblake Reply

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

 

 

Ok, I have a simular problem but mine is caused by the option product attribute contrib http://www.oscommerce.com/community/contributions,160 I have added on that allows you to have customized text for imprinting submited by the customer. It works fine in the shopping cart but then behaves like Ian described when added to the wishlist.

 

DBlake, I think we just need to "cleanse" the product id number to fix this and future errors. What of those described attribute parameters are in the base install (are all of them?) and what attributes did his contrib add on so I know what to clean off the product id? We may lose the attributes however I fear...

Edited by homewetbar

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

Link to comment
Share on other sites

Please disregard the previous message, I am not having the error messages now, the attributes just don't carry over but I will fix that later.

 

Here is the problem I'm experiencing on my test site that I need help with:

When I am not logged in and add items to my wish list they show up fine, then when I log in those seem to replace the items that were already in the wish list! However when I email my wish list and you click on the view public list they are there again in the public list! Log in again and only the most recent show up in whishlist.php... I double checked the directions to be sure I didn't miss something but everything is there. Very strange, what could be causing this?

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

Link to comment
Share on other sites

Its more than just a quick fix, if you know nothing of php you won't be able to add it, as you will need to add a new case in application_top.php. But if you want to dive in, just follow the example of the case "buy_now".

 

-Dennis

 

 

Dennis, I suppose we all cant be in the PHP Pro club! LOL I looked at the application_top , ROTFL!!! Waaaayyyy over my head, I found where I had added this (per install instructions):

//Wishlist actions (must be before shopping cart actions)
 if(isset($HTTP_POST_VARS['wishlist_x'])) {
if(isset($HTTP_POST_VARS['products_id'])) {
	if(isset($HTTP_POST_VARS['id'])) {
		$attributes_id = $HTTP_POST_VARS['id'];
		tep_session_register('attributes_id');
	}
	$wishlist_id = $HTTP_POST_VARS['products_id'];
	tep_session_register('wishlist_id');
}
tep_redirect(tep_href_link(FILENAME_WISHLIST));
 }

 

 

There was TWO instances of "buy_now": (LINE 344)

 } else {
  $goto = basename($PHP_SELF);
  if ($HTTP_GET_VARS['action'] == 'buy_now') {
	$parameters = array('action', 'pid', 'products_id');
  } else {
	$parameters = array('action', 'pid');

 

(Line 385)

 

	  // performed by the 'buy now' button in product listings and review page
  case 'buy_now' :		if (isset($HTTP_GET_VARS['products_id'])) {
							if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
							  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
							} else {
							  $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
							}
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;

 

I couldnt decipher it all.

 

Thank you for trying to point me in the right direction, If anyone happens to add this to thier site please let me know,

 

Tammy

Link to comment
Share on other sites

Further, if you already have an account with no items in the wish list, browse the site and add the items to your wish list and THEN login the items you had in the wish list before logging in will show in your wish list but will not be saved when you log out.

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

Link to comment
Share on other sites

Please disregard the previous message, I am not having the error messages now, the attributes just don't carry over but I will fix that later.

 

Here is the problem I'm experiencing on my test site that I need help with:

When I am not logged in and add items to my wish list they show up fine, then when I log in those seem to replace the items that were already in the wish list! However when I email my wish list and you click on the view public list they are there again in the public list! Log in again and only the most recent show up in whishlist.php... I double checked the directions to be sure I didn't miss something but everything is there. Very strange, what could be causing this?

 

 

I can't duplicate this problem. When you add something to the wishlist, (not logged in) it stores that info in the session. When you login, it moves all the session stuff to the database, destroys the wishList session, then re-queries the db and puts it all back in the session. And thats the function restore_wishlist() in the includes/classes/wishlist.php file.

 

I don't see where you would have the this problem unless you missed a step. Did you add this function to login? and create_account?

 

-Dennis

Link to comment
Share on other sites

Thanks for the quick reply denise!

 

You're right it was the login and create account, since I have both the login and create account on one page there are TWO instances of

// restore cart contents

$cart->restore_contents();

per file in which I had to add the

// restore wishlist to sesssion

$wishList->restore_wishlist();

to under each one instead of just one.

 

 

Now about the attributes not carrying over, I've read alot of your dialog between you carlost, and hubcat but it got pretty confusing, did you ever find our why the attributes were not showing and did you come up with a method to delete the products from the wish list and admin properly when they have attributes attached?

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

Link to comment
Share on other sites

Sorry Dennis I totally mis-spelled your name! (long week I think! >_< )

 

One more question in addition to the one above,

After you send the email I see you have some code to clear out the blanks, however if you just refresh the page it resends all of the emails again, essentially making your server a possible spam machine. Is there anyway to 1 completly clear this out so you cannot just refresh 2 when not logged in limit the times someone can send out their wishlist to people so folks don't just put a marketing message in the box and autopopulate the fields using it to send spam? I know it sounds crazy but it happens all the time...

 

Thanks!

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

Link to comment
Share on other sites

Well you can add a check to the session, but if someone is using a script to spam then it won't start a session. Yea I dunno how to stop that at the moment. I'll think on it.

 

-Dennis

 

EDIT:

 

Actually I think you could add a check to the session and when the wishlist gets sent, it makes it a '1' for example. Then each time it goes to send the wishlist, run it through that check and if its been set to 1 then error out saying wishlist can only be sent once each session.

 

Then to prevent spiders/scripts from using it, run the user browser agent check and if its a spider, don't allow them to use the email function at all.

Edited by dblake
Link to comment
Share on other sites

Now about the attributes not carrying over, I've read alot of your dialog between you carlost, and hubcat but it got pretty confusing, did you ever find our why the attributes were not showing and did you come up with a method to delete the products from the wish list and admin properly when they have attributes attached?

 

Crazy thing about this I just discovered is it will not display the attributes when logged in but when you add it to the cart the attributes are there which is fine HOWEVER when you view the public profile and add the item to the cart the attributes do not show and they are NOT carried over into the shopping cart. Why is this? What is different in the public wishlist that is causing this?

 

Thanks so much for your help I really appreciate it!

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

Link to comment
Share on other sites

One more thing that might help, this is how it is storing the attributes in the customers_wishlist_attributes table under products_id it is

59{txt_6}custom text

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

Link to comment
Share on other sites

You need to take my wishlist code, then mimick the case 'buy_now'. So basically you add in a new case, say case 'add_to_wishlist' and go from there.

 

 

Thank You Dennis for your time and thoughtfulness, but it appears I was correct the first time, I am way over my head on this one. I tried putting a new "case" in the application top, but was unsuccessful. I ended up with all types of errors... I went back to my original Application_top.

 

 

I will just have to wait untill someone else needs this, and hope they post instructions on how they did it.

 

Your contribution is great! Hubby is laid off right now, but when he gets back to work, I'll be sure to send a contribution.

 

 

Thank you!

Tammy

Link to comment
Share on other sites

Hi

I try to set this wish list..

 

STEP 2 - Run the provided wishlist.sql file

This file will update your database and add the tables "customers_wishlist" and "customers_wishlist_attributes"

 

the file that i have is a sql but i cannot RUN it.. he just open in notepad... so I can't do anything with it.. it is ok??

:huh:

Link to comment
Share on other sites

I dont know anything about php, but I am slowly learning. If someone could just point me in the right direction, I would be forever grateful. I'm just completely lost as to where to start.

 

Tammy

 

Hey Tammy,

 

As Dennis mentioned, by mimicking the buy_now case in includes/application_top.php, you can do, as you want to do.

 

I, like you it seems, often need a little more detail - and I'm guessing it's a little trying sometimes on those who have a lot more experience, to get down to the details sometimes needed by those with way less experience.

 

I think I have taxed Dennis to the bone with my continued requests for more detail! Despite my pestering, he's been more than generous with his time, and, I have managed to learn from his sometimes brief explanations.

 

Anyhow, to the point...

 

In includes/application_top.php, BELOW:

	  // performed by the 'buy now' button in product listings and review page
  case 'buy_now' :		if (isset($HTTP_GET_VARS['products_id'])) {
							if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
							  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
							} else {
							  $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
							}
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;

 

INSERT:

// <!-- Wish List -->
case 'add_to_wishlist' :	if (isset($HTTP_GET_VARS['products_id'])) {
							if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
							  tep_redirect(tep_href_link(FILENAME_PRODUCT, 'products_id=' . $HTTP_GET_VARS['products_id']));
							} else {
							  $wishList->add_wishList($HTTP_GET_VARS['products_id'], '');
							}
						  }
						  tep_redirect(tep_href_link('wishlist.php', tep_get_all_get_params($parameters)));
						  break;
// <!-- /Wish List -->

 

Then, anywhere you have a buy_now link - copy the complete link, and in the copied code REPLACE:

action=buy_now&products_id=

WITH:

action=add_to_wishlist&products_id=

 

Then replace the button graphic and the alt text, in the new add_to_wishlist link, and place the add_to_wishlist link before or after your original buy_now link.

 

Your new link should look something like this:

'<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_to_wishlist&products_id=') . '">' . tep_image_button('button_add_wishlist_small.gif', ' Add to Wish List ') . '</a>'

You'll need to pay attention to the beginning and end - as to whether you need comas, which will depend on where you place it.

 

Doing it this way, it will show or not in the same way buy_now does via the admin setting. And it will act similarly in that if a product has attributes it will redirect to the Product Info page (product_info.php) and if there are no attributes it will go directly to the Wish List.

 

If you dwell on it some, and you have even a little bit of experience, which you just about have to get from messing around with OSC, you should be able to modify it according to what you want exactly.

 

G'luck!

 

Carlos

Link to comment
Share on other sites

Made a slight mistake with the includes/application_top.php INSERT: FILENAME_PRODUCT - should be: FILENAME_PRODUCT_INFO.

 

So, the whole correct INSERT:

// <!-- Wish List -->
case 'add_to_wishlist' :	if (isset($HTTP_GET_VARS['products_id'])) {
							if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
							  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
							} else {
							  $wishList->add_wishList($HTTP_GET_VARS['products_id'], '');
							}
						  }
						  tep_redirect(tep_href_link('wishlist.php', tep_get_all_get_params($parameters)));
						  break;
// <!-- /Wish List -->

 

Carlos

Link to comment
Share on other sites

Yet another mistake in the first posting! Geez...

 

comas should be apostrophes

 

So it should read:

 

You'll need to pay attention to the beginning and end - as to whether you need apostrophes, which will depend on where you place it.

 

Carlos

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