Error adding items to wishlist

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
eduardo.ponzoni
Ensign (ENS)
Ensign (ENS)
Posts: 8
Joined: Mon Oct 01, 2012 4:42 pm

Error adding items to wishlist

Post by eduardo.ponzoni » Mon Oct 01, 2012 5:03 pm

Hello! I'm trying to add items dynamically to the wishlist, from category pages, using a code which was created based on the one from WebUserControl "BuyProductDialog", and the code works fine, with no errors, but when I go to MyWishList page, it's displaying an error message saying that the item that I just added is no longer valid and has been removed from the wishlist. When I refresh the page, it really has been removed.

Can anybody please help me on that?

Thank you!

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: Error adding items to wishlist

Post by Logan Rhodehamel » Tue Oct 02, 2012 2:31 pm

Try adding the item from the buy product dialog, then add the item from your custom code but do not visit the wishlist page yet. Instead open up your database (if you have access?) and look at the ac_WishlistItems table. Can you spot any data differences between your item and the one added from the default control?
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

eduardo.ponzoni
Ensign (ENS)
Ensign (ENS)
Posts: 8
Joined: Mon Oct 01, 2012 4:42 pm

Re: Error adding items to wishlist

Post by eduardo.ponzoni » Tue Oct 02, 2012 3:40 pm

Hi Logan and thanks for that!

That was almost what I did... In ran my app in debug mode, and started comparing the WishlistItem that I was creating with the one created by AbleCommerce itself.
As soon as I could realize the differences, I could fix my code to actually set those properties to the wishlistitem before saving it, and it trully works!
Then I created a class called "WishlistHelper", so at any point I can have such feature to add products to the wishlist, just passing the product id.
I am adding the code I have created, so others might save a few time if something like that is needed.

Thanks again.

Cheers!

Post Reply