How to apply condition for specific page in magento?

为君一笑 提交于 2019-12-25 04:46:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!