当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Event_Observer::getObject方法代码示例

本文整理汇总了PHP中Varien_Event_Observer::getObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event_Observer::getObject方法的具体用法?PHP Varien_Event_Observer::getObject怎么用?PHP Varien_Event_Observer::getObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Event_Observer的用法示例。


在下文中一共展示了Varien_Event_Observer::getObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: modelSaveAfter

 public function modelSaveAfter(Varien_Event_Observer $observer)
 {
     // only log if the model is on the whitelist
     if (Mage::getStoreConfig(self::LOG_ACTION_WHITELIST_PREFIX . get_class($observer->getObject())) !== null) {
         $customerSession = Mage::getSingleton('customer/session');
         $action = Mage::getModel('hackathon_frontendmonitoring/user_action');
         $action->setSessionId($customerSession->getSessionId());
         $action->setCustomerId($customerSession->getCustomerId());
         $action->setModel(get_class($observer->getObject()));
         $action->setAction('save_after');
         $action->setTimestamp(Mage::helper('hackathon_frontendmonitoring')->getNow());
         $action->save();
     }
 }
开发者ID:eniuz,项目名称:FrontendMonitoring,代码行数:14,代码来源:Observer.php

示例2: prepareLayoutHandlesAndBlocks

 public function prepareLayoutHandlesAndBlocks(Varien_Event_Observer $observer)
 {
     $object = $observer->getObject();
     $handles = $object->getHandles();
     $blockNames = $object->getBlockNames();
     $request = $observer->getObserver()->getControllerAction()->getRequest();
     $suggestpageHandles = array('suggestpage_index_index', 'tm_ajaxpro_checkout_cart_add_suggestpage');
     if (!array_intersect($suggestpageHandles, $handles)) {
         return;
     }
     if ('delete' == $request->getActionName()) {
         $handles = $this->_replaceArrayValues($handles, array('tm_ajaxpro_checkout_cart_add_suggestpage' => 'tm_ajaxpro_checkout_cart_add_with_cart_extended'));
     } else {
         // hide all popups, when on the suggest page
         if (in_array('suggestpage_index_index', $handles)) {
             $blockNames[] = 'content';
             $blockNames[] = 'catalog_product_price_template';
             $blockNames = $this->_replaceArrayValues($blockNames, array('ajaxpro_message' => false));
             // need to remove all popup handles to prevent their appearence inside of content block
             $handles = $this->_replaceArrayValues($handles, array('tm_ajaxpro_checkout_cart_add_*' => false, 'suggestpage_view' => false));
         } elseif (in_array('tm_ajaxpro_checkout_cart_add_suggestpage', $handles)) {
             // modify handles, when suggestpage should be shown in popup
             $handles = array('default', 'tm_ajaxpro_checkout_cart_add_suggestpage');
             $blockNames[] = 'content';
             $blockNames[] = 'catalog_product_price_template';
         }
     }
     $object->setBlockNames($blockNames);
     $object->setHandles($handles);
 }
开发者ID:santhosh400,项目名称:ecart,代码行数:30,代码来源:Observer.php

示例3: clearCoreEmailQueueRecipientsAfterSave

 /**
  * Clear Mage_Core_Model_Email_Queue recipients after saving it
  *
  * @param Varien_Event_Observer $observer
  */
 public function clearCoreEmailQueueRecipientsAfterSave(Varien_Event_Observer $observer)
 {
     $object = $observer->getObject();
     if ($object instanceof Mage_Core_Model_Email_Queue) {
         $object->clearRecipients();
     }
 }
开发者ID:VinuWebtech,项目名称:production267,代码行数:12,代码来源:Observer.php

示例4: _castObject

 protected function _castObject(Varien_Event_Observer $observer)
 {
     $object = $observer->getObject();
     if ($object instanceof Mage_Core_Model_Email_Template) {
         return $object;
     }
 }
开发者ID:kiutisuperking,项目名称:eatsmartboxdev,代码行数:7,代码来源:Observer.php

