有人可以幫助我有以下問題:Magento的類路徑改變
我想改變類別的URL。
現在如下http://tuinbeursnederland.nl.testbyte.nl/blokhutten-tuinhuizen/blokhutten/op-maat/
而且我希望它像這樣:http://tuinbeursnederland.nl.testbyte.nl/blokhutten/op-maat/
但類別/ blokhutten-tuinhuizen /必須保持。
任何人有任何想法?
有人可以幫助我有以下問題:Magento的類路徑改變
我想改變類別的URL。
現在如下http://tuinbeursnederland.nl.testbyte.nl/blokhutten-tuinhuizen/blokhutten/op-maat/
而且我希望它像這樣:http://tuinbeursnederland.nl.testbyte.nl/blokhutten/op-maat/
但類別/ blokhutten-tuinhuizen /必須保持。
任何人有任何想法?
你可以通過url重寫來實現這一點。
去URL重寫和添加自定義URL重寫,給唯一的ID路徑。
並在請求路徑中給出http://tuinbeursnederland.nl.testbyte.nl/blokhutten-tuinhuizen/blokhutten/op-maat/
此URL並在目標路徑中給這個URL http://tuinbeursnederland.nl.testbyte.nl/blokhutten/op-maat/
magento在內部考慮它的使用目標路徑。
有關網址更多相關資料重寫,你可以在這裏看到http://www.magentocommerce.com/wiki/modules_reference/english/mage_adminhtml/urlrewrite/index
http://blog.beetleweb.com/2012/10/creating-custom-magento-url-rewrites/
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)
);
}
}
請重寫模塊就像我上面做自定義此功能。
你好Dharmesh Hariyani, 我應該準確調整哪個文件? –