I want to create url like {base_url}/customize/{product_slug}.phtml
Could please help how to make this of url Magento?
Currently I have created "CustomizeController.php" file
<?php
class ProductCustomizer_ProductCustomizer_CustomizeController extends Mage_Core_Controller_Front_Action {
public function indexAction(){
echo 'test mamethode';
$product = Mage::getModel("productcustomizer/customizeproduct")->getProduct();
}
public function mamethodeAction(){
echo 'test mamethode';
}
}
and below code in config.xml file
<productcustomizer_customize_index>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="productcustomizer/customize" name="productcustomizer_customize" template="productcustomizer/customize.phtml"/>
</reference>
</productcustomizer_customize_index>
Please assign in $url_key to resolve the issue.
$rewrite = Mage::getModel('core/url_rewrite');
$rewrite->setStoreId($store_id) ->setIdPath('customize/'.$url_key) ->setRequestPath('customize/'.$url_key.'.html') ->setTargetPath('customize/index/action/id/'.$url_key) ->setIsSystem(true) ->save();
I have found solution you can set routing using config.xml file
<global>
<rewrite>
<productcustomizer_url>
<from><![CDATA[#^/customize/#]]></from>
<to><![CDATA[/productcustomizer/customize/index/product/]]></to>
<complete>1</complete>
</productcustomizer_url>
</rewrite>
<global>