示例5: cmsPageSaveAfter

 /**
  * @param Varien_Event_Observer $observer
  */
 public function cmsPageSaveAfter($observer)
 {
     /* @var $page Mage_Cms_Model_Page */
     $page = $observer->getObject();
     Mage::helper('typecms')->setupAttributes();
     $pageType = Mage::getModel('typecms/page')->load($page->getId());
     if (!$pageType->getId()) {
         $pageType->setId($page->getId());
     }
     $pageType->setPageType($page->getPageType());
     $data = $page->getData('typecms');
     if (isset($data)) {
         $pageType->addData($data);
     }
     $config = Mage::getSingleton('typecms/config');
     $attributes = $config->getAttributes($pageType->getData('page_type'));
     foreach ($attributes as $attributeCode => $attribute) {
         if (in_array($attribute['type'], array('image', 'file'))) {
             if ($pageType->getData($attributeCode . '_delete') == '1') {
                 self::deleteImage($pageType->getData($attributeCode));
                 $pageType->setData($attributeCode, null);
             }
             $file = $this->handleUpload($attributeCode, $attribute['type']);
             if ($file && $file !== $pageType->getData($attributeCode)) {
                 self::deleteImage($pageType->getData($attributeCode));
             }
             if ($file) {
                 $pageType->setData($attributeCode, $file);
             }
         }
     }
     $pageType->save();
 }
开发者ID:adamj88,项目名称:RK_TypeCMS,代码行数:36,代码来源:Observer.php

示例6: customerGroupSaveBefore

 /**
  * Handle data of new fields in customer group when saving
  *
  * @param Varien_Event_Observer $observer
  */
 public function customerGroupSaveBefore($observer)
 {
     /** @var Mage_Customer_Model_Group $group */
     $group = $observer->getObject();
     $group->setData('request_vat_id', Mage::app()->getRequest()->getParam('request_vat_id'));
     $group->setData('tax_class_id_vat_id', Mage::app()->getRequest()->getParam('tax_class_id_vat_id'));
 }
开发者ID:giuseppemorelli,项目名称:EuropeanTax,代码行数:12,代码来源:Observer.php

示例7: reviewSaveAfter

 /**
  * Clear product cache after a review is saved
  *
  * @param Varien_Event_Observer $observer
  */
 public function reviewSaveAfter(Varien_Event_Observer $observer)
 {
     $object = $observer->getObject();
     $productCollection = $object->getProductCollection()->addAttributeToFilter('rt.review_id', array('eq' => $object->getId()));
     foreach ($productCollection as $product) {
         $product->cleanCache();
     }
 }
开发者ID:finelinePG,项目名称:finelink-dev,代码行数:13,代码来源:Observer.php

示例8: DefaultBlockVersion

 /**
  * Saves default blocks' versions
  * @param $observer
  */
 public function DefaultBlockVersion(Varien_Event_Observer $observer)
 {
     $block = $observer->getObject();
     if (get_class($block) == "Mage_Cms_Model_Block") {
         $collection = Mage::getModel('sc_cmsblockmanagement/versions')->getCollection();
         $collection->addFieldToFilter('block_identifier', array("eq" => $block->getIdentifier()));
         if (count($collection) == 0) {
             $this->SaveBlockVersion($observer);
         }
     }
 }
开发者ID:Vedariy,项目名称:test,代码行数:15,代码来源:Observer.php

示例9: onUserLoadAfter

 /**
  * @param Varien_Event_Observer $observer
  */
 public function onUserLoadAfter($observer)
 {
     /** @var Mage_Admin_Model_User $user */
     $user = $observer->getObject();
     if (!$user->getUserId()) {
         // @bug???
         return;
     }
     $resource = Mage::getSingleton('core/resource');
     $query = 'SELECT signature FROM ' . $resource->getTableName('helpdesk/user') . ' WHERE user_id=' . $user->getUserId();
     $data = $resource->getConnection('core_read')->fetchOne($query);
     $user->setSignature($data);
 }
开发者ID:cesarfelip3,项目名称:clevermage_new,代码行数:16,代码来源:Mirasvit_Helpdesk_Model_Observer.php

