66

In Magento 2, you can actually now remove Compare products functionality via xml file. Compare products block is defined in vendor/magento/module-catalog/view/frontend/layout/default.xml and you can remove it by adding a default.xml file to your theme in: <theme_dir>/Magento_Catalog/layout/default.xml inside which you remove your block as following: ...


37

You can add following xml instruction to either your custom theme's default xml file which should be located at /app/design/frontend/Vendor/theme/Magento_Theme/layout/default.xml or to Magento_Catalog/layout/default.xml file in your custom theme: <referenceBlock name="catalog.compare.sidebar" remove="true"/> <referenceBlock name="view.addto....


32

I grepped the source for all compare blocks. For 2.3 this is the complete list. This will also remove the compare link from the header. <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <!-- Remove compare --> &...


17

You can try something like the following code: <a href="#" data-post='<?php echo $this->helper('Magento\Wishlist\Helper\Data')->getAddParams($_product) ?>' class="action towishlist" data-action="add-to-wishlist"><span>' . __('Add to Wish List') . '</span></a> Refer the below file and related block for more details \...


12

To do so, you will first have to inject the following in your constructor: Magento\Wishlist\Model\WishlistFactory Magento\Catalog\Api\ProductRepositoryInterface So update your class constructor like this: protected $_wishlistRepository; protected $_productRepository; public function __construct( ... \Magento\Wishlist\Model\WishlistFactory $...


11

I have temporarily implemented this solution: Copy app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Options.php to app/code/local/Mage/Wishlist/Block/Customer/Wishlist/Item/Options.php and replace function getTemplate() line 104 - 123 with this code: /** * Retrieve block template * * @return string */ public function getTemplate() { $...


10

Unfortunately Magento didn't provide ready to use function to delete item from wishlist. But you can use follow code to do this, I tested it and all works fine at my local Magento. protected $wishlist; public function __construct( \Magento\Wishlist\Model\Wishlist $wishlist ) { $this->wishlist = $wishlist; } public function execute() { $...


9

To disable the module you can perform following command as @KAndy suggested php bin/magento module:disable Magento_Review php bin/magento module:disable Magento_Wishlist But you can not disable these module using CLI command because other modules are depends on these two modules. You can go app\etc and make relevant module to ZERO and run following ...


8

Option one. Seams cleaner. $productId = 1; $product = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())->load($productId) $customerId = Mage::getSingleton('customer/session')->getCustomerId(); $wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($customerId, true); $hasProduct = false; foreach ($...


8

First, an overview of how wishlists work: Each wishlist is stored in the database with its own ID Each product added to a wishlist is assigned a wishlist_item_id This ID is not the same as the product_id For this reason you can't just pass in a product ID to the remove URL because it's actually referencing the product's wishlist_item_id. This explains why ...


8

For Magento_Wishlist, we can also disable the feature in the admin (Store > Config > Customer > Wish List > General Options, config path is wishlist/general/active). Regarding Magento_Review, the problem is that Magento_Customer and Magento_Review modules requires each others in their composer.json files and there is probably (or just maybe) a good reason ...


8

You can either create a module or customize the code in the theme, I have used custom module as follows, app/code/VendorName/ModuleName/registration.php <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'VendorName_ModuleName', __DIR__ ); app/code/VendorName/...


8

Apparently it is a Magento bug. When comparing current schema to declared schema, constraints and other indexes are handled separately, but the existing index is not dropped before the new UNIQUE index is created. A workaround in this case is to drop orĀ¹ rename the existing index in a separate script before performing the update. alter table wishlist ...


7

All the code you need can be found in app/code/core/Mage/Wishlist/controllers/IndexController.php method _addItemToWishList. You will need to load the product by it's ID and load the wish list by customer. The code would look roughly something like this. $wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($customerId, true); $product = Mage::...


7

You have 2 options here. Option 1. Edit all cart and cart item templates and remove the wishlist column. For this you need to edit: checkout/cart.phtml checkout/cart/item/default.phtml downloadable/checkout/cart/item/default.phtml Option 2 Override the Mage_Wishlist_Helper_Data::isAllowInCart method and make it return false always. For this second option ...


7

Disable Wishlist on Stores > Configuration > Customers > Wishlist and to disable the Compare function paste this lines below on Magento_Catalog/layout/default.xml of your theme. <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration....


7

Another approach in order to retrieve wishlist or custumer related information, is to use localStorage combined with Ajax request if the localstorage is empty. Check information in your console : JSON.parse(localStorage.getItem('mage-cache-storage')).wishlist JSON.parse(localStorage.getItem('mage-cache-storage')).wishlist.items[0] You can based on the ...


7

Create a module Test_Mobileshop Please follow the below steps with the file paths 2.app/code/Test/Mobileshop/etc/webapi.xml <?xml version="1.0" ?> <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd"> <route url="/...


6

You can override the add to wishlist action in the wishlist controller and make it redirect to the referrer. Override this method Mage_Wishlist_IndexController::addAction() and replace this: $this->_redirect('*', array('wishlist_id' => $wishlist->getId())); with this: $this->_redirectReferer()


6

As I can see, deactivate the module is not a good idea. So I decided to remove all links with the default.xml.


6

Magento provide command line utility for it example php bin/magento module:disable -f Magento_Wishlist as Magento wishlist depend upon the other module as well so using without [-f] will not disable or enable the module and will display warning like after using command with [-f] flag will solve this issue please check the warning when you are using ...


6

It can be disabled from store > Configurations > Customers > Wish List> General options> Enabled: No.


6

In app/code/Magento/Wishlist/Controller/Index/Cart.php in the execute() method the following code is what adds the item to the cart and removes it from the wishlist: $item->addToCart($this->cart, true); The addToCart() method is declared in app/code/Magento/Wishlist/Model/Item.php and the second parameter is what triggers the wishlist deletion. If you ...


6

Where are the products loaded? The products are loaded in the "_afterLoad" method of the items collection. A product collection is instantiated there based on the product ids of all items and directly loaded to assign the products to their wishlist items. Unfortunately it is instantiated and loaded from within the same method, so it is not easily changed ...


6

Try this private $wishlist; public function __construct( ... \Magento\Wishlist\Model\Wishlist $wishlist ) { $this->wishlist = $wishlist; ... } ... $customer_id = 1; $wishlist_collection = $this->wishlist->loadByCustomerId($customer_id, true)->getItemCollection(); foreach ($wishlist_collection as $item) { print_r($item->...


5

I got the solution for above please go through the below Code: $wishlist=Mage::helper('wishlist')->getWishlist(); $storeId = Mage::app()->getStore()->getId(); $model = Mage::getModel('catalog/product'); $_product = $model->load($productId); $params = array('product' => $productId, 'qty' => 1, 'store_id' => $storeId, ...


5

Add this link to the template you mentioned: <a href="<?php echo $this->getUrl('productalert/add/stock', array( 'product_id' => $this->getItem()->getProduct()->getId(), Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => Mage::helper('core/url')->getEncodedUrl() ))?>"><?php echo $this-&...


5

As highlighted in a previous comment, disabling the module is not a good method as others may depend on it, this has been enforced in Magento 2.2.0 when trying to run the below commans: php bin/magento module:disable Magento_Wishlist You will receive a wall of red error messages starting with: Unable to change status of modules because of the following ...


5

UPDATE: After a Magento 2 core update, klara's answer is now the best way to disable Compare functionality. Please read below ! To disable Wish List functionality, you need to go in the administration, under Stores > Configuration > Customers > Wish List and choose Enabled : No. To disable Compare functionality, there's no option in the administration. You ...


5

To do so you need to use the Magento\Wishlist\Controller\WishlistProviderInterface interface. Inject this class in your constructor: protected $wishlistProvider; public function __construct( ... \Magento\Wishlist\Controller\WishlistProviderInterface $wishlistProvider ) { $this->wishlistProvider = $wishlistProvider; ... } Then you can ...


Only top voted, non community-wiki answers of a minimum length are eligible