Jump to content

Wishlist module not creating new wishlist on registration


Recommended Posts

  • 1 month later...
  • 3 months later...

I found a solution.

 

Let me first mention that Wishlist shall not be created at the moment of customer registration, because the Wishlist module is not mandatory and may not be installed. Instead the default wishlist behavior shall be set within the module blockwishlist. To do that in modules/blockwishlist/blockwishlist.php, in the function hookRightColumn, line 188 (for PS version 1.5.6.0) - there is if statement:

if (!sizeof($wishlists)) 
   $id_wishlist = false;

It shall be replaced with:

if (!sizeof($wishlists)) 
{
                    
            $wishlist = new WishList();
            $wishlist->id_shop = 1;
            $wishlist->id_shop_group = 1;
            $wishlist->counter = 1;
            $wishlist->name = 'my wishlist';

            $wishlist->id_customer = (int)($this->context->customer->id);
            list($us, $s) = explode(' ', microtime());
            srand($s * $us);
            $wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true)._COOKIE_KEY_.$this->context->customer->id), 0, 16));
            $wishlist->add();
            $this->context->cookie->id_wishlist = (int)($wishlist->id);    
            
            $id_wishlist = (int)($wishlist->id);
}
Link to comment
Share on other sites

Hi Eli, thank you for modification, I'll test it soon.

By the way I noticed a couple issues with the wish list that, maybe, you are able to solve (I don't know if it's just me with this issue or is the normal way it works):

 

1. when a customer clicks on "add to wish list" on the product page, if there is no wish list created, he doensn't receive any message. It will be usefull if a message pop up (ie. "To add a product to the wish list, you first need to create one. Click on the button to create your wish list") and then the customer is redirected to the wish list page to create it.

 

2. if I click on add to wish list, I don't see any message "ADDED to your wish list".. it works but it's not visible. So, I think it doens't work and click again and again... I'll have more than one item in the wish list but, unless I go there to check, I don't know it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...