mrkhoa99 / boolfly_productrelation Goto Github PK
View Code? Open in Web Editor NEWMagento 2 - Adding custom product relations
Magento 2 - Adding custom product relations
Hi,
I have a Magento 2.1.8 multisite and would like to use your module. However, I am getting error in frontend on product page with custom related products.
Steps taken:
bin/magento maintenance:enable
bin/magento module:enable Boolfly_ProductRelation
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy
bin/magento maintenance:disable
bin/magento cache:clean
In backend seems to be ok.
Added custom related products to a simple product and saved.
Visited the product page in frontend and received the error:
Exception #0 (Exception): Item (Boolfly\ProductRelation\Model\Product\Interceptor) with the same ID "2" already exists.
Exception #0 (Exception): Item (Boolfly\ProductRelation\Model\Product\Interceptor) with the same ID "2" already exists.
#0 /home/wordpressdesign/public_html/nivito/vendor/magento/module-eav/Model/Entity/Collection/AbstractCollection.php(304): Magento\Framework\Data\Collection->addItem(Object(Boolfly\ProductRelation\Model\Product\Interceptor))
#1 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection/Interceptor.php(1025): Magento\Eav\Model\Entity\Collection\AbstractCollection->addItem(Object(Boolfly\ProductRelation\Model\Product\Interceptor))
#2 /home/wordpressdesign/public_html/nivito/vendor/magento/module-eav/Model/Entity/Collection/AbstractCollection.php(1119): Magento\Catalog\Model\ResourceModel\Product\Link\Product\Collection\Interceptor->addItem(Object(Boolfly\ProductRelation\Model\Product\Interceptor))
#3 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection/Interceptor.php(1285): Magento\Eav\Model\Entity\Collection\AbstractCollection->_loadEntities(false, false)
#4 /home/wordpressdesign/public_html/nivito/vendor/magento/module-eav/Model/Entity/Collection/AbstractCollection.php(910): Magento\Catalog\Model\ResourceModel\Product\Link\Product\Collection\Interceptor->_loadEntities(false, false)
#5 /home/wordpressdesign/public_html/nivito/vendor/magento/module-catalog/Model/ResourceModel/Product/Collection.php(727): Magento\Eav\Model\Entity\Collection\AbstractCollection->load(false, false)
#6 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/Interception/Interceptor.php(146): Magento\Catalog\Model\ResourceModel\Product\Collection->load(false, false)
#7 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection/Interceptor.php(390): Magento\Catalog\Model\ResourceModel\Product\Link\Product\Collection\Interceptor->___callPlugins('load', Array, Array)
#8 /home/wordpressdesign/public_html/nivito/vendor/magento/module-catalog/Block/Product/ProductList/Related.php(95): Magento\Catalog\Model\ResourceModel\Product\Link\Product\Collection\Interceptor->load()
#9 /home/wordpressdesign/public_html/nivito/vendor/magento/module-catalog/Block/Product/ProductList/Related.php(109): Magento\Catalog\Block\Product\ProductList\Related->_prepareData()
#10 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Element/AbstractBlock.php(658): Magento\Catalog\Block\Product\ProductList\Related->_beforeToHtml()
#11 /home/wordpressdesign/public_html/nivito/var/generation/MGS/Mpanel/Block/Catalog/Product/ProductList/Related/Interceptor.php(778): Magento\Framework\View\Element\AbstractBlock->toHtml()
#12 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(542): MGS\Mpanel\Block\Catalog\Product\ProductList\Related\Interceptor->toHtml()
#13 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(518): Magento\Framework\View\Layout->_renderBlock('catalog.product...')
#14 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('catalog.product...')
#15 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('catalog.product...')
#16 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('catalog.product...', true)
#17 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('catalog.product...')
#18 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('content.aside')
#19 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('content.aside')
#20 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('content.aside')
#21 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('content.aside', true)
#22 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('content.aside')
#23 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('main')
#24 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('main')
#25 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('main')
#26 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('main', true)
#27 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('main')
#28 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('columns')
#29 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('columns')
#30 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('columns')
#31 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('columns', true)
#32 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('columns')
#33 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('main.content')
#34 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('main.content')
#35 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('main.content')
#36 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('main.content', true)
#37 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('main.content')
#38 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('page.wrapper')
#39 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('page.wrapper')
#40 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.wrapper')
#41 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('page.wrapper', true)
#42 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('page.wrapper')
#43 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('root')
#44 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('root')
#45 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('root')
#46 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('root', true)
#47 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Layout.php(938): Magento\Framework\View\Layout\Interceptor->renderElement('root')
#48 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/Interception/Interceptor.php(146): Magento\Framework\View\Layout->getOutput()
#49 /home/wordpressdesign/public_html/nivito/var/generation/Magento/Framework/View/Layout/Interceptor.php(494): Magento\Framework\View\Layout\Interceptor->___callPlugins('getOutput', Array, Array)
#50 /home/wordpressdesign/public_html/nivito/app/code/MGS/Mpanel/Block/Framework/Page.php(64): Magento\Framework\View\Layout\Interceptor->getOutput()
#51 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/View/Result/Layout.php(164): MGS\Mpanel\Block\Framework\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor))
#52 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#53 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/Interception/Chain/Chain.php(70): MGS\Mpanel\Block\Framework\Page\Interceptor->___callParent('renderResult', Array)
#54 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('MGS\Mpanel\Bloc...', 'renderResult', Object(MGS\Mpanel\Block\Framework\Page\Interceptor), Array, 'controller-resu...')
#55 /home/wordpressdesign/public_html/nivito/app/code/Litespeed/Litemage/Model/Controller/Result/LitemagePlugin.php(80): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain{closure}(Object(Magento\Framework\App\Response\Http\Interceptor))
#56 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/Interception/Chain/Chain.php(67): Litespeed\Litemage\Model\Controller\Result\LitemagePlugin->aroundRenderResult(Object(MGS\Mpanel\Block\Framework\Page\Interceptor), Object(Closure), Object(Magento\Framework\App\Response\Http\Interceptor))
#57 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('MGS\Mpanel\Bloc...', 'renderResult', Object(MGS\Mpanel\Block\Framework\Page\Interceptor), Array, 'result-varnish-...')
#58 /home/wordpressdesign/public_html/nivito/vendor/magento/module-page-cache/Model/Controller/Result/VarnishPlugin.php(74): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain{closure}(Object(Magento\Framework\App\Response\Http\Interceptor))
#59 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\PageCache\Model\Controller\Result\VarnishPlugin->aroundRenderResult(Object(MGS\Mpanel\Block\Framework\Page\Interceptor), Object(Closure), Object(Magento\Framework\App\Response\Http\Interceptor))
#60 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('MGS\Mpanel\Bloc...', 'renderResult', Object(MGS\Mpanel\Block\Framework\Page\Interceptor), Array, 'result-builtin-...')
#61 /home/wordpressdesign/public_html/nivito/vendor/magento/module-page-cache/Model/Controller/Result/BuiltinPlugin.php(67): MGS\Mpanel\Block\Framework\Page\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Response\Http\Interceptor))
#62 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/Interception/Interceptor.php(142): Magento\PageCache\Model\Controller\Result\BuiltinPlugin->aroundRenderResult(Object(MGS\Mpanel\Block\Framework\Page\Interceptor), Object(Closure), Object(Magento\Framework\App\Response\Http\Interceptor))
#63 /home/wordpressdesign/public_html/nivito/var/generation/MGS/Mpanel/Block/Framework/Page/Interceptor.php(143): MGS\Mpanel\Block\Framework\Page\Interceptor->___callPlugins('renderResult', Array, Array)
#64 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/App/Http.php(139): MGS\Mpanel\Block\Framework\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#65 /home/wordpressdesign/public_html/nivito/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#66 /home/wordpressdesign/public_html/nivito/index.php(40): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#67 {main}
I would be grateful if you have a solution for this
/superdea
Im new to magento but my client require this feature.
Admin tabs seems to be working and can see the input for linked custom type product in inspect element. But when im trying to save the data, the selected product are not updating in link table db.
Im getting null data in line 28 of Boolfly\ProductRelation\Model\Catalog\Product\Link.
Magento 2.0.13
Please help me
Thanks.
Once we added products it wont shown up in admin side under custom type products. I am working on magento 2.1.2. If we look in to the table products are there.
Does this module take care of API calls? Is it supported? How would one save a custom relation?
Brand new install M2 2.3.1. Tried to create the very first product. Save crashes with error 500.
[Thu Nov 21 15:45:56.161981 2019] [php7:error] [pid 11386] [client 10.1.10.177:62499] PHP Fatal error: Uncaught TypeError: Argument 2 passed to Magento\InventoryGroupedProductAdminUi\Plugin\Catalog\Model\Product\Link\ProcessSourceItemsAfterSaveAssociatedLinks::afterSaveProductRelations() must be an instance of Magento\Catalog\Model\Product\Link, null given, called in /data/vhosts/mike.m2.test/htdocs/vendor/magento/framework/Interception/Interceptor.php on line 146 and defined in /data/vhosts/mike.m2.test/htdocs/vendor/magento/module-inventory-grouped-product-admin-ui/Plugin/Catalog/Model/Product/Link/ProcessSourceItemsAfterSaveAssociatedLinks.php:51\nStack trace:\n#0 /data/vhosts/mike.m2.test/htdocs/vendor/magento/framework/Interception/Interceptor.php(146): Magento\InventoryGroupedProductAdminUi\Plugin\Catalog\Model\Product\Link\ProcessSourceItemsAfterSaveAssociatedLinks->afterSaveProductRelations(Object(Boolfly\ProductRelation\Model\Catalog\Product\Link\Interceptor), NULL, Object(Boolfly\ProductRelation\Model\Product\Interceptor))\n#1 /data/vhosts/mike.m2.test/htdocs/vendor/magento/framework/Interception/Interc in /data/vhosts/mike.m2.test/htdocs/vendor/magento/module-inventory-grouped-product-admin-ui/Plugin/Catalog/Model/Product/Link/ProcessSourceItemsAfterSaveAssociatedLinks.php on line 51, referer: http://mikem2test.local/admin/catalog/product/new/set/4/type/simple/key/bf61d9a5d77d9a4718c4fcf3e242d1a1384006a5f030b28415560687fae4c1c1/
I want to exclude Custom Type From Upsell/Crosssell and Related Tab. I want to call it under separate tab. Is it possible?
When REST API update is used the stored custom product links get cleared. I tried to debug the issue but couldn't resolve it. I didn't face this issue on saving the product but only on REST API update. Any help will be much appreciated. Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.