3

I have tried many solutions to fix this core issue. Whenever I am going to edit the order, update shipping or payment method and click on save. I am getting below error

Fatal error: Uncaught Error: Call to a member function getIsMultiShipping() on null in /var/www/html/ottocap/vendor/magento/module-customer-balance/Observer/PaymentDataImportObserver.php:52 Stack trace: #0 /var/www/html/ottocap/vendor/magento/framework/Event/Invoker/InvokerDefault.php(73): Magento\CustomerBalance\Observer\PaymentDataImportObserver->execute(Object(Magento\Framework\Event\Observer)) #1 /var/www/html/ottocap/vendor/magento/framework/Event/Invoker/InvokerDefault.php(61): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Magento\CustomerBalance\Observer\PaymentDataImportObserver), Object(Magento\Framework\Event\Observer)) #2 /var/www/html/ottocap/vendor/magento/module-staging/Model/Event/Manager.php(97): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer)) #3 /var/www/html/ottocap/var/generation/Magento/Staging/Model/Event/Manager/Proxy.php(95): Magento\Staging\Model\Event\Manager->dispatch('sales_quote_pay...', Array) #4 /var/www/ht in /var/www/html/ottocap/vendor/magento/module-customer-balance/Observer/PaymentDataImportObserver.php on line 52

I have debugged and came to know that Quote not generated properly. Due to that, I am getting this error. Please let us know if anyone has its solution to fix this issue.

  • If you are running EE there is pro support for you – Anthony Nov 27 '18 at 8:50
  • Yes, already created a ticket in the support, they are looking into it since 8days. – Nits Nov 27 '18 at 8:51
  • Could need alot of looking into. One option is to put it up on freelancer as a one time fix job. Should not cost much – Anthony Nov 27 '18 at 8:57
  • Thanks I don't have that option. – Nits Nov 27 '18 at 8:59
  • 1
    Hi @Octopus yes I got the solution, I will update here tomorrow. – Nits Mar 19 '19 at 13:30
2

We got the solution for the above issue. In this issue, store not set up properly when we edit and save the order from the backend. So what I did, I have set an admin store when we edit and save the order. Please review the below code:

/var/www/html/m218ee/app/code/Extension/Override/etc/adminhtml/di.xml

<type name="Magento\Framework\App\FrontControllerInterface">
        <plugin name="md_default_store_setter" type="Extension\Override\Plugin\DefaultStore" />
    </type>

/var/www/html/ottocap/app/code/Extension/Override/Plugin/DefaultStore.php

namespace Otto\Override\Plugin;

/**
 * Plugin to set default store for admin area.
 */
class DefaultStore
{
    /**
     * @var \Magento\Store\Model\StoreManagerInterface
     */
    protected $storeManager;

    /**
     * Initialize dependencies.
     *
     * @param \Magento\Store\Model\StoreManagerInterface $storeManager
     */
    public function __construct(
        \Magento\Store\Model\StoreManagerInterface $storeManager
    ) {
        $this->storeManager = $storeManager;
    }

    /**
     * Set current store for admin area
     *
     * @param \Magento\Framework\App\FrontController $subject
     * @param \Magento\Framework\App\RequestInterface $request
     * @return void
     *
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     */
    public function beforeDispatch(
        \Magento\Framework\App\FrontControllerInterface $subject , \Magento\Framework\App\RequestInterface $request
    ) {

        $path =  $request->getParams();
        if(!empty($path) && isset($path['namespace']) && $path['namespace']=='product_listing'){
            //Fixed default store issue in the product grid backend(previously showing default store value instead of admin store).
            $this->storeManager->setCurrentStore(\Magento\Store\Model\Store::ADMIN_CODE);
        }

    }
}

Please run below commands

php bin/magento cache:flush or rm -rf var/*

If production mode is enable then you should run compilation command

php bin/magento setup:di:compile

and if require run static-content command

php bin/magento setup:static-content:deploy

I hope the above code help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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