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


PHP Mage_Catalog_Model_Abstract::getWebsiteStoreIds方法代码示例

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


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

示例1: _saveAttributeValue

 /**
  * Insert or Update attribute data
  *
  * @param Mage_Catalog_Model_Abstract $object
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param mixed $value
  * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Abstract
  */
 protected function _saveAttributeValue($object, $attribute, $value)
 {
     $write = $this->_getWriteAdapter();
     $storeId = Mage::app()->getStore($object->getStoreId())->getId();
     $table = $attribute->getBackend()->getTable();
     /**
      * If we work in single store mode all values should be saved just
      * for default store id
      * In this case we clear all not default values
      */
     if (Mage::app()->isSingleStoreMode()) {
         $storeId = $this->getDefaultStoreId();
         $write->delete($table, join(' AND ', array($write->quoteInto('attribute_id=?', $attribute->getAttributeId()), $write->quoteInto('entity_id=?', $object->getEntityId()), $write->quoteInto('store_id<>?', $storeId))));
     }
     $bind = array('entity_type_id' => $attribute->getEntityTypeId(), 'attribute_id' => $attribute->getAttributeId(), 'store_id' => $storeId, 'entity_id' => $object->getEntityId(), 'value' => $this->_prepareValueForSave($value, $attribute));
     if ($attribute->isScopeStore()) {
         /**
          * Update attribute value for store
          */
         $this->_attributeValuesToSave[$table][] = $bind;
     } else {
         if ($attribute->isScopeWebsite() && $storeId != $this->getDefaultStoreId()) {
             /**
              * Update attribute value for website
              */
             $storeIds = $object->getWebsiteStoreIds();
             foreach ($storeIds as $storeId) {
                 $bind['store_id'] = $storeId;
                 $this->_attributeValuesToSave[$table][] = $bind;
             }
         } else {
             /**
              * Update global attribute value
              */
             $bind['store_id'] = $this->getDefaultStoreId();
             $this->_attributeValuesToSave[$table][] = $bind;
         }
     }
     return $this;
 }
开发者ID:joebushi,项目名称:magento-mirror,代码行数:48,代码来源:Abstract.php

示例2: testGetWebsiteStoreIds

 public function testGetWebsiteStoreIds()
 {
     $ids = $this->_model->getWebsiteStoreIds();
     $storeId = Mage::app()->getStore()->getId();
     $this->assertEquals(array($storeId => $storeId), $ids);
 }
开发者ID:relue,项目名称:magento2,代码行数:6,代码来源:AbstractTest.php


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