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_pathtarget_pathます。

于 2014-01-28T08:37:40.123 に答える