blackRider
blackRider

Reputation: 143

Magento - How to call a phtml template file from the URL

The question pretty much says it all. I have a store locator application. Which dynamically produces a URL like:

http://www.XXXX.com/storelocator/index/viewstore/id/XXX

And I have also the template file in right directory:

package/template/storelocator/view_store.phtml

Also the block in:

app/code/local/COMPANY/Storelocator

When I click on the ID that is generated by the Javascript, it returns a 404 error. So obviously the template file is not loading. But I am not sure what is causing the issue. Can someone give me some idea.

Upvotes: 0

Views: 1036

Answers (1)

Mufaddal
Mufaddal

Reputation: 5381

have you assign your template file in layout file if not try to assign your block in layout file.

<storelocator_index_viewstore>
 <block type="Storelocator/Storelocator" template="storelocator/view_store.phtml"></block>
</storelocator_index_viewstore>

This way when your action is call magento render this block and call your phtml file

Upvotes: 1

Related Questions