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


PHP Mage_Catalog_Model_Resource_Eav_Attribute::getFrontend方法代码示例

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


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

示例1: addPriceFilter

 /**
  * Add filter by attribute price
  *
  * @param Mage_CatalogSearch_Model_Advanced $object
  * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
  * @param string|array $value
  */
 public function addPriceFilter($object, $attribute, $value)
 {
     if (empty($value['from']) && empty($value['to'])) {
         return false;
     }
     if (Mage::helper('solr')->isEnabled()) {
         $typeConverter = new DMC_Solr_Model_SolrServer_Adapter_Product_TypeConverter();
         $code = $attribute->getAttributeCode();
         $items = $typeConverter->getItems();
         $select = $object->getProductCollection()->getSelect();
         $rate = 1;
         if (!empty($value['currency'])) {
             $rate = Mage::app()->getStore()->getBaseCurrency()->getRate($value['currency']);
         }
         if (strlen($value['from']) > 0) {
             $from = $value['from'] * $rate;
         } else {
             $from = 0;
         }
         if (strlen($value['to']) > 0) {
             $to = $value['to'] * $rate;
         } else {
             $to = 99999999;
         }
         $select->where($items[$attribute->getFrontend()->getInputType()]['solr_index_prefix'] . $typeConverter::SUBPREFIX_INDEX . 'price:[' . $from . ' TO ' . $to . ']');
     } else {
         $adapter = $this->_getReadAdapter();
         $conditions = array();
         if (strlen($value['from']) > 0) {
             $conditions[] = $adapter->quoteInto('price_index.min_price %s * %s >= ?', $value['from']);
         }
         if (strlen($value['to']) > 0) {
             $conditions[] = $adapter->quoteInto('price_index.min_price %s * %s <= ?', $value['to']);
         }
         if (!$conditions) {
             return false;
         }
         $object->getProductCollection()->addPriceData();
         $select = $object->getProductCollection()->getSelect();
         $response = $this->_dispatchPreparePriceEvent($select);
         $additional = join('', $response->getAdditionalCalculations());
         $rate = 1;
         if (!empty($value['currency'])) {
             $rate = Mage::app()->getStore()->getBaseCurrency()->getRate($value['currency']);
         }
         foreach ($conditions as $condition) {
             $select->where(sprintf($condition, $additional, $rate));
         }
     }
     return true;
 }
开发者ID:kevinrademan,项目名称:Magento-Solr,代码行数:58,代码来源:Advanced.php

示例2: getAttributeLabel

 /**
  * Return Product Attribute Store Label
  * Set attribute name like frontend lable for custom attributes (which wasn't defined by Google)
  *
  * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
  * @param int $storeId Store View Id
  * @return string Attribute Store View Label or Attribute code
  */
 public function getAttributeLabel($attribute, $storeId)
 {
     $attributeId = $attribute->getId();
     $frontendLabel = $attribute->getFrontend()->getLabel();
     if (is_array($frontendLabel)) {
         $frontendLabel = array_shift($frontendLabel);
     }
     if (!isset($this->_attributeLabels[$attributeId])) {
         $this->_attributeLabels[$attributeId] = $attribute->getStoreLabels();
     }
     if (isset($this->_attributeLabels[$attributeId][$storeId])) {
         return $this->_attributeLabels[$attributeId][$storeId];
     } else {
         if (!empty($frontendLabel)) {
             return $frontendLabel;
         } else {
             return $attribute->getAttributeCode();
         }
     }
 }
开发者ID:shakhawat4g,项目名称:MagentoExtensions,代码行数:28,代码来源:Product.php

示例3: _getAttributeLabel

 /**
  * Return Product Attribute Store Label
  *
  * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
  * @param int $storeId Store View Id
  * @return string Attribute Store View Label or Attribute code
  */
 protected function _getAttributeLabel($attribute, $storeId)
 {
     $frontendLabel = $attribute->getFrontend()->getLabel();
     if (is_array($frontendLabel)) {
         $frontendLabel = array_shift($frontendLabel);
     }
     if (!$this->_translations) {
         $moduleName = Mage_Catalog_Model_Entity_Attribute::MODULE_NAME;
         $separator = Mage_Core_Model_Translate::SCOPE_SEPARATOR;
         $this->_translations = Mage::getModel('core/translate_string')->load($moduleName . $separator . $frontendLabel)->getStoreTranslations();
     }
     if (isset($this->_translations[$storeId])) {
         return $this->_translations[$storeId];
     } else {
         return $attribute->getAttributeCode();
     }
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:24,代码来源:Item.php

示例4: getProductAttributeValue

 /**
  * Retrieve Product Attribute Value
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
  * @return string
  */
 public function getProductAttributeValue($product, $attribute)
 {
     if (!$product->hasData($attribute->getAttributeCode())) {
         return Mage::helper('Mage_Catalog_Helper_Data')->__('N/A');
     }
     if ($attribute->getSourceModel() || in_array($attribute->getFrontendInput(), array('select', 'boolean', 'multiselect'))) {
         //$value = $attribute->getSource()->getOptionText($product->getData($attribute->getAttributeCode()));
         $value = $attribute->getFrontend()->getValue($product);
     } else {
         $value = $product->getData($attribute->getAttributeCode());
     }
     return (string) $value == '' ? Mage::helper('Mage_Catalog_Helper_Data')->__('No') : $value;
 }
开发者ID:relue,项目名称:magento2,代码行数:20,代码来源:List.php

示例5: getProductAttributeValue

 /**
  * Retrieve Product Attribute Value
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
  * @return string
  */
 public function getProductAttributeValue($product, $attribute)
 {
     if (!$product->hasData($attribute->getAttributeCode())) {
         return '&nbsp;';
     }
     if ($attribute->getSourceModel() || in_array($attribute->getFrontendInput(), array('select', 'boolean', 'multiselect'))) {
         //$value = $attribute->getSource()->getOptionText($product->getData($attribute->getAttributeCode()));
         $value = $attribute->getFrontend()->getValue($product);
     } else {
         $value = $product->getData($attribute->getAttributeCode());
     }
     return $value ? $value : '&nbsp;';
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:20,代码来源:Product_Compare_List.php

示例6: getValueOrValueText

 protected function getValueOrValueText(Mage_Catalog_Model_Product $product, $name, Mage_Catalog_Model_Resource_Eav_Attribute $resource)
 {
     $value_text = $product->getAttributeText($name);
     if (!$value_text) {
         $value_text = $resource->getFrontend()->getValue($product);
     }
     return $value_text;
 }
开发者ID:algolia,项目名称:algoliasearch-magento,代码行数:8,代码来源:Producthelper.php


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