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


PHP Mage_Core_Model_Abstract::getStores方法代码示例

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


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

示例1: _afterSave

 /**
  * Perform operations after object save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Cms_Model_Resource_Block
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $oldStores = $this->lookupStoreIds($object->getId());
     $newStores = (array) $object->getStores();
     $table = $this->getTable('cms/block_store');
     $insert = array_diff($newStores, $oldStores);
     $delete = array_diff($oldStores, $newStores);
     if ($delete) {
         $where = array('block_id = ?' => (int) $object->getId(), 'store_id IN (?)' => $delete);
         $this->_getWriteAdapter()->delete($table, $where);
     }
     if ($insert) {
         $data = array();
         foreach ($insert as $storeId) {
             $data[] = array('block_id' => (int) $object->getId(), 'store_id' => (int) $storeId);
         }
         $this->_getWriteAdapter()->insertMultiple($table, $data);
     }
     return parent::_afterSave($object);
 }
开发者ID:SalesOneGit,项目名称:s1_magento,代码行数:26,代码来源:Block.php

示例2: _afterSave

 /**
  * Assign trigger to store views
  *
  * @param Mage_Core_Model_Abstract $object
  * @return self
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $oldStores = $this->lookupStoreIds($object->getId());
     $newStores = (array) $object->getStores();
     if (empty($newStores)) {
         $newStores = (array) $object->getStoreId();
     }
     $table = $this->getTable('esendex_sms/trigger_store');
     $insert = array_diff($newStores, $oldStores);
     $delete = array_diff($oldStores, $newStores);
     if (count($delete)) {
         $where = ['trigger_id = ?' => (int) $object->getId(), 'store_id IN (?)' => $delete];
         $this->_getWriteAdapter()->delete($table, $where);
     }
     if (count($insert)) {
         $data = [];
         foreach ($insert as $storeId) {
             $data[] = ['trigger_id' => (int) $object->getId(), 'store_id' => (int) $storeId];
         }
         $this->_getWriteAdapter()->insertMultiple($table, $data);
     }
     return parent::_afterSave($object);
 }
开发者ID:WeareJH,项目名称:esendex-magento-extension,代码行数:29,代码来源:TriggerAbstract.php

示例3: _afterSave

 /**
  * Perform actions after object save
  *
  * @param Varien_Object $object
  * @return Mage_Review_Model_Resource_Review
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $adapter = $this->_getWriteAdapter();
     /**
      * save detail
      */
     $detail = array('title' => $object->getTitle(), 'detail' => $object->getDetail(), 'nickname' => $object->getNickname());
     $select = $adapter->select()->from($this->_reviewDetailTable, 'detail_id')->where('review_id = :review_id');
     $detailId = $adapter->fetchOne($select, array(':review_id' => $object->getId()));
     if ($detailId) {
         $condition = array("detail_id = ?" => $detailId);
         $adapter->update($this->_reviewDetailTable, $detail, $condition);
     } else {
         $detail['store_id'] = $object->getStoreId();
         $detail['customer_id'] = $object->getCustomerId();
         $detail['review_id'] = $object->getId();
         $adapter->insert($this->_reviewDetailTable, $detail);
     }
     /**
      * save stores
      */
     $stores = $object->getStores();
     if (!empty($stores)) {
         $condition = array('review_id = ?' => $object->getId());
         $adapter->delete($this->_reviewStoreTable, $condition);
         $insertedStoreIds = array();
         foreach ($stores as $storeId) {
             if (in_array($storeId, $insertedStoreIds)) {
                 continue;
             }
             $insertedStoreIds[] = $storeId;
             $storeInsert = array('store_id' => $storeId, 'review_id' => $object->getId());
             $adapter->insert($this->_reviewStoreTable, $storeInsert);
         }
     }
     // reaggregate ratings, that depend on this review
     $this->_aggregateRatings($this->_loadVotedRatingIds($object->getId()), $object->getEntityPkValue());
     return $this;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:45,代码来源:Review.php

