Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How to create a new template file? 
 
TioSolid
Jr. Member
 
Total Posts:  28
Joined:  2008-11-07
 

Hi, Im creating a simple magento plugin but I need a new template to it. I already overrided the needed files using the \magento\app\design\frontend\default\mytemplate\template\sales\order approach, what I need now is an entirely new file to display some information. I created the file right into the order folder and named it test.phtml, but im not able to call it using a link to \magento\app\design\frontend\default\mytemplate\template\sales\order\test

What exactly should I do?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gyniolatry
Sr. Member
 
Total Posts:  132
Joined:  2009-11-26
Perth.au
 

You need to reference it from a layout file ie
to place in a category page edit /layout/catalog.xml <catalog_category_default>

Or by cms page layout update.

<reference name="left">      <!--   leftrightcontentfooter -- is where you would like it to appear -->
<
block type="sales/order" 
before="-"     <!--  before="-" means place at the begining of blockafter="currency" place after "currency block" ect -->
name="sales.test"
template="sales/order/test.phtml"/>      <!-- location of template -->
    
</
reference>
 
Magento Community Magento Community
Magento Community
Magento Community
 
TioSolid
Jr. Member
 
Total Posts:  28
Joined:  2008-11-07
 

Here is what I did. Overrided the history.phtml template creating a new one with a link:
http://img269.imageshack.us/img269/8799/historyvz.jpg

I want this link to point to a new template file I created. Here is what I have in my template folder:
http://img24.imageshack.us/img24/2051/templatevr.jpg

The link in the first image is pointing to the confirma.phtml template file, this way:
magento/index.php/sales/order/confirma/

But its still returning a 404 error. I read the previous post but I dont think I need to do that (since im linking the template file within another template)

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gyniolatry
Sr. Member
 
Total Posts:  132
Joined:  2009-11-26
Perth.au
 

How exactly are you linking to this new confirma.phtml file from the link in history.phtml ??

If you create a module <sales_order_confirma> in Sales.xml you can reference it with

$this->getLayout()->getBlock('confirma')

or else creat the block inline with

<?php echo $this->getLayout()->createBlock('Mage_Adminhtml_Block_Template''confirma')->setData('template'sales/order/confirma.phtml')->toHtml() ?>

Either way, I’m pretty sure you should be utilising a block.
But I could be totally mis-interpreting your question.

 
Magento Community Magento Community
Magento Community
Magento Community
 
TioSolid
Jr. Member
 
Total Posts:  28
Joined:  2008-11-07
 

Actually its just a test and I linked the template using a hardcoded <a> tag. Im planning to make it a module later, but I dont know how to build (organization, xml and stuff) it from scratch and add a custom template (this one reffered in this topic) to it. How can I do that?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top