-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Call to undefined method Magento\Bundle\Model\Product\Type::getConfigurableAttributeCollection() #21663
Comments
Hi @ankit-root. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. @ankit-root do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
|
Hi @ankit-root. Thank you for your request. I'm working on Magento 2.3-develop instance for you |
Hi @ankit-root, here is your Magento instance. |
what will we do on instance server? |
I have used the same scenario on your server it's working but after migration these not working.t |
We are experiencing the same situation with configurable a simple products in the cart, Magento is trying to fetch getConfigurableAttributeCollection() on a simple product; PHP Fatal error: Uncaught Error: Call to undefined method Magento\Catalog\Model\Product\Type\Simple::getConfigurableAttributeCollection() Did you find anything useful @ankit-root ? |
Figured out a the solution for our issue with simple products; First extend; Magento\Catalog\Model\Product\Type\Simple Add function; Then extend; Magento\ConfigurableProduct\Helper\Product\Options\Loader Rewrite the function load() and replace this part; $attributeCollection = $typeInstance->getConfigurableAttributeCollection($product); With; $attributeCollection = $typeInstance->getConfigurableAttributeCollection($product); // this now returns false if this is a simple product if($attributeCollection) { |
I found temporary solution adding simple condition in
|
This is still a problem.
|
Just an update, I have a breakpoint set in Loader.php (magento-configurable-product\Helper\Product\Options\Loader.php) on line 52. At this breakpoint, the following things are true:
I'm debugging to see if somehow i've managed to set this value, but its doubtful. |
I'm seeing the same issue. In my case I get the error when searching for a sku using the keyword search field in the product grid in admin.
I will re-open this ticket as this is still being reported by multiple people and the proposed workarounds are just masking the problem. |
@mitcht Did you get any results? |
The reason for the issue is using a deprecated load method for models. To reproduce needs to inject Product model (not factory) to the constructor |
I just saw this same error being thrown on a Magento 2.3.1 shop, having some particular products in your cart: bundled product + a configurable one. At the moment when you moved from the checkout to an external payment provider, a HTTP 500 error was thrown and we could see the error mentioned in this ticket in the error log on the server. It turned out to get fixed by updating that Payment provider's module to the latest version. So in this case, it was probably some incorrect code in the Payment provider module which caused the bug and might not have been a Magento core bug, but I can't say that with full confidence though. Maybe this comment helps for other people who run into this and who are also using the MultiSafepay payment module. |
On production following code works:
|
Check your custom modules or extensions and find if you are using either of the following -: Magento\Catalog\Model\Product (in the constructor) $this->_product->load($id) or $this->_objectManager->get('\Magento\Catalog\Model\Product')->load($id) If yes then change it to use \Magento\Catalog\Api\ProductRepositoryInterface and load product using getById($id) instead. Hope it helps |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Thank you for your contributions. |
Is not recommended edit the core files either magento or any framework. I made one override to the class. I don't know if there is a best way to fix this issue, but for mi works. di.xml:
Override: `<?php declare(strict_types=1); namespace Custom\Module\Helper\Product\Options; use Magento\Catalog\Api\Data\ProductInterface; class Loader extends \Magento\ConfigurableProduct\Helper\Product\Options\Loader
} |
1) Summary of the issue
2) Information on your environment
3) Steps to reproduce
1) Migrate 1.1.9 to 2.2.6
2) first we add Bundle product on cart
3) second we add configurable product on cart
4) Expected results
- how to solve this issue and how to sure after migration, not breakup functionality?
5) Actual results
When we add Configurable products on the cart then add Simple product on the cart will facing error
PHP Fatal error: Uncaught Error: Call to undefined method Magento\\Bundle\\Model\\Product\\Type::getConfigurableAttributeCollection() in /var/www/html/magentothird/vendor/magento/module-configurable-product/Helper/Product/Options/Loader.php:53\nStack trace:\n#0 /var/www/html/magentothird/vendor/magento/module-configurable-product/Model/Product/ReadHandler.php(48): Magento\\ConfigurableProduct\\Helper\\Product\\Options\\Loader->load(Object(Magento\\Catalog\\Model\\Product\\Interceptor))\n#1 /var/www/html/magentothird/vendor/magento/framework/EntityManager/Operation/Read/ReadExtensions.php(48): Magento\\ConfigurableProduct\\Model\\Product\\ReadHandler->execute(Object(Magento\\Catalog\\Model\\Product\\Interceptor), Array)\n#2 /var/www/html/magentothird/vendor/magento/framework/EntityManager/Operation/Read.php(112): Magento\\Framework\\EntityManager\\Operation\\Read\\ReadExtensions->execute(Object(Magento\\Catalog\\Model\\Product\\Interceptor), Array)\n#3 /var/www/html/magentothird/vendor/magento/framework/EntityManager/EntityManager.php(70): Magento\\Framework\\Ent in /var/www/html/magentothird/vendor/magento/module-configurable-product/Helper/Product/Options/Loader.php on line 53, referer: http://ehp2.root.com/ehp-configurable.html
The text was updated successfully, but these errors were encountered: