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


PHP Mage_Eav_Model_Entity_Attribute::getIsUserDefined方法代码示例

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


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

示例1: saveAttribute

 private function saveAttribute()
 {
     if ($this->attributeObj->getId()) {
         return array('result' => true, 'obj' => $this->attributeObj, 'code' => $this->attributeObj->getAttributeCode());
     }
     if (!$this->validate()) {
         return array('result' => false, 'error' => 'Attribute builder. Validation failed.');
     }
     $data = $this->params;
     $data['attribute_code'] = $this->code;
     $data['frontend_label'] = array(Mage_Core_Model_App::ADMIN_STORE_ID => $this->primaryLabel);
     $data['frontend_input'] = $this->inputType;
     $data['source_model'] = Mage::helper('catalog/product')->getAttributeSourceModelByInputType($this->inputType);
     $data['backend_model'] = Mage::helper('catalog/product')->getAttributeBackendModelByInputType($this->inputType);
     !isset($data['is_global']) && ($data['is_global'] = self::SCOPE_STORE);
     !isset($data['is_configurable']) && ($data['is_configurable'] = 0);
     !isset($data['is_filterable']) && ($data['is_filterable'] = 0);
     !isset($data['is_filterable_in_search']) && ($data['is_filterable_in_search'] = 0);
     $this->attributeObj = Mage::getModel('catalog/resource_eav_attribute');
     if (is_null($this->attributeObj->getIsUserDefined()) || $this->attributeObj->getIsUserDefined() != 0) {
         $data['backend_type'] = $this->attributeObj->getBackendTypeByInput($this->inputType);
     }
     // default value
     if (empty($data['default_value'])) {
         unset($data['default_value']);
     }
     // ---------------------------------------
     !isset($data['apply_to']) && ($data['apply_to'] = array());
     // prepare options
     foreach ($this->options as $optionValue) {
         $code = 'option_' . substr(sha1($optionValue), 0, 6);
         $data['option']['value'][$code] = array(Mage_Core_Model_App::ADMIN_STORE_ID => $optionValue);
     }
     // ---------------------------------------
     $this->attributeObj->addData($data);
     $this->attributeObj->setEntityTypeId($this->entityTypeId);
     $this->attributeObj->setIsUserDefined(1);
     try {
         $this->attributeObj->save();
     } catch (Exception $e) {
         return array('result' => false, 'error' => $e->getMessage());
     }
     return array('result' => true, 'obj' => $this->attributeObj, 'code' => $this->attributeObj->getAttributeCode());
 }
开发者ID:aligent,项目名称:M2E,代码行数:44,代码来源:Builder.php

示例2: isReservedAttribute

 /**
  *  Check whether attribute reserved or not
  *
  *  @param    Mage_Eav_Model_Entity_Attribute $attribute Attribute model object
  *  @return boolean
  */
 public function isReservedAttribute($attribute)
 {
     return $attribute->getIsUserDefined() && in_array($attribute->getAttributeCode(), $this->getReservedAttributes());
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:10,代码来源:Product.php

示例3: canUseAttribute

 /**
  * Checkin attribute availability for create superproduct
  *
  * @param   Mage_Eav_Model_Entity_Attribute $attribute
  * @return  bool
  */
 public function canUseAttribute(Mage_Eav_Model_Entity_Attribute $attribute)
 {
     $allow = $attribute->getIsGlobal() == Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL && $attribute->getIsVisible() && $attribute->getIsConfigurable() && $attribute->usesSource() && $attribute->getIsUserDefined();
     return $allow;
 }
开发者ID:njaeger,项目名称:magento_github,代码行数:11,代码来源:Configurable.php


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