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


PHP Varien_Event_Observer::getCategory方法代码示例

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


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

示例1: catalogCategoryMove

 /**
  * Observe the category move
  *
  * @param  Varien_Event_Observer $observer Observer Instance
  * @return void
  */
 public function catalogCategoryMove(Varien_Event_Observer $observer)
 {
     $category = $observer->getCategory();
     $dataModel = Mage::getModel('firegento_adminmonitoring/history_data', $category);
     $diffModel = Mage::getModel('firegento_adminmonitoring/history_diff', $dataModel);
     $eventData = array('object_id' => $dataModel->getObjectId(), 'object_type' => $dataModel->getObjectType(), 'content' => $dataModel->getSerializedContent(), 'content_diff' => $diffModel->getSerializedDiff(), 'action' => FireGento_AdminMonitoring_Helper_Data::ACTION_UPDATE);
     Mage::dispatchEvent('firegento_adminmonitoring_log', $eventData);
 }
开发者ID:giuseppemorelli,项目名称:firegento-adminmonitoring,代码行数:14,代码来源:Move.php

示例2: menuGetCategoryMenuDataAfter

 public function menuGetCategoryMenuDataAfter(Varien_Event_Observer $observer)
 {
     $category = $observer->getCategory();
     $categoryMenuData = $observer->getCategoryMenuData();
     if ($category->hasIconImage()) {
         $imageUrl = $this->_prefixImageWithMediaPath($category->getIconImage());
         $categoryMenuData->setIconImage($imageUrl);
     }
 }
开发者ID:JamesAnelay,项目名称:MegaMenuAdditionalAttributes,代码行数:9,代码来源:Observer.php

示例3: prepareCategoryFacet

 /**
  * Install category facet into categories
  *
  * @param Varien_Event_Observer $observer Event data.
  *
  * @return Smile_VirtualCategories_Model_Observer
  */
 public function prepareCategoryFacet(Varien_Event_Observer $observer)
 {
     // Retrieve filter and category from event
     $filter = $observer->getFilter();
     $category = $observer->getCategory();
     // Retrieve query associated with the filter
     $query = $filter->getLayer()->getProductCollection()->getSearchEngineQuery();
     // Prepare facet query group
     $queries = $this->_getVirtualRule($category)->getChildrenCategoryQueries(array(), false, 1);
     $options = array('queries' => $queries, 'prefix' => 'categories_');
     $query->addFacet('categories', 'queryGroup', $options);
     $filter->setProductCollectionFacetSet(true);
     return $this;
 }
开发者ID:anndream,项目名称:smile-magento-elasticsearch,代码行数:21,代码来源:Observer.php

示例4: onCatalogCategorySaveAfter

 /**
  * catalog_category_save_after
  */
 public function onCatalogCategorySaveAfter(Varien_Event_Observer $observer)
 {
     /** @var $category Mage_Catalog_Model_Category */
     $category = $observer->getCategory();
     if ($category->getId() == $category->getOrigData('entity_id')) {
         return false;
     }
     /** @var $post Hackathon_Socialcommerce_Model_Messagetype_Singlepost */
     $post = Mage::getModel('socialcommerce/messagetype_singlepost');
     $post->setText($this->_getConfig()->getMessageNewCategory());
     $post->setLink($category->getCategoryIdUrl());
     $post->setPicture($category->getImageUrl());
     /** @var $twitter Hackathon_Socialcommerce_Model_Adapter_Twitter */
     $twitter = Mage::getModel('socialcommerce/adapter_twitter');
     $twitter->sendSinglePost($post);
 }
开发者ID:baisoo,项目名称:Magento-Socialcommerce,代码行数:19,代码来源:Observer.php

示例5: catalogCategoryPrepareSave

 /**
  * Append a custom block to the category.product.grid block.
  *
  * @param Varien_Event_Observer $observer
  * @return void
  */
 public function catalogCategoryPrepareSave(Varien_Event_Observer $observer)
 {
     $data = $observer->getRequest()->getParam('mep');
     $category = $observer->getCategory();
     $storeId = $observer->getRequest()->getParam('store');
     if (!empty($data) && $category->getId() && $storeId) {
         foreach ($data as $id => $value) {
             $id = ltrim($id, 'mapping_');
             $model = Mage::getModel('mep/attribute_mapping')->load($id);
             $model->load($id);
             try {
                 $model->setOption(array('value' => array($category->getId() => array($storeId => $value))));
                 $model->save();
             } catch (Exception $e) {
                 Mage::logException($e);
             }
         }
     }
 }
