本文整理汇总了PHP中Varien_Event_Observer::getDataObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event_Observer::getDataObject方法的具体用法?PHP Varien_Event_Observer::getDataObject怎么用?PHP Varien_Event_Observer::getDataObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Event_Observer
的用法示例。
在下文中一共展示了Varien_Event_Observer::getDataObject方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: coreConfigSaveCommitAfter
/**
* Clear customer segment indexer if customer segment is on|off on backend
*
* @param Varien_Event_Observer $observer
* @return Enterprise_TargetRule_Model_Observer
*/
public function coreConfigSaveCommitAfter(Varien_Event_Observer $observer)
{
if ($observer->getDataObject()->getPath() == 'customer/enterprise_customersegment/is_enabled' && $observer->getDataObject()->isValueChanged()) {
Mage::getSingleton('index/indexer')->logEvent(new Varien_Object(array('type_id' => null, 'store' => null)), Enterprise_TargetRule_Model_Index::ENTITY_TARGETRULE, Enterprise_TargetRule_Model_Index::EVENT_TYPE_CLEAN_TARGETRULES);
Mage::getSingleton('index/indexer')->indexEvents(Enterprise_TargetRule_Model_Index::ENTITY_TARGETRULE, Enterprise_TargetRule_Model_Index::EVENT_TYPE_CLEAN_TARGETRULES);
}
return $this;
}
示例2: configSaveAfter
/**
* Entry point for the observer.
*
* @param Varien_Event_Observer $observer
* @return \Rubic_MigrationHelper_Model_Observer
*/
public function configSaveAfter($observer)
{
$data = $observer->getDataObject();
if ($data->isValueChanged()) {
/**
* Generate a message from migration data.
*/
$migration = array('path' => $data->getPath(), 'value' => $data->getValue(), 'scope' => $data->getScope(), 'scope_id' => $data->getScopeId());
$message = Mage::getModel('migration_helper/message_migration', $migration);
/**
* Log the migration, just in case.
*/
Mage::log($migration, null, 'migrations.log');
/**
* Generate a physical migration if module is configured that way.
*/
if ($this->_doGenerateMigrations()) {
$this->_generateMigration($message);
}
/**
* Add the message to the admin session.
*/
$this->_getAdminSession()->addMessage($message);
}
return $this;
}
示例3: sendVoucherOnStatusChange
public function sendVoucherOnStatusChange(Varien_Event_Observer $observer)
{
$order = $observer->getDataObject();
$incrementId = $order->getIncrementId();
if (!in_array($order->getStatus(), explode(',', Mage::getStoreConfig('voucher_options/configs/order_status_admin')))) {
return;
}
$vouchers = Mage::getModel('voucher/vouchers')->getCollection()->addFieldToFilter('order_increment_id', $incrementId);
foreach ($vouchers as $voucher) {
$this->_sendVoucherEmail($voucher, $order);
}
}
示例4: productLoadAfter
/**
* Attach children products after product load
* Observes: catalog_product_load_after
*
* @param Varien_Event_Observer $observer
*/
public function productLoadAfter(Varien_Event_Observer $observer)
{
if (!Mage::helper('configurableswatches')->isEnabled()) {
// functionality disabled
return;
// exit without loading swatch functionality
}
/* @var $helper Mage_ConfigurableSwatches_Helper_Mediafallback */
$helper = Mage::helper('configurableswatches/mediafallback');
/* @var $product Mage_Catalog_Model_Product */
$product = $observer->getDataObject();
if ($product->getTypeId() != Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
return;
}
$helper->groupMediaGalleryImages($product);
$helper->attachConfigurableProductChildrenAttributeMapping(array($product), $product->getStoreId());
}
示例5: registerDesignExceptionsChange
/**
* Resave exception rules to cache storage
*
* @param Varien_Event_Observer $observer
* @return Enterprise_PageCache_Model_Observer
*/
public function registerDesignExceptionsChange(Varien_Event_Observer $observer)
{
$object = $observer->getDataObject();
Enterprise_PageCache_Model_Cache::getCacheInstance()->save($object->getValue(), Enterprise_PageCache_Model_Processor::DESIGN_EXCEPTION_KEY, array(Enterprise_PageCache_Model_Processor::CACHE_TAG));
return $this;
}
示例6: saveProduct
public function saveProduct(Varien_Event_Observer $observer)
{
$product = $observer->getDataObject();
$product = Mage::getModel('catalog/product')->load($product->getId());
Algolia_Algoliasearch_Model_Indexer_Algolia::$product_categories[$product->getId()] = $product->getCategoryIds();
}
示例7: onStockItemSaveAfter
public function onStockItemSaveAfter(Varien_Event_Observer $observer)
{
if ($observer->getDataObject() && $observer->getDataObject()->getProductId()) {
$productId = $observer->getDataObject()->getProductId();
Mirasvit_Fpc_Model_Cache::getCacheInstance()->clean('CATALOG_PRODUCT_' . $productId);
}
}
示例8: rmaSaveAfter
/**
* Method observes core_abstract_save_after event
* as far as Enterprise_Rma_Model_Rma doesn't have own event prefix
*
* @param Varien_Event_Observer $observer
*/
public function rmaSaveAfter(Varien_Event_Observer $observer)
{
try {
/* will listen to Enterprise_Rma_Model_Rma only*/
$dataObject = $observer->getDataObject();
if (get_class($dataObject) === 'Enterprise_Rma_Model_Rma') {
if ($dataObject->getStatus() == 'closed') {
//send partial order return message
}
}
} catch (Exception $exception) {
$this->_handleException($exception);
}
}