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


PHP Mage_Core_Model_Abstract::getName方法代码示例

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


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

示例1: _beforeSave

 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getId() && $object->getStatus() == $object->getApprovedStatus()) {
         $searchTag = new Varien_Object();
         $this->loadByName($searchTag, $object->getName());
         if ($searchTag->getData($this->getIdFieldName()) && $searchTag->getStatus() == $object->getPendingStatus()) {
             $object->setId($searchTag->getData($this->getIdFieldName()));
         }
     }
     if (Mage::helper('core/string')->strlen($object->getName()) > 255) {
         $object->setName(Mage::helper('core/string')->substr($object->getName(), 0, 255));
     }
     return parent::_beforeSave($object);
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:14,代码来源:Tag.php

示例2: getName

 public function getName()
 {
     $storeId = Mage::app()->getStore()->getStoreId();
     if ($storeId) {
         $labels = $this->getStoreLabels();
         if (isset($labels[$storeId]) && $labels[$storeId]) {
             return $labels[$storeId];
         }
     }
     return parent::getName();
 }
开发者ID:Eximagen,项目名称:BulletMagento,代码行数:11,代码来源:Category.php

示例3: _beforeSave

 /**
  * Action before save
  *
  * @param Mage_Core_Model_Abstract $role
  * @return Mage_Api_Model_Resource_Roles
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $role)
 {
     if ($role->getId() == '') {
         if ($role->getIdFieldName()) {
             $role->unsetData($role->getIdFieldName());
         } else {
             $role->unsetData('id');
         }
     }
     if ($role->getPid() > 0) {
         $row = $this->load($role->getPid());
     } else {
         $row = array('tree_level' => 0);
     }
     $role->setTreeLevel($row['tree_level'] + 1);
     $role->setRoleName($role->getName());
     return $this;
 }
开发者ID:monkviper,项目名称:magento-lite,代码行数:24,代码来源:Roles.php

示例4: _beforeSave

 /**
  * Process role before saving
  *
  * @param Mage_Core_Model_Abstract $role
  * @return Mage_Admin_Model_Resource_Roles
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $role)
 {
     if ($role->getId() == '') {
         if ($role->getIdFieldName()) {
             $role->unsetData($role->getIdFieldName());
         } else {
             $role->unsetData('id');
         }
     }
     if ($role->getPid() > 0) {
         $select = $this->_getReadAdapter()->select()->from($this->getMainTable(), array('tree_level'))->where("{$this->getIdFieldName()} = :pid");
         $binds = array('pid' => (int) $role->getPid());
         $treeLevel = $this->_getReadAdapter()->fetchOne($select, $binds);
     } else {
         $treeLevel = 0;
     }
     $role->setTreeLevel($treeLevel + 1);
     $role->setRoleName($role->getName());
     return $this;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:26,代码来源:Roles.php

示例5: _beforeSave

 /**
  * Process cmspage data before saving
  * prepare path and increment children count for parent cmspages
  *
  * @access protected
  * @param Varien_Object $object
  * @return Ibrams_CmsExtended_Model_Resource_Cmspage
  * @author Ultimate Module Creator
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     $accessroles = $object->getAccessroles();
     if (is_array($accessroles)) {
         $object->setAccessroles(implode(',', $accessroles));
     }
     $permittedroleactions = $object->getPermittedroleactions();
     if (is_array($permittedroleactions)) {
         $object->setPermittedroleactions(implode(',', $permittedroleactions));
     }
     if (!$object->getInitialSetupFlag()) {
         $urlKey = $object->getData('url_key');
         if ($urlKey == '') {
             $urlKey = $object->getName();
         }
         $urlKey = $this->formatUrlKey($urlKey);
         $validKey = false;
         while (!$validKey) {
             $entityId = $this->checkUrlKey($urlKey, $object->getStoreId(), false);
             if ($entityId == $object->getId() || empty($entityId)) {
                 $validKey = true;
             } else {
                 $parts = explode('-', $urlKey);
                 $last = $parts[count($parts) - 1];
                 if (!is_numeric($last)) {
                     $urlKey = $urlKey . '-1';
                 } else {
                     $suffix = '-' . ($last + 1);
                     unset($parts[count($parts) - 1]);
                     $urlKey = implode('-', $parts) . $suffix;
                 }
             }
         }
         $object->setData('url_key', $urlKey);
     }
     parent::_beforeSave($object);
     if (!$object->getChildrenCount()) {
         $object->setChildrenCount(0);
     }
     if ($object->getLevel() === null) {
         $object->setLevel(1);
     }
     if (!$object->getId() && !$object->getInitialSetupFlag()) {
         $object->setPosition($this->_getMaxPosition($object->getPath()) + 1);
         $path = explode('/', $object->getPath());
         $level = count($path);
         $object->setLevel($level);
         if ($level) {
             $object->setParentId($path[$level - 1]);
         }
         $object->setPath($object->getPath() . '/');
         $toUpdateChild = explode('/', $object->getPath());
         $this->_getWriteAdapter()->update($this->getMainTable(), array('children_count' => new Zend_Db_Expr('children_count+1')), array('entity_id IN(?)' => $toUpdateChild));
     }
     return $this;
 }
开发者ID:pboethig,项目名称:vagrant_puppet_magento,代码行数:65,代码来源:Cmspage.php


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