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


PHP Mage_Catalog_Model_Category::formatUrlKey方法代码示例

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


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

示例1: beforeSave

 /**
  * Format url_key value
  *
  * @param Mage_Catalog_Model_Category $object
  * @return Mage_Catalog_Model_Category_Attribute_Backend_Urlkey
  */
 public function beforeSave($object)
 {
     $attributeName = $this->getAttribute()->getName();
     $urlKey = $object->getData($attributeName);
     if ($urlKey === false) {
         return $this;
     }
     if ($urlKey == '') {
         $urlKey = $object->getName();
     }
     if (empty($urlKey)) {
         $urlKey = Mage::helper('core')->uniqHash();
     }
     $object->setData($attributeName, $object->formatUrlKey($urlKey));
     $this->_validateEntityUrl($object);
     return $this;
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:23,代码来源:Urlkey.php

示例2: beforeSave

 /**
  * @param Mage_Catalog_Model_Category $object
  * @return $this|Convenient_CategoryCode_Model_Attribute_Backend_Code
  *
  * @author Luke Rodgers <lukerodgers90@gmail.com>
  */
 public function beforeSave($object)
 {
     $attributeName = $this->getAttribute()->getName();
     $code = $object->getData($attributeName);
     if ($code === false) {
         return $this;
     }
     if ($code == '') {
         $code = array();
         $parents = $object->getParentCategories();
         foreach ($parents as $parent) {
             if ($parent->getLevel() > 1 && $parent->getId() != $object->getId()) {
                 $code[] = $parent->getName();
             }
         }
         $code[] = $object->getName();
         $code = implode('-', $code);
     }
     $object->setData($attributeName, $object->formatUrlKey($code));
     return $this;
 }
开发者ID:asif-ali,项目名称:CategoryCode,代码行数:27,代码来源:Code.php

示例3: _formatUrlKey

 /**
  * Format url key of category into valid form
  *
  * @param Mage_Catalog_Model_Category $category
  * @return Mage_Catalog_Model_Category
  */
 protected function _formatUrlKey(Mage_Catalog_Model_Category $category)
 {
     if ($category->getUrlKey() == '') {
         $category->setUrlKey($category->formatUrlKey($category->getName()));
     } else {
         $category->setUrlKey($category->formatUrlKey($category->getUrlKey()));
     }
     return $category;
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:15,代码来源:Refresh.php

示例4: testFormatUrlKey

 public function testFormatUrlKey()
 {
     $this->assertEquals('test', $this->_model->formatUrlKey('test'));
     $this->assertEquals('test-some-chars-5', $this->_model->formatUrlKey('test-some#-chars^5'));
     $this->assertEquals('test', $this->_model->formatUrlKey('test-????????'));
 }
开发者ID:natxetee,项目名称:magento2,代码行数:6,代码来源:CategoryTest.php


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