开发者ID:tschifftner,项目名称:Magento-MEP,代码行数:25,代码来源:Observer.php

示例6: catalogCategoryPrepareSave

 /**
  * Cache data after save in category tab
  *
  * @param Varien_Event_Observer $observer observed object
  */
 public function catalogCategoryPrepareSave(Varien_Event_Observer $observer)
 {
     $multiSelectArray = $observer->getCategory()->getDealUpdateDays();
     if (!empty($multiSelectArray)) {
         $multiSelectStr = implode(",", $multiSelectArray);
         $observer->getCategory()->setDealUpdateDays($multiSelectStr)->save();
     }
 }
开发者ID:DeveshKumarThakur,项目名称:cosmetics,代码行数:13,代码来源:Observer.php

示例7: saveCategoryTop

 public function saveCategoryTop(Varien_Event_Observer $observer)
 {
     $dat = $observer->getRequest()->getParams();
     $categoryId = $observer->getCategory()->getId();
     $read = Mage::getSingleton('core/resource')->getConnection('core_read');
     $data['category_id'] = $categoryId;
     if (@$dat['active_product']) {
         $data['active_product'] = @$dat['active_product'];
     } else {
         $data['active_product'] = 0;
     }
     $data['numbers_product'] = @$dat['numbers_product'];
     if (@$dat['active_width']) {
         $data['active_width'] = @$dat['active_width'];
     } else {
         $data['active_width'] = 0;
     }
     $data['width_level'] = @$dat['width_level'];
     if (@$dat['active_static_block_top']) {
         $data['active_static_block_top'] = @$dat['active_static_block_top'];
     } else {
         $data['active_static_block_top'] = 0;
     }
     $data['static_block_top'] = @$dat['static_block_top'];
     if (@$dat['active_static_block']) {
         $data['active_static_block'] = $dat['active_static_block'];
     } else {
         $data['active_static_block'] = 0;
     }
     if (@$dat['active_static_block_left']) {
         $data['active_static_block_left'] = @$dat['active_static_block_left'];
     } else {
         $data['active_static_block_left'] = 0;
     }
     $data['static_block_left'] = @$dat['static_block_left'];
     if (@$dat['active_static_block_bottom']) {
         $data['active_static_block_bottom'] = @$dat['active_static_block_bottom'];
     } else {
         $data['active_static_block_bottom'] = 0;
     }
     $data['static_block_bottom'] = @$dat['static_block_bottom'];
     if (@$dat['active_static_block_right']) {
         $data['active_static_block_right'] = @$dat['active_static_block_right'];
     } else {
         $data['active_static_block_right'] = 0;
     }
     $data['static_block_right'] = @$dat['static_block_right'];
     if (@$dat['active_label']) {
         $data['active_label'] = @$dat['active_label'];
     } else {
         $data['active_label'] = 0;
     }
     $data['label'] = @$dat['label'];
     if (@$dat['active_thumbail']) {
         $data['active_thumbail'] = @$dat['active_thumbail'];
     } else {
         $data['active_thumbail'] = 0;
     }
     $data['level_column_count'] = @$dat['level_column_count'];
     if (@$dat['hidden_menutop']) {
         $data['hidden_menutop'] = @$dat['hidden_menutop'];
     } else {
         $data['hidden_menutop'] = 0;
     }
     if (@$dat['category_children']) {
         $data['category_children'] = @$dat['category_children'];
     } else {
         $data['category_children'] = 0;
     }
     if (@$dat['width_block_left']) {
         $data['width_block_left'] = @$dat['width_block_left'];
     } else {
         $data['width_block_left'] = 0;
     }
     if (@$dat['width_block_right']) {
         $data['width_block_right'] = @$dat['width_block_right'];
     } else {
         $data['width_block_right'] = 0;
     }
     if (@$dat['width_children']) {
         $data['width_children'] = @$dat['width_children'];
     } else {
         $data['width_children'] = 0;
     }
     if (@$dat['font-color']) {
         $data['font-color'] = @$dat['font-color'];
     } else {
         $data['font-color'] = '';
     }
     if (@$dat['background-color']) {
         $data['background-color'] = @$dat['background-color'];
     } else {
         $data['background-color'] = '';
     }
     if (@$dat['hide_menutop']) {
         $data['hide_menutop'] = @$dat['hide_menutop'];
     } else {
         $data['hide_menutop'] = 0;
     }
     $model = Mage::getModel('megamenu/megamenu');
//.........这里部分代码省略.........
开发者ID:novayadi85,项目名称:navicet,代码行数:101,代码来源:Observer.php

示例8: deleteCategoryCustomRedirects

 /**
  * Listener for before category delete event. Deletes category custom redirects.
  * Needed because of http://bugs.mysql.com/bug.php?id=11472
  * @param Varien_Event_Observer $observer
  */
 public function deleteCategoryCustomRedirects(Varien_Event_Observer $observer)
 {
     if ((string) $this->_app->getConfig()->getNode(Enterprise_UrlRewrite_Model_Index_Observer::XML_PATH_REDIRECT_URL_SUFFIX_UPDATE_ON_SAVE)) {
         return;
     }
     /** @var Mage_Catalog_Model_Category $category */
     $category = $observer->getCategory();
     $ids = $category->getResource()->getChildrenIds($category, true);
     $ids[] = $category->getId();
     /** @var Enterprise_UrlRewrite_Model_Resource_Redirect $redirects */
     $redirects = $this->_factory->getResourceModel('enterprise_urlrewrite/redirect');
     $redirects->deleteByCategoryIds($ids);
 }
开发者ID:beejhuff,项目名称:magento-1.13.0.2,代码行数:18,代码来源:Observer.php

示例9: getUrl

 public function getUrl(Varien_Event_Observer $observer)
 {
     $category = $observer->getCategory();
     $url = Mage::helper('conversionpro')->getResultUrl($category->getName());
     $category->setData('url', $url);
 }
开发者ID:jokusafet,项目名称:MagentoSource,代码行数:6,代码来源:Exporter.php

示例10: catalogCategorySaveAfter

 /**
  * Save category draft data for new categories
  *
  * @param Varien_Event_Observer $observer
  */
 public function catalogCategorySaveAfter(Varien_Event_Observer $observer)
 {
     if ($this->_shouldPublishCategory()) {
         return;
     }
     /** @var Mage_Catalog_Model_Category $category */
     $category = $observer->getCategory();
     if ($category->getOriginalIsActive()) {
         /** @var $changesObject Firegento_FlexCms_Model_Category_Changes */
         $changesObject = Mage::helper('firegento_flexcms')->getChangesObject($category);
         $changesObject->setCategoryId($category->getId());
         $changesObject->setStoreId($category->getStoreId());
         $changesObject->setAdminUserId($this->_getAdminUserId());
         $changesObject->setChanges(array('is_active' => 1));
         $changesObject->save();
     }
 }
开发者ID:OurLaborisJoy,项目名称:FireGento_FlexCms,代码行数:22,代码来源:Observer.php

示例11: catalogProductLoadAfter

 public function catalogProductLoadAfter(Varien_Event_Observer $observer)
 {
     if (Mage::getStoreConfig('sitemaster_categorybanner/general/active')) {
         $category = $observer->getCategory();
         $maincat = explode("/", $category->getPath());
         if ($maincat[2]) {
             switch ($maincat[2]) {
                 case 32:
                     if (Mage::getStoreConfig('sitemaster_categorybanner/general/menumasla_staticblockid') != '-1') {
                         $category->setDisplayMode('PRODUCTS_AND_PAGE');
                         $category->setlanding_page(Mage::getStoreConfig('sitemaster_categorybanner/general/menumasla_staticblockid'));
                     }
                     break;
                 case 149:
                     if (Mage::getStoreConfig('sitemaster_categorybanner/general/menuorigin_staticblockid') != '-1') {
                         $category->setDisplayMode('PRODUCTS_AND_PAGE');
                         $category->setlanding_page(Mage::getStoreConfig('sitemaster_categorybanner/general/menuorigin_staticblockid'));
                     }
                     break;
                 case 33:
                     if (Mage::getStoreConfig('sitemaster_categorybanner/general/menusmazki_staticblockid') != '-1') {
                         $category->setDisplayMode('PRODUCTS_AND_PAGE');
                         $category->setlanding_page(Mage::getStoreConfig('sitemaster_categorybanner/general/menusmazki_staticblockid'));
                     }
                     break;
                 case 34:
                     if (Mage::getStoreConfig('sitemaster_categorybanner/general/menufiltra_staticblockid') != '-1') {
                         $category->setDisplayMode('PRODUCTS_AND_PAGE');
                         $category->setlanding_page(Mage::getStoreConfig('sitemaster_categorybanner/general/menufiltra_staticblockid'));
                     }
                     break;
                 case 35:
                     if (Mage::getStoreConfig('sitemaster_categorybanner/general/menuautohimia_staticblockid') != '-1') {
                         $category->setDisplayMode('PRODUCTS_AND_PAGE');
                         $category->setlanding_page(Mage::getStoreConfig('sitemaster_categorybanner/general/menuautohimia_staticblockid'));
                     }
                     break;
                 case 36:
                     if (Mage::getStoreConfig('sitemaster_categorybanner/general/menuautocosm_staticblockid') != '-1') {
                         $category->setDisplayMode('PRODUCTS_AND_PAGE');
                         $category->setlanding_page(Mage::getStoreConfig('sitemaster_categorybanner/general/menuautocosm_staticblockid'));
                     }
                     break;
                 case 37:
                     if (Mage::getStoreConfig('sitemaster_categorybanner/general/menuzapchasti_staticblockid') != '-1') {
                         $category->setDisplayMode('PRODUCTS_AND_PAGE');
                         $category->setlanding_page(Mage::getStoreConfig('sitemaster_categorybanner/general/menuzapchasti_staticblockid'));
                     }
                     break;
                 case 38:
                     if (Mage::getStoreConfig('sitemaster_categorybanner/general/menushini_staticblockid') != '-1') {
                         $category->setDisplayMode('PRODUCTS_AND_PAGE');
                         $category->setlanding_page(Mage::getStoreConfig('sitemaster_categorybanner/general/menushini_staticblockid'));
                     }
                     break;
                 case 7:
                     if (Mage::getStoreConfig('sitemaster_categorybanner/general/menuactii_staticblockid') != '-1') {
                         $category->setDisplayMode('PRODUCTS_AND_PAGE');
                         $category->setlanding_page(Mage::getStoreConfig('sitemaster_categorybanner/general/menuactii_staticblockid'));
                     }
                     break;
                 default:
                     if (Mage::getStoreConfig('sitemaster_categorybanner/general/menumasla_staticblockid') != '-1') {
                         $category->setDisplayMode('PRODUCTS_AND_PAGE');
                         $category->setlanding_page(Mage::getStoreConfig('sitemaster_categorybanner/general/menumasla_staticblockid'));
                     }
             }
         }
     }
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:70,代码来源:Observer.php

示例12: catalogCategorySaveAfter

 /**
  * Set the html block cache to disabled/invalid when groupscatalog visibility settings
  * have changed because the top menu is cached.
  *
  * This might be better suited to go into the indexer, but that seems very unclean to mix
  * the indexer logic with the cache logic. So for now I'll put it here.
  *
  * @param Varien_Event_Observer $observer
  * @return void
  */
 public function catalogCategorySaveAfter(Varien_Event_Observer $observer)
 {
     /* @var $category Mage_Catalog_Model_Category */
     $category = $observer->getCategory();
     $helper = $this->_getHelper();
     // If the module isn't disabled on a global scale
     if ($helper->isModuleActive($category->getStore(), false) && !$this->_isDisabledOnRequest()) {
         if ($category->dataHasChangedFor(Netzarbeiter_GroupsCatalog2_Helper_Data::HIDE_GROUPS_ATTRIBUTE)) {
             if ($helper->getConfig('auto_refresh_block_cache')) {
                 // Only refresh the category block cache: Mage_Catalog_Model_Category::CACHE_TAG
                 Mage::app()->cleanCache(array(Mage_Catalog_Model_Category::CACHE_TAG));
             } else {
                 Mage::app()->getCacheInstance()->invalidateType(Mage_Core_Block_Abstract::CACHE_GROUP);
             }
         }
     }
 }
开发者ID:aniljaiswal,项目名称:order-confirmation,代码行数:27,代码来源:Observer.php


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