Situation is:
Admin logs in to system and he changes product somehow.
For example:
Sets qty to 10 Adds 2 images Changes description
Is there any
You can find the unaltered data through an object's getOrigData() method. A good time to get the object is through it's save_before event, so create an observer for the catalog_product_save_before
event. The observer might contain the following:
public function onCatalogProductSaveBefore($observer)
{
$product = $observer->getProduct();
if ($product->hasDataChanges()) {
$newValues = array_diff_assoc($product->getData(), $product->getOrigData());
$oldValues = array_diff_assoc($product->getOrigData(), $product->getData());
$added = array_diff_key($product->getData(), $product->getOrigData());
$unset = array_diff_key($product->getOrigData(), $product->getData());
}
}
Note that $newValues
will include all of $added
and existing attributes that have had their value changed. Ditto for $oldValues
and $unset
.