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


PHP Mage_Catalog_Model_Resource_Eav_Attribute::setStoreId方法代码示例

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


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

示例1: getSearchParam

 /**
  * Retrieve filter array
  *
  * @deprecated since 1.12.0.0
  *
  * @param Enterprise_Search_Model_Resource_Collection $collection
  * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
  * @param string|array $value
  * @return array
  */
 public function getSearchParam($collection, $attribute, $value)
 {
     if (empty($value) || isset($value['from']) && empty($value['from']) && isset($value['to']) && empty($value['to'])) {
         return false;
     }
     $locale = Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE);
     $languageSuffix = $this->getLanguageSuffix($locale);
     $field = $attribute->getAttributeCode();
     $backendType = $attribute->getBackendType();
     $frontendInput = $attribute->getFrontendInput();
     if ($frontendInput == 'multiselect') {
         $field = 'attr_multi_' . $field;
     } elseif ($backendType == 'decimal') {
         $field = 'attr_decimal_' . $field;
     } elseif ($frontendInput == 'select' || $frontendInput == 'boolean') {
         $field = 'attr_select_' . $field;
     } elseif ($backendType == 'datetime') {
         $field = 'attr_datetime_' . $field;
         $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
         if (is_array($value)) {
             foreach ($value as &$val) {
                 if (!is_empty_date($val)) {
                     $date = new Zend_Date($val, $format);
                     $val = $date->toString(Zend_Date::ISO_8601) . 'Z';
                 }
             }
         } else {
             if (!is_empty_date($value)) {
                 $date = new Zend_Date($value, $format);
                 $value = $date->toString(Zend_Date::ISO_8601) . 'Z';
             }
         }
     } elseif (in_array($backendType, $this->_textFieldTypes)) {
         $field .= $languageSuffix;
     }
     if ($attribute->usesSource()) {
         $attribute->setStoreId(Mage::app()->getStore()->getId());
     }
     return array($field => $value);
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:50,代码来源:Data.php

示例2: getInsertValues

 /**
  * Retrieve data to be inserted
  *
  * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
  * @return array
  */
 protected function getInsertValues($attribute)
 {
     $data = array();
     foreach ($this->getAllStoresIds() as $storeId) {
         $attribute->setStoreId($storeId);
         if ($attribute->getSourceModel()) {
             $options = $attribute->getSource()->getAllOptions(false);
         } else {
             $collection = Mage::getResourceModel('eav/entity_attribute_option_collection')->setStoreFilter($storeId)->setPositionOrder('asc')->setAttributeFilter($attribute->getId())->load();
             $options = $collection->toOptionArray();
         }
         foreach ($options as $option) {
             // Generate url value
             $urlValue = $this->getHelper()->transliterate($option['label']);
             $urlKey = $this->getHelper()->transliterate($attribute->getStoreLabel($storeId));
             // Check if this url value is taken and add -{count}
             $countValue = 0;
             $origUrlValue = $urlValue;
             do {
                 $found = false;
                 foreach ($data as $line) {
                     if ($line['store_id'] == $storeId && $line['url_value'] == $urlValue) {
                         $urlValue = $origUrlValue . '-' . ++$countValue;
                         $found = true;
                     }
                 }
             } while ($found);
             // Check if this url key is taken and add -{count}
             $countKey = 0;
             $origUrlKey = $urlKey;
             do {
                 $found = false;
                 if ($this->urlKeyExists($attribute->getId(), $urlKey)) {
                     $urlKey = $origUrlKey . '-' . ++$countKey;
                     $found = true;
                 }
             } while ($found);
             $data[] = array('attribute_code' => $attribute->getAttributeCode(), 'attribute_id' => $attribute->getId(), 'store_id' => $storeId, 'option_id' => $option['value'], 'url_key' => $urlKey, 'url_value' => $urlValue);
         }
     }
     return $data;
 }
开发者ID:caciobanu,项目名称:improved-magento-layered-navigation,代码行数:48,代码来源:Attribute.php


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