Magenerds / BasePrice

38 stars 38 forks source link

Fatal Error for Grouped Products without active child #31

Closed zolthan closed 6 years ago

zolthan commented 6 years ago

https://github.com/Magenerds/BasePrice/blob/9b5d703f2db3f2c940f680449bcfc88b16a9fd5e/Model/Plugin/AfterPrice.php#L110

Fatal error: Uncaught Error: Call to a member function getId() on null in magenerds-base-price/Model/Plugin/AfterPrice.php:92 
Stack trace: 
#0 magenerds-base-price/Model/Plugin/AfterPrice.php(68): Magenerds\BasePrice\Model\Plugin\AfterPrice->getAfterPriceHtml(NULL) 
#1 vendor/magento/framework/Interception/Interceptor.php(135): Magenerds\BasePrice\Model\Plugin\AfterPrice->aroundRender(Object(Magento\Framework\Pricing\Render\Interceptor), Object(Closure), 'final_price', Object(Magento\Catalog\Model\Product\Interceptor), Array) 
#2 vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\Pricing\Render\Interceptor->Magento\Framework\Interception\{closure}('final_price', Object(Magento\Catalog\Model\Product\Interceptor), Array) 
#3 generated/code/Magento/Framework/Pricing/Render/Interceptor.php(26): Magento\Framework\Pricing\Render\Interceptor-> in magenerds-base-price/Model/Plugin/AfterPrice.php on line 92

A simple check for $product is enough as it is done for the original product in the beginning of this method.

        // check if product is available
        if (!$product) return '';
zolthan commented 6 years ago

Hi Magenerds, anything new in here? Best Z

zolthan commented 6 years ago

Anyone here?

zolthan commented 6 years ago

Hi @sydekumf , could you have a look into this? We still have this issue. Best Sebastian

sydekumf commented 6 years ago

Hey, can you provide a PR? Thanks!

zolthan commented 6 years ago

Hi @sydekumf , here you are.

sydekumf commented 6 years ago

Thanks: https://github.com/Magenerds/BasePrice/releases/tag/1.3.0