Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Wishlist 3.0 Support Thread


dblake

Recommended Posts

Not sure if anyone has told you Dennis but this fix worked for me!! Thanks bunches for a wonderful contrib :thumbsup:

 

Sheri

 

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

(sorry I posted this twice, now it is in the right place :blush: )

 

Wishlist 3.5 is a GREAT contribution.

 

Because of design requirements, we need a text link "Add to Wishlist" instead of the button wich is working now. [Please don't suggest to make a image button that look like text, this will be my final option]

 

My first try was setting an anchor with js link: "java script:add2wishlist()", where "add2wishlist" look like this:

 

function add2wishlist() {

some.variable.settings;

document.cart_quantity.submit();

}

(of course, this didnt work)

 

After a while, I realized that some $_POST variables where missing. If the form is submitted with the button

[i.e. -> echo tep_image_submit('button_wishlist.gif', 'Add to Wishlist', 'name="wishlist" value="wishlist"') ]

 

you will get the following $_POST variables:

 

products_id = xx

wishlist_x = xx

wishlist_y = xx

wishlist = wishlist

 

... wich are used to redirect to wishlist.php.

 

In order to write the right js function, I need to know where the hell are set wishlist_x and wishlist_y. I looked for them with a magnifier into the wishlist.php class, wishlist.php and wishlist_public.php and didnt find them.

 

Please help me choosing (and completing) one of the following:

 

a.) You are blind, wishlist_x and wishlist_y are set here in ...

b.) You are stupid, why are you doing this like this? Try ...

c.) You are a dreamer, this cannot be done. Kill the graphic designer.

 

Thanks !!!

 

Albert

Link to comment
Share on other sites

(one little push to the top :-" )

 

This is a summary of the post above:

 

Flattering:

I love Wishlist 3.5 . it IS a nice contribution.

 

Problem:

Graphic Designer is driving me nuts because he wants a "Text Link" instead of "Button Link" for "Add to wishlist".

 

Discovering:

Because of some i-cant-find-where-are-they-set $_POST variables (wishlist_x & wishlist_y) making a text link is not so trivial.

 

Help needed (Choose one):

a.) A map: "here are your lost variables"

b.) A reset button: "start from beggining and do it this way ..."

c.) A rope: "tie your designer to a cow tail"

 

Thanks

 

Albert

Link to comment
Share on other sites

(one little push to the top :-" )

 

This is a summary of the post above:

 

Flattering:

I love Wishlist 3.5 . it IS a nice contribution.

 

Problem:

Graphic Designer is driving me nuts because he wants a "Text Link" instead of "Button Link" for "Add to wishlist".

 

Discovering:

Because of some i-cant-find-where-are-they-set $_POST variables (wishlist_x & wishlist_y) making a text link is not so trivial.

 

Help needed (Choose one):

a.) A map: "here are your lost variables"

b.) A reset button: "start from beggining and do it this way ..."

c.) A rope: "tie your designer to a cow tail"

 

Thanks

 

Albert

 

There isn't a wishlist_y.

 

wishlist_x in reality is just wishlist.

 

If you look at the original button, the name="wishlist" value="wishlist" is where it is set. The problem with javascript. You have to define the variable in the form. So you would need to add in <input type="hidden' name="wishlist" />. But by doing this, when ever you submit that form, the wishlist_x will always be set. Therefore nothing will nvr get to the cart.

 

Workaround/Fix:

