Question

I would be grateful for all the help.

I need to catch an event that brings the Manage Products in the table price. Regardless of the price in the database, you need to display a different price.

Price is taken dynamically via XML with other resources.

For the frontend, I decided this through events catalog_product_get_final_price and catalog_product_collection_load_after

But what event could be used to substitute the price of goods in the admin can not find.

Prompt who knows how to do this?

Was it helpful?

Solution

Maybe someone will come in handy. I used the event catalog_product_save_after. That's part of the code:

config.xml

<adminhtml>
    <events>
        <catalog_product_save_after>
            <observers>
                    <admin_update_price>
                        <class>My_Module_Model_Observer</class>
                        <method>updateProductPrice</method>
                        <type>singleton</type>
                    </admin_update_price>
                </observers>
            </catalog_product_save_after>
        </events>
    </adminhtml>

Observer.php

 public function updateProductPrice($observer)
   {  
    $product = $observer->getProduct();
    $price = 10;
    $product->setPrice($price);
    $product->getResource()->saveAttribute($product, 'price');
   }

This is an example of code that works for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top