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


PHP Mage_Catalog_Model_Product::getAttributeSetId方法代码示例

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


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

示例1: convertAttribute

 /**
  * Set current attribute to entry (for specified product)
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Varien_Gdata_Gshopping_Entry $entry
  * @return Varien_Gdata_Gshopping_Entry
  */
 public function convertAttribute($product, $entry)
 {
     $targetCountry = Mage::getSingleton('Mage_GoogleShopping_Model_Config')->getTargetCountry($product->getStoreId());
     $value = Mage::getModel('Mage_GoogleShopping_Model_Type')->loadByAttributeSetId($product->getAttributeSetId(), $targetCountry);
     $val = $value->getCategory() == Mage_GoogleShopping_Helper_Category::CATEGORY_OTHER ? '' : $value->getCategory();
     $this->_setAttribute($entry, 'google_product_category', self::ATTRIBUTE_TYPE_TEXT, htmlspecialchars_decode($val, ENT_NOQUOTES));
     return $entry;
 }
开发者ID:relue,项目名称:magento2,代码行数:15,代码来源:GoogleProductCategory.php

示例2: isShopgateCoupon

 /**
  * Determines if a product is a Shopgate Coupon
  *
  * @param Mage_Catalog_Model_Product $product
  * @return boolean
  */
 public function isShopgateCoupon(Mage_Catalog_Model_Product $product)
 {
     $attributeSetModel = Mage::getModel("eav/entity_attribute_set")->load($product->getAttributeSetId());
     if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL && $attributeSetModel->getAttributeSetName() == self::COUPON_ATTRIUBTE_SET_NAME) {
         return true;
     }
     return false;
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:14,代码来源:Coupon.php

示例3: getProductHtml

 /**
  * Get product html block
  *
  * @param string                     $mode
  * @param Mage_Catalog_Model_Product $product
  * @param array                      $data
  *
  * @return string
  */
 public function getProductHtml($mode, Mage_Catalog_Model_Product $product, $data = array())
 {
     if ($this->isModuleEnabled('Ho_Bootstrap')) {
         $renderer = Mage::helper('ho_bootstrap/list')->getProductRenderer($mode, $product->getTypeId(), $product->getAttributeSetId());
     } else {
         $renderer = array('block' => 'ho_simplebundle/catalog_product_list_type_simplebundle', 'template' => 'ho/simplebundle/catalog/product/list/type/default/simplebundle.phtml');
     }
     /** @var $block Ho_Bootstrap_Block_Catalog_Product_List_Type_Default */
     $block = Mage::app()->getLayout()->createBlock($renderer['block'])->setTemplate($renderer['template'])->setProduct($product)->addData($data);
     return $block->toHtml();
 }
开发者ID:EliasZ,项目名称:Ho_SimpleBundle,代码行数:20,代码来源:Data.php

示例4: getReplicables

 /**
  * Return list of attributes which can be replocated among configurable
  * products and its assigned simple products
  *
  * @param Mage_Catalog_Model_Product $product Product
  * @return array List of Mage_Catalog_Model_Resource_Eav_Attribute entities
  */
 public function getReplicables($product)
 {
     $setId = $product->getAttributeSetId();
     $attrs = $this->_removeConfigurableAttrs($this->_getAttrs($setId), $product);
     $allow = $this->_getReplicableAttrsByUser();
     $_attrs = array();
     foreach ($attrs as $attr) {
         if ((!$attr->getId() || $attr->isInSet($setId)) && $this->_isAllowedAttribute($attr, $allow, $this->_nonReplicable)) {
             $_attrs[$attr->getAttributeCode()] = $attr;
         }
     }
     return $_attrs;
 }
开发者ID:hughwilkie,项目名称:MVentory_Productivity,代码行数:20,代码来源:Attribute.php

示例5: _canAddTab

 /**
  * check if tab can be added
  * @access protected
  * @param Mage_Catalog_Model_Product $product
  * @return bool
  * @author Ultimate Module Creator
  */
 protected function _canAddTab($product)
 {
     if ($product->getId()) {
         return true;
     }
     if (!$product->getAttributeSetId()) {
         return false;
     }
     $request = Mage::app()->getRequest();
     if ($request->getParam('type') == 'configurable') {
         if ($request->getParam('attribtues')) {
             return true;
         }
     }
     return false;
 }
开发者ID:smitmanglam,项目名称:staging,代码行数:23,代码来源:Observer.php

