问题
I want to apply condition for specific page coming from url. It is neither a category page nor a custom cms page. Url is like localhost/project/index.php/news/blog.html. I want to apply condition for this 'news/blog.html' . News or blog is not a category and not any cms page. Can anybody help me?
回答1:
It depends on the type of condition, you want to user over there. You can try with the following. 1. Try to put a observer in the relevant controller using the cheat sheet https://www.nicksays.co.uk/magento-events-cheat-sheet-1-5/ 2. Directly try to edit model in the module of that page. 3. Try to put some code directly into the file.
Thanks,
回答2:
Use the following code.
Mage::app()->getRequest()->getControllerName();
It will give controller name to your module. Put consition for this name and write your code. It will work for sure.
来源:https://stackoverflow.com/questions/40254372/how-to-apply-condition-for-specific-page-in-magento