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


PHP Mage_Catalog_Model_Product::getAttributeText方法代码示例

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


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

示例1: getSize

 /**
  * Get the size attribute value of a product
  *
  * @param Mage_Catalog_Model_Product $product
  * @return string
  */
 protected function getSize($product)
 {
     $size = $product->getAttributeText('shoe_size');
     $size = trim($size);
     return $size;
 }
开发者ID:xiaoguizhidao,项目名称:marketplace-web-service,代码行数:12,代码来源:Product.php

示例2: getProduttoreProdotto

 private function getProduttoreProdotto(Mage_Catalog_Model_Product $product)
 {
     if ($product->getAttributeText(Mage::helper('itserv_analytics')->getBrandAttributeCode())) {
         return $product->getAttributeText(Mage::helper('itserv_analytics')->getBrandAttributeCode());
     } else {
         return '';
     }
 }
开发者ID:infoitservit,项目名称:mag_itserv_analytics,代码行数:8,代码来源:Universal.php

示例3: _createProduct

 /**
  * @param Mage_Catalog_Model_Product $product
  * @return array
  */
 protected function _createProduct(Mage_Catalog_Model_Product $product)
 {
     $brand = null;
     if ($product->hasData('brand')) {
         $brand = $product->getAttributeText('brand');
     }
     $manufacturer = null;
     if ($product->hasData('manufacturer')) {
         $manufacturer = $product->getAttributeText('manufacturer');
     }
     $data = array('id' => $product->getEntityId(), 'productTypeId' => $this->_getProductTypeId($product), 'name' => array($this->_createLocalizedValue($product->getName())), 'shortDescription' => array($this->_createLocalizedValue($product->getShortDescription())), 'description' => array($this->_createLocalizedValue($product->getDescription())), 'GTIN' => $product->hasData('gtin') ? $product->getAttributeText('gtin') : null, 'brand' => !empty($brand) ? array($this->_createLocalizedValue($brand)) : null, 'manufacturer' => !empty($manufacturer) ? array($this->_createLocalizedValue($manufacturer)) : null, 'MPN' => $product->hasData('mpn') ? $product->getAttributeText('mpn') : null, 'MSRP' => $this->_getMsrp($product), 'MAP' => $product->hasData('map') ? $this->_getCurrencyAmount($product->getAttributeText('map')) : null, 'images' => $this->_createImageUrls($product), 'attributes' => $this->_createAttributes($product), 'variationFactors' => $this->_createVariationFactors($product), 'skuList' => $this->_createSkus($product));
     return $data;
 }
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:17,代码来源:Product.php

示例4: _attributes

 /**
  * @param Mage_Catalog_Model_Product $product
  */
 protected function _attributes(Mage_Catalog_Model_Product &$product)
 {
     $_attributes = $product->getAttributes();
     /** @var Mage_Eav_Model_Entity_Attribute $attribute */
     foreach ($_attributes as $attribute) {
         if ($attribute->getBackendType() == self::ATTRIBUTE_TYPE_TO_PREPARE) {
             $attributeText = $product->getAttributeText($attribute->getAttributeCode());
             //getting attribute value
             $product->setData($attribute->getAttributeCode(), $attributeText);
             //setting this to product  (override existing integer value)
         }
     }
 }
开发者ID:sereban,项目名称:magento-marketo-integration,代码行数:16,代码来源:Product.php

示例5: _encodeProduct

 /**
  * Encodes a single Magento Product.
  *
  * @param Mage_Catalog_Model_Product $product
  *
  * @return RTDProduct
  */
 protected function _encodeProduct(Mage_Catalog_Model_Product $product)
 {
     $encodedProduct = new RTDProduct();
     $customMapping = Mage::getConfig()->getNode('rtd_mappings/product/export');
     $attributeTypes = array('multiselect', 'dropdown');
     foreach ($customMapping->asArray() as $magentoKey => $rtdKey) {
         try {
             $attribute = $product->getResource()->getAttribute($magentoKey);
             if ($attribute != false && in_array($attribute->getFrontendInput(), $attributeTypes)) {
                 $encodedProduct->setParam($rtdKey, $product->getAttributeText($magentoKey));
             } else {
                 $encodedProduct->setParam($rtdKey, $product->{'get' . $magentoKey}());
             }
         } catch (Exception $ex) {
             Mage::log($ex->getMessage(), null, 'realtimedespatch.log');
         }
     }
     if (Mage::getStoreConfigFlag('sixbysix_realtimedespatch/product_export/image_export')) {
         $this->_swapPlaceholderWithParentImage($product, $encodedProduct);
     }
     return $encodedProduct;
 }
