When you get error like: Item (Magento\Catalog\Model\Product\Interceptor) with the same ID “<id>” already exists.
Then you can use below module to resolve above error.
1. Create new folders Magemonkey/DuplicateEntry in app/code magento folder.
2. add new file registration.php in DuplicateEntry folder and put below code.
1 2 3 4 5 6 7 |
<?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Magemonkey_DuplicateEntry', __DIR__ ); |
3. add new file etc/module.xml in DuplicateEntry folder and put below code.
1 2 3 4 5 |
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magemonkey_DuplicateEntry" setup_version="1.0.1"></module> </config> |
4. add new file etc/di.xml in DuplicateEntry folder and put below code.
1 2 3 4 5 6 7 |
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Eav\Model\Entity\Collection\AbstractCollection"> <plugin name="find_duplicate_entry" type="Magemonkey\DuplicateEntry\plugin\Collection" sortOrder="20"/> </type> </config> |
5. add new file plugin/Collection.php in DuplicateEntry folder and put below code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<?php /** * Copyright © Magento, Inc. All rights reserved. */ namespace Magemonkey\DuplicateEntry\plugin; use Magento\Framework\Data\Collection\EntityFactoryInterface; use Magento\Framework\Option\ArrayInterface; class Collection { /** * @param \Magento\Eav\Model\Entity\Collection\AbstractCollection $subject * @param \Closure $process * @param \Magento\Framework\DataObject $dataObject * @return $this */ public function aroundAddItem(\Magento\Eav\Model\Entity\Collection\AbstractCollection $subject, \Closure $process, \Magento\Framework\DataObject $dataObject) { try{ return $process($dataObject); }catch ( \Exception $e){ return $this; } } } |
If you want get query string params in controller file,...
Create di.xml and add the below code Magemonkey/Redirect/etc/frontend/di.xml [crayon-628373a9e828d867886861/] Create...
You can try below code to change local date to...
Step 1: First you need to add registration.php file in...
Step1 : Override message.js in current theme file on the...