示例4: _afterSave

 /**
  * Assign page to store views
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Cms_Model_Resource_Page
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $oldStores = $this->lookupStoreIds($object->getId());
     $newStores = (array) $object->getStores();
     if (empty($newStores)) {
         $newStores = (array) $object->getStoreId();
     }
     $table = $this->getTable('cms/page_store');
     $insert = array_diff($newStores, $oldStores);
     $delete = array_diff($oldStores, $newStores);
     if ($delete) {
         $where = array('page_id = ?' => (int) $object->getId(), 'store_id IN (?)' => $delete);
         $this->_getWriteAdapter()->delete($table, $where);
     }
     if ($insert) {
         $data = array();
         foreach ($insert as $storeId) {
             $data[] = array('page_id' => (int) $object->getId(), 'store_id' => (int) $storeId);
         }
         $this->_getWriteAdapter()->insertMultiple($table, $data);
     }
     //Mark layout cache as invalidated
     Mage::app()->getCacheInstance()->invalidateType('layout');
     return parent::_afterSave($object);
 }
开发者ID:vishalpatel14,项目名称:indiankalaniketan,代码行数:31,代码来源:Page.php

示例5: _addLinkStores

 /**
  * Add link stores for custom method
  *
  * @param Mage_Core_Model_Abstract $object
  *
  * @return MatheusGontijo_EasyShippingRules_Model_Resource_Custommethod
  */
 protected function _addLinkStores(Mage_Core_Model_Abstract $object)
 {
     $oldStores = $this->lookupStoreIds($object->getId());
     $newStores = (array) $object->getStores();
     if (empty($newStores)) {
         $newStores = (array) $object->getStoreId();
     }
     $table = $this->getTable('easyshippingrules/custom_method_store');
     $insert = array_diff($newStores, $oldStores);
     $delete = array_diff($oldStores, $newStores);
     if ($delete) {
         $where = array('easyshippingrules_custom_method_id = ?' => $object->getId(), 'store_id IN (?)' => $delete);
         $this->_getWriteAdapter()->delete($table, $where);
     }
     if ($insert) {
         $data = array();
         foreach ($insert as $storeId) {
             $data[] = array('easyshippingrules_custom_method_id' => $object->getId(), 'store_id' => $storeId);
         }
         $this->_getWriteAdapter()->insertMultiple($table, $data);
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:easy-shipping-rules,代码行数:30,代码来源:Custommethod.php

示例6: _afterSave

 /**
  * Function called after a model is saved
  * Save store associations
  *
  * @param Mage_Core_Model_Abstract $object
  * @return $this
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     if ($object->getId()) {
         $oldStores = $this->lookupStoreIds($object->getId());
         $newStores = (array) $object->getStores();
         if (empty($newStores)) {
             $newStores = (array) $object->getStoreId();
         }
         $table = $this->getTable('splash/page_store');
         $insert = array_diff($newStores, $oldStores);
         $delete = array_diff($oldStores, $newStores);
         if ($delete) {
             $this->_getWriteAdapter()->delete($table, array('page_id = ?' => (int) $object->getId(), 'store_id IN (?)' => $delete));
         }
         if ($insert) {
             $data = array();
             foreach ($insert as $storeId) {
                 $data[] = array('page_id' => (int) $object->getId(), 'store_id' => (int) $storeId);
             }
             $this->_getWriteAdapter()->insertMultiple($table, $data);
         }
     }
     // Ensure that attribute's used are set to be used in the product listing
     if (is_array($optionFilters = $object->getOptionFilters())) {
         foreach ($optionFilters as $attribute => $data) {
             $attribute = Mage::getSingleton('eav/config')->getAttribute('catalog_product', $attribute);
             if ($attribute->getId() && !$attribute->getUsedInProductListing()) {
                 try {
                     $attribute->setUsedInProductListing(1)->save();
                 } catch (Exception $e) {
                     Mage::logException($e);
                 }
             }
         }
     }
     return parent::_afterSave($object);
 }
开发者ID:technomagegithub,项目名称:colb2b,代码行数:44,代码来源:Page.php

示例7: _afterSave

 /**
  * Assign image to store views
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Devils_HomeWidget_Model_Resource_Image
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $entityId = (int) $object->getId();
     $oldStores = $this->lookupStoreIds($entityId);
     $newStores = (array) $object->getStores();
     if (empty($newStores)) {
         $newStores = (array) $object->getStoreId();
     }
     $table = $this->getTable('devils_homewidget/image_store');
     $insertStores = array_diff($newStores, $oldStores);
     $deleteStores = array_diff($oldStores, $newStores);
     if ($deleteStores) {
         $where = array('entity_id = ?' => $entityId, 'store_id IN (?)' => $deleteStores);
         $this->_getWriteAdapter()->delete($table, $where);
     }
     if ($insertStores) {
         $data = array();
         foreach ($insertStores as $storeId) {
             $data[] = array('entity_id' => $entityId, 'store_id' => (int) $storeId);
         }
         $this->_getWriteAdapter()->insertMultiple($table, $data);
     }
     $areas = $object->getAreas();
     $table = $this->getTable('devils_homewidget/image_area');
     $where = array('entity_id = ?' => $entityId);
     $this->_getWriteAdapter()->delete($table, $where);
     foreach ($areas as &$area) {
         $area['entity_id'] = $entityId;
     }
     $this->_getWriteAdapter()->insertMultiple($table, $areas);
     //Mark layout cache as invalidated
     Mage::app()->getCacheInstance()->invalidateType('layout');
     return parent::_afterSave($object);
 }
开发者ID:randix0,项目名称:Devils_HomeWidget,代码行数:40,代码来源:Image.php


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