I wrote module that is updating prices when I click save product. It's using catalog_product_save_before
and its loading extra attributes like:
$price1 = $product->getprice_extra1();
$price2 = $product->getprice_extra2();
$price3 = $product->getprice_extra3();
and its work perfectly, however to calculate all prices I need to manually open product and save.
I was trying to use prices catalog_product_attribute_update_before
event and save using selection of products and change attributes in product list but its throwing php error:
PHP Fatal error: Uncaught Error: Call to a member function getprice_extra1() on null in ...
Same error when I try to use events: update after import and cron.
I think when I'm using this different events I need to load something else.
Or maybe some of attributes are without value and this is causing error.
UPDATE:
It looks like on update attributes all products data is not loaded I need add something with @var \Magento\Framework\Registry