示例6: setProperties

 /**
  * set properties
  */
 public function setProperties()
 {
     if (empty($this->_ignoredProductAttributeCodes)) {
         $ignoredProductAttributeCodes = array("manufacturer", "model");
         $ignoredProperties = explode(",", Mage::getStoreConfig(Shopgate_Framework_Model_Config::XML_PATH_SHOPGATE_EXPORT_FILTER_PROPERTIES));
         $ignoredProductAttributeCodes = array_merge($ignoredProductAttributeCodes, $ignoredProperties);
         $this->_ignoredProductAttributeCodes = array_unique($ignoredProductAttributeCodes);
     }
     if (empty($this->_forcedProductAttributeCodes)) {
         $forcedProperties = explode(",", Mage::getStoreConfig(Shopgate_Framework_Model_Config::XML_PATH_SHOPGATE_EXPORT_FORCE_PROPERTY_EXPORT));
         $this->_forcedProductAttributeCodes = array_unique($forcedProperties);
     }
     $result = array();
     $cacheKey = 'product_type_' . $this->item->getTypeId() . '_attributes_' . $this->item->getAttributeSetId();
     $cache = Mage::app()->getCacheInstance();
     $value = $cache->load($cacheKey);
     if ($value !== false) {
         $attributes = unserialize($value);
     } else {
         $attributes = $this->item->getAttributes();
         $attrCache = array();
         foreach ($attributes as $attribute) {
             $code = $attribute->getAttributeCode();
             /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
             if ($attribute && $attribute->getIsVisibleOnFront() || in_array($code, $this->_forcedProductAttributeCodes)) {
                 if (in_array($code, $this->_ignoredProductAttributeCodes) && !in_array($code, $this->_forcedProductAttributeCodes)) {
                     continue;
                 }
                 $attrCache[$code] = array('id' => $attribute->getId(), 'label' => $attribute->getStoreLabel($this->_getConfig()->getStoreViewId()));
             }
         }
         $attributes = $attrCache;
         $cache->save(serialize($attrCache), $cacheKey, array('shopgate_export', Mage_Core_Model_Mysql4_Collection_Abstract::CACHE_TAG, Mage_Catalog_Model_Resource_Eav_Attribute::CACHE_TAG), 60);
     }
     foreach ($attributes as $code => $data) {
         $value = $this->item->getResource()->getAttribute($code)->getFrontend()->getValue($this->item);
         if (!empty($value) && !is_array($value)) {
             $propertyItemObject = new Shopgate_Model_Catalog_Property();
             $propertyItemObject->setUid($data['id']);
             $propertyItemObject->setLabel($data['label']);
             $propertyItemObject->setValue($value);
             $result[] = $propertyItemObject;
         }
     }
     parent::setProperties($result);
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:49,代码来源:Xml.php

示例7: _getProductAttributeSetSettings

 private function _getProductAttributeSetSettings(Mage_Catalog_Model_Product $product)
 {
     if ($this->_attributeSets == null) {
         $this->_attributeSets = array(0 => array('brandAttribute' => null, 'catFromMagento' => true, 'catFromAttributes' => false, 'categoryAttribute' => null, 'subcategoryAttribute' => null));
         $attributeSetSettings = Mage::getModel('listrak/product_attribute_set_map')->getCollection();
         foreach ($attributeSetSettings as $setSettings) {
             $this->_attributeSets[$setSettings->getAttributeSetId()] = array('brandAttribute' => $setSettings->getBrandAttributeCode(), 'catFromMagento' => $setSettings->finalCategoriesSource() == 'default', 'catFromAttributes' => $setSettings->finalCategoriesSource() == 'attributes', 'categoryAttribute' => $setSettings->getCategoryAttributeCode(), 'subcategoryAttribute' => $setSettings->getSubcategoryAttributeCode());
         }
     }
     return array_key_exists($product->getAttributeSetId(), $this->_attributeSets) ? $this->_attributeSets[$product->getAttributeSetId()] : $this->_attributeSets[0];
 }
开发者ID:RxOuchy,项目名称:LDS_Client_Solutions,代码行数:11,代码来源:Product.php

示例8: _getProductProperties

 /**
  * Fetches attributes for properties column and filters by ignored attributes.
  *
  * @param Mage_Catalog_Model_Product $product
  * @param                            $ignoredProductAttributeCodes
  * @param array                      $forcedProductAttributeCodes
  *
  * @return array
  */
 protected function _getProductProperties($product, $ignoredProductAttributeCodes, $forcedProductAttributeCodes = array())
 {
     $properties = array();
     $cacheKey = 'product_type_' . $product->getTypeId() . '_attributes_' . $product->getAttributeSetId();
     $cache = Mage::app()->getCacheInstance();
     $value = $cache->load($cacheKey);
     if ($value !== false) {
         $attributes = unserialize($value);
     } else {
         $attributes = $product->getAttributes();
         $attrCache = array();
         foreach ($attributes as $attribute) {
             $code = $attribute->getAttributeCode();
             $isFilterable = Mage::getStoreConfigFlag('shopgate/export/filterable_attributes') ? $attribute->getIsFilterable() : false;
             /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
             if ($attribute && ($attribute->getIsVisibleOnFront() || $isFilterable || in_array($code, $forcedProductAttributeCodes))) {
                 if (in_array($code, $ignoredProductAttributeCodes) && !in_array($code, $forcedProductAttributeCodes)) {
                     continue;
                 }
                 $attrCache[$code] = array('id' => $attribute->getId(), 'label' => $attribute->getStoreLabel($this->_getConfig()->getStoreViewId()));
             }
         }
         $attributes = $attrCache;
         $cache->save(serialize($attrCache), $cacheKey, array('shopgate_export', Mage_Core_Model_Mysql4_Collection_Abstract::CACHE_TAG, Mage_Catalog_Model_Resource_Eav_Attribute::CACHE_TAG), 3600);
     }
     foreach ($attributes as $code => $data) {
         $value = $product->getResource()->getAttribute($code)->getFrontend()->getValue($product);
         if ($value) {
             $properties[$code] = "{$data['label']}=>{$value}";
         }
     }
     return $properties;
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:42,代码来源:Product.php

示例9: _loadAttributeModel

 /**
  * load attribute model
  *
  * @param Mage_Catalog_Model_Product $product
  */
 protected function _loadAttributeModel(Mage_Catalog_Model_Product $product)
 {
     $attributeSetModel = Mage::getModel("eav/entity_attribute_set");
     $attributeSetModel->load($product->getAttributeSetId());
     if ($attributeSetModel->getId()) {
         $this->_attributeSet = $attributeSetModel;
     }
 }
开发者ID:dotmailer,项目名称:dotmailer-magento-extension,代码行数:13,代码来源:Order.php

示例10: _validateProductVariations

 /**
  * Product variations attributes validation
  *
  * @param Mage_Catalog_Model_Product $parentProduct
  * @param array $products
  *
  * @return array
  */
 protected function _validateProductVariations($parentProduct, $products)
 {
     $validationResult = array();
     foreach ($products as $productData) {
         $product = $this->_objectManager->create('Mage_Catalog_Model_Product');
         $product->setData('_edit_mode', true);
         if ($storeId = $this->getRequest()->getParam('store')) {
             $product->setStoreId($storeId);
         }
         $product->setAttributeSetId($parentProduct->getAttributeSetId());
         $product->addData($productData);
         $product->setCollectExceptionMessages(true);
         $configurableAttribute = Mage::helper('Mage_Core_Helper_Data')->jsonDecode($productData['configurable_attribute']);
         $configurableAttribute = implode('-', $configurableAttribute);
         foreach ($product->validate() as $attributeCode => $result) {
             if (is_string($result)) {
                 $validationResult['variations-matrix-' . $configurableAttribute . '-' . $attributeCode] = $result;
             }
         }
     }
     return $validationResult;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:30,代码来源:ProductController.php

示例11: extractAttributeSetValue

 /**
  * extract the attribute set name
  *
  * @param DOMNodeList $nodes
  * @param Mage_Catalog_Model_Product $product
  * @return int
  */
 public function extractAttributeSetValue(DOMNodeList $nodes, Mage_Catalog_Model_Product $product)
 {
     $attributeSetName = $this->coreHelper->extractNodeVal($nodes);
     $attributeSetId = Mage::helper('ebayenterprise_catalog')->getAttributeSetIdByName($attributeSetName);
     if (is_null($attributeSetId)) {
         // @todo: move to error confirmation feed
         $logData = ['attribute_set_name' => $attributeSetName];
         $logMessage = 'Attribute Set "{attribute_set_name}" has not yet been setup for this Magento instance.';
         $this->logger->warning($logMessage, $this->context->getMetaData(__CLASS__, $logData));
     }
     return $attributeSetId ?: $product->getAttributeSetId();
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:19,代码来源:Map.php

示例12: _getMappedAttributes

 /**
  * @param Mage_Catalog_Model_Product $product
  * @return mixed
  */
 protected function _getMappedAttributes(Mage_Catalog_Model_Product $product)
 {
     $attributeSetId = $product->getAttributeSetId();
     $attributeModel = Mage::getModel('xcom_mapping/attribute');
     $mappedAttributes = $attributeModel->getSelectAttributesMapping($attributeSetId);
     return $mappedAttributes;
 }
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:11,代码来源:Product.php


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