2013-11-27 3 views
0

Помогите мне с проблемой, связанной с проблемой:Magento category path change

Я хотел бы изменить URL-адрес категорий.

Теперь следующим http://tuinbeursnederland.nl.testbyte.nl/blokhutten-tuinhuizen/blokhutten/op-maat/

И я хочу, это как так: http://tuinbeursnederland.nl.testbyte.nl/blokhutten/op-maat/

Но категория/blokhutten-tuinhuizen/должно оставаться.

У кого-нибудь есть идеи?

ответ

0

Вы можете достичь этого с помощью перезаписи URL.

Перейти к URL-адресу переписать и добавить пользовательский URL-адрес переписать, указать уникальный путь идентификации.

И в строке запроса введите http://tuinbeursnederland.nl.testbyte.nl/blokhutten-tuinhuizen/blokhutten/op-maat/ этот адрес и в целевой путь дать этот url http://tuinbeursnederland.nl.testbyte.nl/blokhutten/op-maat/ magento внутренне рассмотреть целевой путь для его использования.

Для получения дополнительной информации об URL Rewrite вы можете увидеть здесь http://www.magentocommerce.com/wiki/modules_reference/english/mage_adminhtml/urlrewrite/index

http://blog.beetleweb.com/2012/10/creating-custom-magento-url-rewrites/

0
class CP_Core_Model_Catalogurl extends Mage_Catalog_Model_Url 
{ 
    /** 
    * Retrieve Category URL 
    * 
    * @param array $params 
    * @return string 
    */ 
    public function getCategoryRequestPath($category, $parentPath) 
    { 
     $storeId = $category->getStoreId(); 
     $idPath = $this->generatePath('id', null, $category); 
     $suffix = $this->getCategoryUrlSuffix($storeId); 

     if (isset($this->_rewrites[$idPath])) { 
      $this->_rewrite = $this->_rewrites[$idPath]; 
      $existingRequestPath = $this->_rewrites[$idPath]->getRequestPath(); 
     } 

     if ($category->getUrlKey() == '') { 
      $urlKey = $this->getCategoryModel()->formatUrlKey($category->getName()); 
     } 
     else { 
      $urlKey = $this->getCategoryModel()->formatUrlKey($category->getUrlKey()); 
     } 

     $categoryUrlSuffix = $this->getCategoryUrlSuffix($category->getStoreId()); 
     if (null === $parentPath) { 
      $parentPath = $this->getResource()->getCategoryParentPath($category); 
     } 
     elseif ($parentPath == '/') { 
      $parentPath = ''; 
     } 
     $parentPath = Mage::helper('catalog/category')->getCategoryUrlPath($parentPath, 
                      true, $category->getStoreId()); 
     $parentPath = ''; 

     $requestPath = $parentPath . $urlKey . $categoryUrlSuffix; 
     if (isset($existingRequestPath) && $existingRequestPath == $requestPath . $suffix) { 
      return $existingRequestPath; 
     } 

     if ($this->_deleteOldTargetPath($requestPath, $idPath, $storeId)) { 
      return $requestPath; 
     } 

     return $this->getUnusedPath($category->getStoreId(), $requestPath, 
            $this->generatePath('id', null, $category) 
     ); 
    } 


} 

Пожалуйста переопределения модуль настроить эту функцию, как я выше.

+0

Здравствуйте, Dharmesh Hariyani, Какой файл я должен точно настроить? –