當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。