示例10: deleteProduct

 public function deleteProduct(Varien_Event_Observer $observer)
 {
     $product = $observer->getObject();
     $storeCollection = Mage::getModel('core/store')->getCollection();
     foreach ($storeCollection as $store) {
         $idPath = sprintf('reviews/%d', $product->getId());
         $rewrite = $this->getUrlRewrite();
         $rewrite->setStoreId($store->getId())->loadByIdPath($idPath);
         if ($rewrite->getId()) {
             $rewrite->delete();
         }
     }
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:13,代码来源:Observer.php

示例11: saveAdminToRoleRelation

 /**
  * Save relation of admin user to API2 role
  *
  * @param Varien_Event_Observer $observer
  * @return void
  */
 public function saveAdminToRoleRelation(Varien_Event_Observer $observer)
 {
     /** @var $user Mage_User_Model_User Object */
     $user = $observer->getObject();
     if ($user->hasData('api2_roles')) {
         $roles = $user->getData('api2_roles');
         if (!is_array($roles) || !isset($roles[0])) {
             throw new Exception('API2 roles property has wrong data format.');
         }
         /** @var $resourceModel Mage_Api2_Model_Resource_Acl_Global_Role */
         $resourceModel = Mage::getResourceModel('Mage_Api2_Model_Resource_Acl_Global_Role');
         $resourceModel->saveAdminToRoleRelation($user->getId(), $roles[0]);
     }
 }
开发者ID:nemphys,项目名称:magento2,代码行数:20,代码来源:Observer.php

示例12: registerCustomer

 /**
  * creates a customer from facebook user
  * @param Varien_Event_Observer $observer
  * @throws Exception
  */
 public function registerCustomer(Varien_Event_Observer $observer)
 {
     /** @var Alaa_FacebookConnect_Model_User $model */
     $model = $observer->getObject();
     if ($model instanceof Alaa_FacebookConnect_Model_User) {
         $customer = null;
         if ($model->isObjectNew()) {
             $customer = $model->createCustomer();
         }
         if ($customer instanceof Mage_Customer_Model_Customer && $customer->getId()) {
             $this->login($customer);
         }
     }
 }
开发者ID:alaa-almaliki,项目名称:facebookconnect,代码行数:19,代码来源:Observer.php

示例13: log

 /**
  * Log data
  *
  * @param Varien_Event_Observer $event
  */
 public function log(Varien_Event_Observer $event)
 {
     $logActive = Mage::getStoreConfig(self::XML_PATH_MODEL_CACHE_ENABLED);
     if (!$logActive) {
         return;
     }
     $object = $event->getObject();
     /* @var $object Mage_Core_Model_Abstract */
     $class = get_class($object);
     $id = $event->getValue();
     if (!isset($this->data[$class])) {
         $this->data[$class] = array();
     }
     if (!isset($this->data[$class][$id])) {
         $this->data[$class][$id] = array();
     }
     $trace = debug_backtrace();
     $this->data[$class][$id][] = $trace[5]['file'] . ':' . $trace[5]['line'];
     $this->loadedModels++;
 }
开发者ID:aoepeople,项目名称:aoe_modelcache,代码行数:25,代码来源:Observer.php

示例14: customerGroupSaveBefore

 /**
  * save typo3 group id
  * 
  * @param Varien_Event_Observer $observer
  */
 public function customerGroupSaveBefore($observer)
 {
     $observer->getObject()->setData('typo3_group_id', intval(Mage::app()->getRequest()->getParam('typo3_group_id')));
 }
开发者ID:maffen,项目名称:TypoGento,代码行数:9,代码来源:Observer.php

示例15: modelSaveCommitAfter

 /**
  * Processes models after save commit events
  *
  * @param Varien_Event_Observer $observer
  * @return $this
  */
 public function modelSaveCommitAfter(Varien_Event_Observer $observer)
 {
     $this->_getProcessor()->afterSave($observer->getObject());
     return $this;
 }
开发者ID:jonesio,项目名称:EcomDev_Varnish,代码行数:11,代码来源:Observer.php


注:本文中的Varien_Event_Observer::getObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。