1

我已经为不同国家和城市的商店创建了自定义模块,所以我必须从这个 url http://domain1.com/magento/index.php/shops/index/viewcountry/country/IN/重写模块的 url 到这个 url http://domain1.com/magento/index.php/India-sarees-shops.html
下面是我的 urlrewrite 代码

<?php 

        $storeId = Mage::app()->getStore()->getId();
        Mage::getModel('core/url_rewrite')
        ->setIsSystem(0)
        ->setStoreId($storeId)   
        ->setOptions('RP')  
        ->setIdPath('viewcountry/country/' .$country['value'])
        ->setTargetPath($country['label'].'-sarees-shops.html')
        ->setRequestPath('shops/index/viewcountry/country/'.$country['value'].'/')
        ->save(); 
?>

还得到“指定商店的 ID 路径,指定商店的请求路径已经存在”错误请帮帮我

4

1 回答 1

0

尝试这个:

->setIdPath('viewcountry/country/'.$country['value'].'_'.time())

这会随机化id_path,它仍然会从requested_pathto重定向target_path

于 2014-01-28T08:37:40.123 回答