Call to undefined method Magento\\Catalog\\Model\\Product\\Type\\Simple::getConfigurableAttributeCollection() in /vendor/magento/module-configurable-product/Helper/Product/Options/Loader.php

[Mon Jun 22 07:32:58.596677 2020] [proxy_fcgi:error] [pid 14233] [client 103.78.226.252:59399] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Call to undefined method Magento\\Catalog\\Model\\Product\\Type\\Simple::getConfigurableAttributeCollection() in vendor/magento/module-configurable-product/Helper/Product/Options/Loader.php:52\nStack trace:\n#0 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 vendor/magento/framework/EntityManager/Operation/Read/ReadExtensions.php(48): Magento\\ConfigurableProduct\\Model\\Product\\ReadHandler->execute(Object(Magento\\Catalog\\Model\\Product\\Interceptor), Array)\n#2 vendor/magento/framework/EntityManager/Operation/Read.php(112): Magento\\Framework\\EntityManager\\Operation\\Read\\ReadExtensions->execute(Object(Magento\\Catalog\\Model\\Product\\Interceptor), Array)\n#3 vendor/magento/framework/Entit...\n', referer: https://equaltrue.devs/admina1b2c344/sales/order/index/key/67cc143b3f2b902ed95fdb73249ba12f45aca7cd5b223c6e2c728e2581d56130/

 

Change file :

vendor/magento/module-configurable-product/Helper/Product/Options/Loader.php

File Function  Load()

$options = [];
/** @var Configurable $typeInstance */
$typeInstance = $product->getTypeInstance();
$attributeCollection = $typeInstance->getConfigurableAttributeCollection($product);
$this->extensionAttributesJoinProcessor->process($attributeCollection);
foreach ($attributeCollection as $attribute) {

To

$options = [];
/** @var Configurable $typeInstance */
$typeInstance = $product->getTypeInstance();
if (get_class($typeInstance) == 'Magento\Catalog\Model\Product\Type\Simple' || get_class($typeInstance) == 'Magento\Bundle\Model\Product\Type'){
    return null;
}
$attributeCollection = $typeInstance->getConfigurableAttributeCollection($product);
$this->extensionAttributesJoinProcessor->process($attributeCollection);
foreach ($attributeCollection as $attribute) {

 

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.