Change this line in application_top.php:

 if(isset($HTTP_POST_VARS['wishlist_x'])) {

To

 if(isset($HTTP_POST_VARS['wishlist_x']) && $HTTP_POST_VAR['wishlist_x'] == 'yourvalue') {

 

This way when u submit your form with javascript, you will need to specify a value for the wishlist input. As to prevent by clicking on add to cart, it doesn't skip to add to wishlist, as that value won't be set.

 

-Dennis

Link to comment
Share on other sites

Hello all.

 

I am considering installing this great contribution. I have a quick question. I didn't see an admin folder in the arhive ... is there not an admin part for this mod? I was under impresion that somwehere along the line someone added the admin functionality to teh contribution.

 

Also, is Wishlist 3.5d from 25 Oct 2005 a FULL package?

 

Best regards,

 

Arkady

Edited by Voland

People dont change, people realize.

Link to comment
Share on other sites

Hello again.

 

I have sucesefully installed the contribution. The instructions were superb! Thank you.

 

I started testing and the problem I'm having is this: After emailing the wishlist from wishlist.php and accessing the wishlist_public.php - unable to add to cart from it. After the checkbox(es) is(are) checked and the Add to Cart button is clicked I get redireted to index.php and nothing gets added to cart.

 

I have look thorugh the code of wishlist_public.php ... but my php skills are way to weak to spot wher the problem is. Can someone help please

 

Arkady

Edited by Voland

People dont change, people realize.

Link to comment
Share on other sites

Hi Dennis,

 

Thanks a lot for the hint. When someone finds the solution, it always looks pretty obvious ...

Here is the summary:

 

1) Create the js function (and put it in the right place into product_info.php)

 

function add2wishlist() {
 document.cart_quantity.wishlist.value = "myvalue";
 document.cart_quantity.submit();
}

 

2) Insert the hidden field "wishlist" .The value is not relevant, in fact only must be different from the value in "add2wishlist()".

 

  echo tep_draw_hidden_field('wishlist', 'wishlist');
 echo '<a href="java script:add2wishlist()" >'.TEXT_ADD_TO_WISHLIST.'</a>';

 

3) Catch the wishlist submit (aplication_top.php):

 

//Wishlist actions (must be before shopping cart actions)
 if(isset($HTTP_POST_VARS['wishlist']) && ($HTTP_POST_VARS['wishlist']=='myvalue')) {
 ...

 

Thanks again.

 

Regarding to wishlist_x and wishlist_y here goes my tale to xfiles:

 

Sometimes, just for debbuging, I use the following POST and GET catchers at the very end of header.php:

 

while (list($key,$value)=each ($_POST)){
 echo 'POST-> ' .$key . ' = ' . $value . '<br>';
}
while (list($key,$value)=each ($_GET)){
 echo 'GET-> ' .$key . ' = ' . $value . '<br>';
}

 

When i was working with Wishlist 3.5, I put these catchers at the very beginning of aplication_top.php, and i got something like this after clicking "Add to wishlist" button:

 

POST-> products_id = 24

POST-> wishlist_x = 52

POST-> wishlist_y = 11

POST-> wishlist = wishlist

GET-> products_id = 24

GET-> action = add_product

GET-> osCsid = 6476206755d3ee8c9cdc40a9ed8f449f

 

Warning: session_start(): ... headers already sent ...

(I understand the problem with session_start() )

 

Here was where I saw the infamous ;) wishlist_x and wishlist_y. Although my problem is solved and I dont want to waste anybody time, I wonder where the **** these variables came out. I could not figure it out.

 

Albert

Edited by Albert3d
Link to comment
Share on other sites

I don't fully understand it myself but I think it has something to do with the submit button having a name="wishlist". Never really explored it. I was getting a problem with my code on application_top.php not catching the isset($_POST['wishlist']) on IE. But it worked fine in FF. Read a clue and it said to add an '_x'. It worked, so I didn't figure out the real reason why. If you do let me know ;)

 

Dennis

Link to comment
Share on other sites

I have recently installed Wishlist 3.0 and it is working great. However, I was wondering is someone could help me modify it a bit.

 

I've changed it from a "wish list" to a "send sample" list. I would like it if the mailto field would already be filled in with the store's email address. You can take a look at my site to get a better idea of what I mean. http://irc35.com . *In order to see the email information be sure to add a product to your send sample list and then look at the list.

 

Instead of sending it to 1-10 friends, I want them to to send it just to me. This way I can know which products they are interested in and then I can get those sample's out to them asap.

 

