Kann jemand den Unterschied zwischen diesen Ereignissen erklären. Nur das schnelle und dreckige bitte. Vielen Dank.
Ich habe eine Observer-Methode wie folgt:
public function detectProductChanges($observer)
{
$product = $observer->getProduct();
$old = $product->getOrigData();
$new = $product->getData();
if ($product->hasDataChanges() && $old['status'] == 1 && $new['status'] == 2) {
$this->_sendStatusMail($product);
}
}
Es kommt nicht zum sendStatusMail()
Ich bin an der Veranstaltung beteiligt:
<events>
<catalog_product_save_after>
<observers>
<productchange>
<type>singleton</type>
<class>A_ProductNotification_Model_Observer</class>
<method>detectProductChanges</method>
</productchange>
</observers>
</catalog_product_save_after>
</events>
Sollte ich verwenden: catalog_product_save_commit_after
TOR:
Lassen Sie sich eine E-Mail senden, nachdem das Produkt deaktiviert wurde.
private function _sendStatusMail($product)
{
if (!Mage::getStoreConfig('trans_email/ident_custom3/email')) return false;
$emailTemplate = Mage::getModel('core/email_template');
$emailTemplate->loadDefault('elec_productnotification_tpl');
$emailTemplate->setTemplateSubject('Product has been disabled');
$emailTemplate->setSenderEmail($salesData['email']);
$emailTemplateVariables['style_number'] = $product->getElecStyle();
$emailTemplateVariables['frame_color'] = $product->getAttributeText('frame_color');
$emailTemplateVariables['size'] = $product->getAttributeText('size');
$emailTemplateVariables['elec_color'] = $product->getAttributeText('elec_color');
$emailTemplateVariables['store_name'] = Mage::getModel('core/store')->load($product->getStoreId())->getName();
$emailTemplateVariables['product_name'] = Mage::getModel('catalog/product')->load($product->getId())->getName();
$emailTemplateVariables['product_sku'] = $product->getSku();
$emailTemplateVariables['dates'] = date("F jS Y h:i:sA", strtotime('-7 hours'));
// Get General email address (Admin->Configuration->General->Store Email Addresses)
$emails = explode(',', Mage::getStoreConfig('trans_email/ident_custom3/email'));
foreach ($emails as $email) $emailTemplate->send($email, $product->getStoreId(), $emailTemplateVariables);
}
}
<catalog_product_status_update>