1

Magento 2.2.7

Getting this error in the error_log and customer get's white screen when trying to login to site,

Fatal error: Uncaught Error: Call to a member function getValue() on null in 
/home/website/public_html/vendor/magento/module-bundle/Model/Product/Type.php:338 
Stack trace: 
#0 /home/website/public_html/vendor/magento/module-catalog/Model/Product.php(1926): Magento\Bundle\Model\Product\Type->getWeight(Object(Magento\Catalog\Model\Product\Interceptor)) 
#1 /home/website/public_html/generated/code/Magento/Catalog/Model/Product/Interceptor.php(1259): Magento\Catalog\Model\Product->getWeight() 
#2 /home/website/public_html/vendor/magento/module-quote/Model/Quote/Item.php(433): Magento\Catalog\Model\Product\Interceptor->getWeight() 
#3 /home/website/public_html/generated/code/Magento/Quote/Model/Quote/Item/Interceptor.php(128): Magento\Quote\Model\Quote\Item->setProduct(Object(Magento\Catalog\Model\Product\Interceptor)) 
#4 /home/website/public_html/vendor/magento/module-quote/Model/ResourceModel/Quote/Item/Collection.php(275): Magento\Quote\Model\Quote\Item\Interceptor->setProduct(Object(Magento\Catalog\Mode in /home/website/public_html/vendor/magento/module-bundle/Model/Product/Type.php on line 338

Any help would be appreciated. Not sure where this is coming from, all of the products have a weight set.

1
  • do you have custom module that extends the module-bundle?
    – fmsthird
    Commented Feb 22, 2019 at 23:45

2 Answers 2

0

This ended up being an old migrated row in the quote table from the M1 to M2 migration. Deleting that row removed the error for the specific customer account.

1
  • how did you get to know which row is older in the quote table? Commented Oct 27, 2020 at 10:44
0

I know this post is near 5 years old, but I found it today while looking for an explanation of this issue I was having and I figured out the proper solution on my case.

My custom grid uses a collection that have a joined field, and that field can be NULL when the main table does not have defined the entity id of the joined table, so for those cases I was getting same error like yours while I try to export. My solution was simply to make the column Alias with an IF condition that checks if it was NULL and then for those cases I add the column with an empty string, then export run correctly and nothing was affected on the grid:

/**
 * @inheritdoc
 */
protected function _initSelect()
{
    parent::_initSelect();
    $this->joinCustomerTable();

    return $this;
}

/**
 * @return $this
 */
private function joinCustomerTable()
{
    $connection = $this->getConnection();
    $customerIdField = $connection->quoteIdentifier('main_table.customer_id');

    $this->getSelect()
        ->joinLeft(
            ['customer' => $this->getTable('customer_entity')],
            "customer.entity_id={$customerIdField}",
            [
                'customer_email' => 'IF(`customer`.`email` IS NOT NULL, `customer`.`email`, "")'
            ]
        );
    return $this;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.