cancel
Showing results for 
Search instead for 
Did you mean: 

how to get the wish list item option in magento plugin

how to get the wish list item option in magento plugin

how to get the wish list item option in magento plugin

I used the event Observer 

    <event name="controller_action_predispatch_wishlist_index_remove">
        <observer name="mytech_observer_wishlistremove" instance="Sanjay\Wish\Observer\Wishlistremovedispatch" />
    </event>

Observer Code 

    public function execute(EventObserver $observer)
    {
        // $this->helper->log("wishlistremove", json_encode( get_class_methods($observer->getEvent()->getObservers()), JSON_PRETTY_PRINT));
        try {
            $productId = '';
            $item      = $this->_request->getParam('item');
            $wish_item = $observer->getEvent()->getItem();
            if ($item) {
                // $this->helper->log("wishremove", "insdie wish remove item ");
                //Load product from wishlist item list
                $itemData      = $this->wishlistItem->load($item);
                $qty           = (int) $itemData->getQty();
                $productId     = $itemData->getProductId();
                // // variant

        $this->helper->log("wishlistremove", __LINE__. json_encode($item ." = ". $productId, JSON_PRETTY_PRINT));

         $catalogAttributes = $this->catalogConfig->getProductAttributes();
        $wishlistAttributes = $this->attributeConfig->getAttributeNames($itemData);
        $wishremovevariant =  array_merge($catalogAttributes, $wishlistAttributes);
        $wish_options = $this->_wishlOptionCollectionFactory->create()->addItemFilter($itemData);
        $wish_options->addFieldToFilter('code', 'attributes');
        $this->helper->log("wishlistremove", __LINE__. json_encode($wish_options, JSON_PRETTY_PRINT));
           }
2 REPLIES 2

Re: how to get the wish list item option in magento plugin

so you can go ghetto and edit: nano app/code/Magento/Wishlist/Controller/Index/Cart.php or nano vendor/magento/module-wishlist/Controller/Index/Cart.php

depending on how you installed , then find (ctrl-w):

$item->addToCart($this->cart, true); and change it to

$item->addToCart($this->cart, false);

then restart php-fpm ( service php-fpm reload )

and try it out.

Then if you are successful, try to make a patch using a module!

Culver's Guest Satisfaction Survey

You got it?

Re: how to get the wish list item option in magento plugin

1  On the Admin Panel, Stores > Settings > Configuration .
2  Under Customer , click Wish List tab.
3  Open the General Option section, choose Yes to enable the list.

NGS Connex Login