3

I'm looking for a solution that when Person A shares his wishlist (by email) with Person B, and Person B decides to buy this product for Person A the product has to be removed from the wishlish of Person A.

Any suggestions?

Tnx!

1

Well First of all Good Question...

Got rough Idea after dig into CoreCode...

After Submitting Share Wishlist it calls to SendAction of IndexController of Wishlist Module

For Items block in Email it calls to wishlist/share_email_items Block

You can just extend wishlist/share_email_items Block and override getAddToCartUrl() function

public function getAddToCartUrl($product, $additional = array())
{
    $additional['nocookie'] = 1;
    $additional['_store_to_url'] = true;
    $wishlist = Mage::registry('wishlist');
    $additional['code'] = $wishlist->getSharingCode();
    return parent::getAddToCartUrl($product, $additional);
}

Use controller_action_postdispatch to capture checkout_cart_add (when adding single product to cart from wishlist) and wishlist_shared_index

find code from parameter on above observers

$code=$this->getRequest()->getParam('code');
$wishlist = Mage::getModel('wishlist/wishlist')->loadByCode($code);
$customer_id= $wishlist->getCustomerId(); //Id of wishlist-customer

Set that Quote as wishlist quote in session.

Use sales_order_place_after Observer in that get order_id and check in session that current session is wishlist one or not. If its wishlist one then match order items with customer's wishlist ( whose Id got in post-dispatch observer )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.