doofinder / doofinder-magento2

Open Software License 3.0
10 stars 9 forks source link

Fix amount price calculation when price object is null #236

Closed ivan-doofinder closed 1 year ago

ivan-doofinder commented 1 year ago

Fixes an error when calculating the price when a "grouped" type product does not have any associated product. Return price 0.

(Related ticket: https://doofinder.freshdesk.com/a/tickets/86127)

[2022-11-09T04:20:07.445701+00:00] main.CRITICAL: Error: Call to a member function getAmount() on null in /vendor/doofinder/doofinder-magento2/Helper/Product.php:383 Stack trace:

0

/vendor/doofinder/doofinder-magento2/Model/ProductRepository.php(380): Doofinder\Feed\Helper\Product->getProductPrice()

1

/vendor/doofinder/doofinder-magento2/Model/ProductRepository.php(235): Doofinder\Feed\Model\ProductRepository->setExtensionAttributes()

2 [internal function]:

Doofinder\Feed\Model\ProductRepository->getList()

3

/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array()

4 /vendor/magento/module-webapi/Controller/Rest.php(188):

Magento\Webapi\Controller\Rest\SynchronousRequestProcessor->process()

5 /vendor/magento/framework/Interception/Interceptor.php(58):

Magento\Webapi\Controller\Rest->dispatch()

6 /vendor/magento/framework/Interception/Interceptor.php(138):

Magento\Webapi\Controller\Rest\Interceptor->___callParent()

7 /vendor/magento/framework/Interception/Interceptor.php(153):

Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception{closure}()

8 /generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(23):

Magento\Webapi\Controller\Rest\Interceptor->___callPlugins()

9 /vendor/magento/framework/App/Http.php(116):

Magento\Webapi\Controller\Rest\Interceptor->dispatch()

10 /vendor/magento/framework/App/Bootstrap.php(264):

Magento\Framework\App\Http->launch()

11 /pub/index.php(30): Magento\Framework\App\Bootstrap->run()

12 {main} [] []