If you can offer any help I would much appreciate it. I've trying to do it for like 2 days on my own with no success.

 

jalopyhead

Link to comment
Share on other sites

.

Hello again.

 

I have sucesefully installed the contribution. The instructions were superb! Thank you.

 

I started testing and the problem I'm having is this: After emailing the wishlist from wishlist.php and accessing the wishlist_public.php - unable to add to cart from it. After the checkbox(es) is(are) checked and the Add to Cart button is clicked I get redireted to index.php and nothing gets added to cart.

 

I have look thorugh the code of wishlist_public.php ... but my php skills are way to weak to spot wher the problem is. Can someone help please

 

Arkady

... Guys I am still having the problem I described earlier. Does any one have any ideas how to resolve it. I am at a dead-end here.

People dont change, people realize.

Link to comment
Share on other sites

Hello again :)

 

Ok I have isolated the behaivior to the follwing line in wihlist_public.php which is the third PHP statement in the document from the top (Line 13 in my file)

if(!isset($_GET['public_id'])) {
  tep_redirect(tep_href_link(FILENAME_DEFAULT));
}

Does this mean that if the person who is veiwing the public wisjlist not logged in, they cannot add to cart? Is that the intended behavior? If so then isn't it better to send them to login.php? Although I hope that's not the case :).

 

What is that line there for anyway?

 

Anyone please, some input :'(

Edited by Voland

People dont change, people realize.

Link to comment
Share on other sites

Ok some progress ...

 

I removed the line in question.. and viola! The problem dissapeared. However I am still not comfortable becasue I still dont know what that line was there for in teh first place. Although it seems that it is just a simple IF statement to check for the 'public_id' string in the URL. But why would you wanna send the customer somewhere while they are adding products to cart? If anyone has the ability to clarify my confusion. Id really appreciate it.

 

Arkady

Edited by Voland

People dont change, people realize.

Link to comment
Share on other sites

Yes its the string to check to make sure the public id is in the URL which it has to be. How else you going to determine who's wishlist your looking at?

 

OK, makes sence, although then why do we send the person to tep_href_link(FILENAME_DEFAULT)?

Edited by Voland

People dont change, people realize.

Link to comment
Share on other sites

You made no changes?

 

DO you mean the file edits? Yes I edited all teh files as per instructions. They were very clear by the way (esxcelent work :) ). And then obviosly uploaded all the new files

Edited by Voland

People dont change, people realize.

Link to comment
Share on other sites

Why not?

 

Well Im not sure. I'm not trying to argue :). Just having a hard time understanding, since I'm not really a programmer. From what I understand tep_href_link(FILENAME_DEFAULT) sends the customer back to teh home page of the site. Thathappens rigt after they click on the Add to Cart button in teh public wishlist and nothing gets added to the cart. When I removed that line I still get to see who's public wishlist im on and after clicking the add to cart I'm being redirected to teh shoping cart where i can see teh items added. Take a look for yourself :) http://www.mindphantom.com/shop/wishlist_p...php?public_id=3

 

Arkady

People dont change, people realize.

Link to comment
Share on other sites

The problem is your code. You have two forms for the quick find and one is never closed. Fix that you should be fine.

Do you mean the one in my header?

Yeah I was trying to implement that quck find box on my own and tehr eis a good chance I messed up somwhere. I'll go dig into it right now. Can you clerify for me what you mean by "never closed" please? You mean the </form> tag?

Edited by Voland

People dont change, people realize.

Link to comment
Share on other sites

Actually do this open wishlist_public.php file on line 68

 

Change

$_PHP_SELF

 

to this

tep_href_link('wishlist_public.php', $public_id)

 

For some reason your php_self isnt adding in the public_id variable. Anyway try that let me know.

Link to comment
Share on other sites

Actually do this open wishlist_public.php file on line 68

 

Change

CODE

$_PHP_SELF

 

There isn't such code in my wishlist_public.php.

Edited by Voland

People dont change, people realize.

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