开发者ID:pierre-pizzetta,项目名称:orderflow-magento-module,代码行数:29,代码来源:Products.php

示例6: _getIdentifierByType

 /**
  * @param $type
  * @param $result
  */
 protected function _getIdentifierByType($type, &$result)
 {
     $typeLabel = '';
     switch ($type) {
         case 'ean':
             $attributeCode = Mage::getStoreConfig(Shopgate_Framework_Model_Config::XML_PATH_SHOPGATE_EAN_ATTR_CODE);
             $typeLabel = 'EAN';
             break;
         case 'upc':
             $attributeCode = Mage::getStoreConfig(Shopgate_Framework_Model_Config::XML_PATH_SHOPGATE_UPC_ATTR_CODE);
             $typeLabel = 'UPC';
             break;
     }
     if (!empty($attributeCode)) {
         $textValue = $this->item->getAttributeText($attributeCode);
         $attributeValue = $this->item->getData($attributeCode);
         if (!empty($value) || !empty($attributeValue)) {
             $identifierItemObject = new Shopgate_Model_Catalog_Identifier();
             $identifierItemObject->setType($typeLabel);
             $identifierItemObject->setValue($textValue ? $textValue : $attributeValue);
             $result[] = $identifierItemObject;
         }
     }
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:28,代码来源:Xml.php

示例7: getConfigurableSettings

 /**
  * Retrieve configurable settings
  *
  * @param Mage_Catalog_Model_Product $product
  * @return array
  */
 public function getConfigurableSettings($product)
 {
     $data = array();
     $attributes = $this->_getProduct()->getTypeInstance(true)->getUsedProductAttributes($this->_getProduct());
     foreach ($attributes as $attribute) {
         $data[] = array('attribute_id' => $attribute->getId(), 'label' => $product->getAttributeText($attribute->getAttributeCode()), 'value_index' => $product->getData($attribute->getAttributeCode()));
     }
     return $data;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:15,代码来源:Config.php

示例8: isVirtual

 /**
  * Check is virtual product
  *
  * @param Mage_Catalog_Model_Product $product
  * @return bool
  */
 public function isVirtual($product = null)
 {
     if (!$product) {
         return false;
     }
     if ($product->getCustomOption('card_type')) {
         $type = $product->getCustomOption('card_type')->getValue();
     } else {
         $type = $product->getAttributeText('wts_gc_type');
     }
     if ($product && $type == 'offline') {
         return false;
     } else {
         return true;
     }
 }
开发者ID:bevello,项目名称:bevello,代码行数:22,代码来源:Giftcards.php

示例9: _writeOrderProductAttribute

 protected function _writeOrderProductAttribute(Mage_Catalog_Model_Product $product, XMLWriter $xml, $storeId = null)
 {
     // custom attributes are specified in Admin > Configuration > Sales > Auctane Shipstation API
     // static because attributes can be cached, they do not change during a request
     static $attrs = null;
     if (is_null($attrs)) {
         $attrs = Mage::getResourceModel('eav/entity_attribute_collection');
         $attrIds = explode(',', Mage::getStoreConfig('sales/auctaneapi/customattributes', $storeId));
         $attrs->addFieldToFilter('attribute_id', $attrIds);
     }
     /* @var $attr Mage_Eav_Model_Entity_Attribute */
     foreach ($attrs as $attr) {
         if ($product->hasData($attr->getName())) {
             // if an attribute has options/labels
             if (in_array($attr->getFrontendInput(), array('select', 'multiselect'))) {
                 $value = $product->getAttributeText($attr->getName());
                 if (is_array($value)) {
                     $value = implode(',', $value);
                 }
             } else {
                 $value = $product->getDataUsingMethod($attr->getName());
             }
             // fake an item option
             $option = array('value' => $value, 'label' => $attr->getFrontendLabel());
             $this->_writeOrderItemOption($option, $xml, $storeId);
         }
     }
 }
开发者ID:xiaoguizhidao,项目名称:bb,代码行数:28,代码来源:Export.php

示例10: 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

示例11: _getProductAttribute

 private function _getProductAttribute(Mage_Catalog_Model_Product $product, $attributeName)
 {
     if (!$this->_retrieveAttributes) {
         return $product->getAttributeText($attributeName);
     } else {
         $value = $this->_getAttributeValue($product, $attributeName);
         if (is_array($value)) {
             $value = implode(', ', $value);
         }
         return $value;
     }
 }
开发者ID:RxOuchy,项目名称:LDS_Client_Solutions,代码行数:12,代码来源:Product.php

示例12: testGetAttributeText

 public function testGetAttributeText()
 {
     $this->assertNull($this->_model->getAttributeText('status'));
     $this->_model->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
     $this->assertEquals('Enabled', $this->_model->getAttributeText('status'));
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:6,代码来源:ProductGetters.php

示例13: getAttributeValue

 private function getAttributeValue(Mage_Catalog_Model_Product $product, $attributeName)
 {
     $attribute = $product->getResource()->getAttribute($attributeName);
     if ($attribute instanceof Mage_Catalog_Model_Resource_Eav_Attribute) {
         $attribute_data = $product->getData($attributeName);
         $attribute_value = $product->getAttributeText($attributeName);
         if (empty($attribute_value) && is_scalar($attribute_data)) {
             $attribute_value = $attribute_data;
         }
     } else {
         $attribute_value = null;
     }
     return trim($attribute_value);
 }
开发者ID:nosto,项目名称:nosto-magento-extension,代码行数:14,代码来源:Product.php

示例14: amendAttributeTags

 /**
  * Amends the product attributes to tags array if attributes are defined
  * and are present in product
  *
  * @param Mage_Catalog_Model_Product $product the product model.
  * @param Mage_Core_Model_Store      $store the store model.
  *
  */
 protected function amendAttributeTags(Mage_Catalog_Model_Product $product, Mage_Core_Model_Store $store)
 {
     $product_attributes = $product->getAttributes();
     /* @var Nosto_Tagging_Helper_Data $nosto_helper */
     $nosto_helper = Mage::helper("nosto_tagging");
     foreach (Nosto_Tagging_Helper_Data::$validTags as $tag_id) {
         $attributes_to_tag = $nosto_helper->getAttributesToTag($tag_id, $store->getId());
         if (empty($attributes_to_tag) || !is_array($attributes_to_tag)) {
             continue;
         }
         /* @var Mage_Catalog_Model_Resource_Eav_Attribute $product_attribute*/
         foreach ($product_attributes as $key => $product_attribute) {
             if (in_array($key, $attributes_to_tag)) {
                 try {
                     $attribute_data = $product->getData($key);
                     $attribute_value = $product->getAttributeText($key);
                     if (!$attribute_value && is_scalar($attribute_data)) {
                         $attribute_value = $attribute_data;
                     }
                     $attribute_value = trim($attribute_value);
                     if (!empty($attribute_value)) {
                         $this->_tags[$tag_id][] = sprintf('%s:%s', $key, $attribute_value);
                     }
                 } catch (Exception $e) {
                     Mage::log(sprintf('Failed to add attribute %s to tags. Error message was: %s', $key, $e->getMessage()), Zend_Log::WARN, Nosto_Tagging_Model_Base::LOG_FILE_NAME);
                 }
             }
         }
     }
 }
开发者ID:nosto,项目名称:nosto-magento-nodeps,代码行数:38,代码来源:Product.php

示例15: _addRequiredCustomAttributes

 /**
  * Add required custom attributes which were not mapped
  *
  * @param array $mappedAttributes
  * @param Mage_Catalog_Model_Product $product
  * @return Xcom_Mapping_Model_Mapper
  */
 protected function _addRequiredCustomAttributes($mappedAttributes, $product)
 {
     $requiredCustomAttributes = $this->_requiredCustomAttributes;
     // except all required custom attributes which were already mapped
     foreach ($mappedAttributes as $attribute) {
         $key = array_search($attribute['attribute_code'], $requiredCustomAttributes);
         if ($key !== false) {
             unset($requiredCustomAttributes[$key]);
         }
     }
     // add all not mapped required custom attributes to options
     foreach ($requiredCustomAttributes as $attributeCode) {
         $value = $product->getAttributeText($attributeCode);
         if (!empty($value)) {
             $this->_options[$attributeCode] = $value;
         }
     }
     return $this;
 }
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:26,代码来源:Mapper.php


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