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


PHP Mage_Core_Model_Abstract::getFrontendLabel方法代码示例

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


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

示例1: _beforeSave

 /**
  * Set required fields before saving model
  *
  * @param Mage_Core_Model_Abstract $object
  * @return $this
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getDisplayName()) {
         if (!$object->getFrontendLabel()) {
             throw new Exception(Mage::helper('attributeSplash')->__('Splash object must have a name'));
         } else {
             $object->setDisplayName($object->getFrontendLabel());
         }
     }
     if ($object->getCategoryId()) {
         $category = Mage::getModel('catalog/category')->load($object->getCategoryId());
         if (!$category->getId()) {
             $object->setCategoryId(null);
         }
     } else {
         $object->setCategoryId(null);
     }
     if (!$object->getUrlKey()) {
         $object->setUrlKey($object->getname());
     }
     $object->setUrlKey($this->formatUrlKey($object->getUrlKey()));
     $object->setUpdatedAt(now());
     if (!$object->getCreatedAt()) {
         $object->setCreatedAt(now());
     }
     return parent::_beforeSave($object);
 }
开发者ID:Benjamin021,项目名称:magento-attribute-page,代码行数:33,代码来源:Abstract.php

示例2: _beforeSave

 /**
  * Set required fields before saving model
  *
  * @param Mage_Core_Model_Abstract $object
  * @return $this
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getDisplayName()) {
         if (!$object->getFrontendLabel()) {
             throw new Exception(Mage::helper('attributeSplash')->__('Splash object must have a name'));
         } else {
             $object->setDisplayName($object->getFrontendLabel());
         }
     }
     if ($object->getCategoryId()) {
         $category = Mage::getModel('catalog/category')->load($object->getCategoryId());
         if (!$category->getId()) {
             $object->setCategoryId(null);
         }
     } else {
         $object->setCategoryId(null);
     }
     if (!$object->getUrlKey()) {
         $object->setUrlKey($object->getname());
     }
     $object->setUrlKey($this->formatUrlKey($object->getUrlKey()));
     $object->setUpdatedAt(now());
     if (!$object->getCreatedAt()) {
         $object->setCreatedAt(now());
     }
     if (is_array($object->getCustomFields())) {
         $customFields = array();
         foreach ($object->getCustomFields() as $field => $value) {
             if (trim($value) !== '') {
                 $customFields[$field] = $value;
             }
         }
         if (count($customFields) > 0) {
             $object->setCustomFields(serialize($customFields));
         } else {
             $object->setCustomFIelds('');
         }
     }
     return parent::_beforeSave($object);
 }
开发者ID:sreichel,项目名称:magento-Fishpig-Attribute-Splash-Pages,代码行数:46,代码来源:Abstract.php

示例3: _beforeSave

 /**
  * Validate attribute data before save
  *
  * @param Mage_Eav_Model_Entity_Attribute|Mage_Core_Model_Abstract $object
  * @return Mage_Eav_Model_Resource_Entity_Attribute
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     $frontendLabel = $object->getFrontendLabel();
     if (is_array($frontendLabel)) {
         if (!isset($frontendLabel[0]) || is_null($frontendLabel[0]) || $frontendLabel[0] == '') {
             Mage::throwException($this->_helper('Mage_Eav_Helper_Data')->__('Frontend label is not defined'));
         }
         $object->setFrontendLabel($frontendLabel[0])->setStoreLabels($frontendLabel);
     }
     /**
      * @todo need use default source model of entity type !!!
      */
     if (!$object->getId()) {
         if ($object->getFrontendInput() == 'select') {
             $object->setSourceModel('Mage_Eav_Model_Entity_Attribute_Source_Table');
         }
     }
     return parent::_beforeSave($object);
 }
开发者ID:natxetee,项目名称:magento2,代码行数:25,代码来源:Attribute.php

示例4: loadFromAttribute

 public function loadFromAttribute(Mage_Core_Model_Abstract $object, $attribute_code = null, $option_id = null, $store_id = null)
 {
     $read = $this->_getReadAdapter();
     if ($read && !is_null($attribute_code)) {
         $select = $read->select()->from(array('main_table' => $this->getMainTable()))->joinRight(array('aov' => $this->getTable('eav/attribute_option_value')), 'aov.option_id = main_table.attribute_option_id AND aov.store_id = main_table.attribute_value_store_id', array('value_id', 'value', 'store_id', 'option_id'))->join(array('ao' => $this->getTable('eav/attribute_option')), 'ao.option_id = aov.option_id', array())->join(array('a' => $this->getTable('eav/attribute')), 'a.attribute_id = ao.attribute_id', array('attribute_code', 'frontend_label'))->where('a.attribute_code = ?', $attribute_code)->where('ao.option_id = ?', $option_id)->where('aov.store_id in (0, ?)', $store_id)->order('aov.store_id DESC');
         $data = $read->fetchRow($select);
         if ($data) {
             $object->setData($data);
             //set the default values for the new info page, extracted from the attribute values
             if (!$object->getData('name')) {
                 $object->setData('name', __('Products by %s: %s', $object->getFrontendLabel(), $object->getValue()));
             }
             if (!$object->getData('external_url_label')) {
                 $object->setData('external_url_label', __('Visit %s on the web', $object->getValue()));
             }
             if (!$object->getData('identifier')) {
                 $object->setData('identifier', $this->formatUrlKey($object->getValue()));
             }
         }
     }
     $this->_afterLoad($object);
     return $this;
 }
开发者ID:arzzzen,项目名称:DC_Catalog,代码行数:23,代码来源:Manufacturer.php

示例5: _beforeSave

 /**
  * Enter description here...
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Eav_Model_Mysql4_Entity_Attribute
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     $frontendLabel = $object->getFrontendLabel();
     if (is_array($frontendLabel)) {
         if (!isset($frontendLabel[0]) || is_null($frontendLabel[0]) || $frontendLabel[0] == '') {
             AO::throwException(AO::helper('eav')->__('Frontend label is not defined'));
         }
         $object->setFrontendLabel($frontendLabel[0]);
         if ($object->getData('modulePrefix')) {
             $str = $object->getData('modulePrefix') . Mage_Core_Model_Translate::SCOPE_SEPARATOR . $frontendLabel[0];
         } else {
             $str = $frontendLabel[0];
         }
         AO::getModel('core/translate_string')->setString($str)->setTranslate($frontendLabel[0])->setStoreTranslations($frontendLabel)->save();
     }
     $applyTo = $object->getApplyTo();
     if (is_array($applyTo)) {
         $object->setApplyTo(implode(',', $applyTo));
     }
     /**
      * @todo need use default source model of entity type !!!
      */
     if (!$object->getId()) {
         if ($object->getFrontendInput() == 'select') {
             $object->setSourceModel('eav/entity_attribute_source_table');
         }
     }
     return parent::_beforeSave($object);
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:35,代码来源:Mysql4_Entity_Attribute.php


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