magento / data-migration-tool

Magento Data Migration Tool
https://devdocs.magento.com/guides/v2.3/migration/bk-migration-guide.html
Open Software License 3.0
334 stars 200 forks source link

Exception #0 (Exception): Item (Magento\Wishlist\Model\Item) with the same ID "9980" already exists. #837

Open BassemN opened 3 years ago

BassemN commented 3 years ago

Preconditions

  1. Magento 1 ver. 1.9.4.4 with PHP 5.6
  2. Magento 2 ver. 2.3.5-p2 with PHP 7.3

Steps to reproduce

  1. Install Migration tool
  2. Migrate settings
  3. Migrate Data
  4. Login into a customer account
  5. Add a product to the wishlist

Expected result

Adding products to the wishlist should work without any errors

Actual result

After clicking on "Add to wishlist", I'm getting this error (Exception): Item (Magento\Wishlist\Model\Item) with the same ID "9980" already exists.

1 exception(s):
Exception #0 (Exception): Item (Magento\Wishlist\Model\Item) with the same ID "9980" already exists.

Exception #0 (Exception): Item (Magento\Wishlist\Model\Item) with the same ID "9980" already exists.
<pre>#1 Magento\Framework\Data\Collection\AbstractDb->loadWithFilter(false, false) called at [vendor/magento/framework/Data/Collection/AbstractDb.php:565]
#2 Magento\Framework\Data\Collection\AbstractDb->load() called at [vendor/magento/framework/Data/Collection.php:849]
#3 Magento\Framework\Data\Collection->count() called at [vendor/magento/module-wishlist/Model/Wishlist.php:634]
#4 Magento\Wishlist\Model\Wishlist->getItemsCount() called at [vendor/magento/module-wishlist/Block/AbstractBlock.php:276]
#5 Magento\Wishlist\Block\AbstractBlock->getWishlistItemsCount() called at [generated/code/Magento/Wishlist/Block/Customer/Wishlist/Interceptor.php:297]
#6 Magento\Wishlist\Block\Customer\Wishlist\Interceptor->getWishlistItemsCount() called at [vendor/magento/module-wishlist/Block/AbstractBlock.php:301]
#7 Magento\Wishlist\Block\AbstractBlock->hasWishlistItems() called at [generated/code/Magento/Wishlist/Block/Customer/Wishlist/Interceptor.php:323]
#8 Magento\Wishlist\Block\Customer\Wishlist\Interceptor->hasWishlistItems() called at [vendor/magento/module-wishlist/view/frontend/templates/view.phtml:20]
#9 include('/home/mage2theru...') called at [vendor/magento/framework/View/TemplateEngine/Php.php:59]
#10 Magento\Framework\View\TemplateEngine\Php->render(&Magento\Wishlist\Block\Customer\Wishlist\Interceptor#000000001c63723e0000000019db5330#, '/home/mage2theru...', array('csp' => &Magento\Csp\Helper\InlineUtil#000000001c6365c20000000019db5330#)) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#11 Magento\Framework\View\TemplateEngine\Php\Interceptor->___callParent('render', array(&Magento\Wishlist\Block\Customer\Wishlist\Interceptor#000000001c63723e0000000019db5330#, '/home/mage2theru...', array('csp' => &Magento\Csp\Helper\InlineUtil#000000001c6365c20000000019db5330#))) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#12 Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Wishlist\Block\Customer\Wishlist\Interceptor#000000001c63723e0000000019db5330#, '/home/mage2theru...', array()) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#13 Magento\Framework\View\TemplateEngine\Php\Interceptor->___callPlugins('render', array(&Magento\Wishlist\Block\Customer\Wishlist\Interceptor#000000001c63723e0000000019db5330#, '/home/mage2theru...', array()), array(array('csp_helper_plugi...'))) called at [generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php:26]
#14 Magento\Framework\View\TemplateEngine\Php\Interceptor->render(&Magento\Wishlist\Block\Customer\Wishlist\Interceptor#000000001c63723e0000000019db5330#, '/home/mage2theru...', array()) called at [vendor/magento/framework/View/Element/Template.php:271]
#15 Magento\Framework\View\Element\Template->fetchView('/home/mage2theru...') called at [generated/code/Magento/Wishlist/Block/Customer/Wishlist/Interceptor.php:726]
#16 Magento\Wishlist\Block\Customer\Wishlist\Interceptor->fetchView('/home/mage2theru...') called at [vendor/magento/framework/View/Element/Template.php:301]
#17 Magento\Framework\View\Element\Template->_toHtml() called at [vendor/magento/module-wishlist/Block/Customer/Wishlist.php:275]
#18 Magento\Wishlist\Block\Customer\Wishlist->_toHtml() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1100]
#19 Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1104]
#20 Magento\Framework\View\Element\AbstractBlock->_loadCache() called at [vendor/magento/framework/View/Element/AbstractBlock.php:674]
#21 Magento\Framework\View\Element\AbstractBlock->toHtml() called at [generated/code/Magento/Wishlist/Block/Customer/Wishlist/Interceptor.php:1051]
#22 Magento\Wishlist\Block\Customer\Wishlist\Interceptor->toHtml() called at [vendor/magento/framework/View/Layout.php:566]
#23 Magento\Framework\View\Layout->_renderBlock('customer.wishlis...') called at [vendor/magento/framework/View/Layout.php:542]
#24 Magento\Framework\View\Layout->renderNonCachedElement('customer.wishlis...') called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#25 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('customer.wishlis...') called at [vendor/magento/framework/View/Layout.php:497]
#26 Magento\Framework\View\Layout->renderElement('customer.wishlis...', false) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#27 Magento\Framework\View\Layout\Interceptor->renderElement('customer.wishlis...', false) called at [vendor/magento/framework/View/Layout.php:594]
#28 Magento\Framework\View\Layout->_renderContainer('content', false) called at [vendor/magento/framework/View/Layout.php:544]
#29 Magento\Framework\View\Layout->renderNonCachedElement('content') called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#30 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('content') called at [vendor/magento/framework/View/Layout.php:497]
#31 Magento\Framework\View\Layout->renderElement('content', false) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#32 Magento\Framework\View\Layout\Interceptor->renderElement('content', false) called at [vendor/magento/framework/View/Layout.php:594]
#33 Magento\Framework\View\Layout->_renderContainer('main', false) called at [vendor/magento/framework/View/Layout.php:544]
#34 Magento\Framework\View\Layout->renderNonCachedElement('main') called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#35 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('main') called at [vendor/magento/framework/View/Layout.php:497]
#36 Magento\Framework\View\Layout->renderElement('main', false) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#37 Magento\Framework\View\Layout\Interceptor->renderElement('main', false) called at [vendor/magento/framework/View/Layout.php:594]
#38 Magento\Framework\View\Layout->_renderContainer('columns', false) called at [vendor/magento/framework/View/Layout.php:544]
#39 Magento\Framework\View\Layout->renderNonCachedElement('columns') called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#40 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('columns') called at [vendor/magento/framework/View/Layout.php:497]
#41 Magento\Framework\View\Layout->renderElement('columns', false) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#42 Magento\Framework\View\Layout\Interceptor->renderElement('columns', false) called at [vendor/magento/framework/View/Layout.php:594]
#43 Magento\Framework\View\Layout->_renderContainer('main.content', false) called at [vendor/magento/framework/View/Layout.php:544]
#44 Magento\Framework\View\Layout->renderNonCachedElement('main.content') called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#45 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('main.content') called at [vendor/magento/framework/View/Layout.php:497]
#46 Magento\Framework\View\Layout->renderElement('main.content', false) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#47 Magento\Framework\View\Layout\Interceptor->renderElement('main.content', false) called at [vendor/magento/framework/View/Layout.php:594]
#48 Magento\Framework\View\Layout->_renderContainer('page.wrapper', false) called at [vendor/magento/framework/View/Layout.php:544]
#49 Magento\Framework\View\Layout->renderNonCachedElement('page.wrapper') called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#50 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.wrapper') called at [vendor/magento/framework/View/Layout.php:497]
#51 Magento\Framework\View\Layout->renderElement('page.wrapper', false) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#52 Magento\Framework\View\Layout\Interceptor->renderElement('page.wrapper', false) called at [vendor/magento/framework/View/Layout.php:594]
#53 Magento\Framework\View\Layout->_renderContainer('root', false) called at [vendor/magento/framework/View/Layout.php:544]
#54 Magento\Framework\View\Layout->renderNonCachedElement('root') called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#55 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('root') called at [vendor/magento/framework/View/Layout.php:497]
#56 Magento\Framework\View\Layout->renderElement('root', true) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#57 Magento\Framework\View\Layout\Interceptor->renderElement('root') called at [vendor/magento/framework/View/Layout.php:963]
#58 Magento\Framework\View\Layout->getOutput() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#59 Magento\Framework\View\Layout\Interceptor->___callParent('getOutput', array()) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#60 Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#61 Magento\Framework\View\Layout\Interceptor->___callPlugins('getOutput', array(), array(array('layout-model-cac...'))) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:494]
#62 Magento\Framework\View\Layout\Interceptor->getOutput() called at [vendor/magento/framework/View/Result/Page.php:258]
#63 Magento\Framework\View\Result\Page->render(&Magento\Framework\App\Response\Http\Interceptor#000000001c6378500000000019db5330#) called at [vendor/magento/framework/View/Result/Layout.php:171]
#64 Magento\Framework\View\Result\Layout->renderResult(&Magento\Framework\App\Response\Http\Interceptor#000000001c6378500000000019db5330#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#65 Magento\Framework\View\Result\Page\Interceptor->___callParent('renderResult', array(&Magento\Framework\App\Response\Http\Interceptor#000000001c6378500000000019db5330#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#66 Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Response\Http\Interceptor#000000001c6378500000000019db5330#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#67 Magento\Framework\View\Result\Page\Interceptor->___callPlugins('renderResult', array(&Magento\Framework\App\Response\Http\Interceptor#000000001c6378500000000019db5330#), array(array('result-messages', 'result-builtin-c...', 'result-varnish-c...'))) called at [generated/code/Magento/Framework/View/Result/Page/Interceptor.php:130]
#68 Magento\Framework\View\Result\Page\Interceptor->renderResult(&Magento\Framework\App\Response\Http\Interceptor#000000001c6378500000000019db5330#) called at [vendor/magento/framework/App/Http.php:120]
#69 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:24]
#70 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
#71 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#000000001c63784b0000000019db5330#) called at [index.php:39]
</pre>

Additional notes

m2-assistant[bot] commented 3 years ago

Hi @BassemN. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] commented 3 years ago

Hi @BassemN! :wave: Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team command to join Contributors team.

minenkoden commented 3 years ago

@BassemN stacked with same problem. For me helped to override class with preference Magento\Wishlist\Model\Wishlist and change getItemCollection function to:

public function getItemCollection()
{
    return parent::getItemCollection()->load();
}

Point is to add load() function when creating collection with filters.

BassemN commented 3 years ago

@minenkoden Many thanks. This code fixed the issue. Thanks again :+1: