templates - Magento url routing: how to locate the controller/views for a given url -


i'm new magento , i'm trying find files/code based on url:

somedomainfortesting.com/index.php/catalogsearch/result/?q=test 

i put test domain name above security purposes, in general i'm trying find file(views/controller) above url. i'm new magento.

it's complicated, speaking, magento urls have 3 parts (zend framework 1 style)

http://somedomainfortesting.com/index.php/front-name/controller-name/action-name 

the "front name" identifies module folder can find controller in.

for example, controllers urls catalogsearch frontname can found in

#file: app/code/core/mage/catalogsearch/controllers/ 

you'd know because in mage_catalogsearch configuration file, there's configued frontname (<frontname>catalogsearch</frontname>)

#file: app/code/core/mage/catalogsearch/etc/config.xml     <routers>         <catalogsearch>             <use>standard</use>             <args>                 <module>mage_catalogsearch</module>                 <frontname>catalogsearch</frontname>             </args>         </catalogsearch>     </routers>     

the next part of url defined controller name. controller name determines specific controller file in controllers folder. again, in example controller name result, can find controller in following file (resultcontroller.php)

app/code/core/mage/catalogsearch/controllers/resultcontroller.php  

finally, action name determine method in controller magento call. in example, there no action name, magento defaults name index, means it's indexaction that's called

#file: app/code/core/mage/catalogsearch/controllers/resultcontroller.php public function indexaction() {     //... } 

you'll notice above used term generally identifies -- that's because there's lot of additional cases multiple modules can claim frontname, or users can rewrite urls go elsewhere. if you're interested in learning more , digging deep -- original magento php mvc developers blog series still place start (the content dated, still accurate). if you're not bruised , battered after that, can read in depth magento dispatch covers how magento handles url routing, top bottom.

finally, , little self servingly, can checkout commerce bug -- it's commercial magento debugging extension, , includes information on specific controller loaded page.

enter image description here

you can use free demo see magento defaults, , buy copy own system if think worth it/useful.

hope helps!


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -