本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
示例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];
}
示例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;
}
示例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;
}
}
示例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;
}
示例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();
}
示例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;
}