I am trying to add a print order button on the main order detail page on the magento admin. The client's old magento had a print button for the order itself (paid or unpaid, not invoice). See what it used to look like:
I've enabled template hints in on the back end and the template file does not contain that button. I've been through several core files... The html looks like the following. How would I turn that into a php button that is applicable to the currently viewed order?
<button id="id_d808fbd2d533d4e7b8e4a3fcd6274251" title="Back" type="button" class="scalable back" onclick="setLocation('http://test.animalnecessity.com/index.php/admin/sales_order/index/order_id/15852/key/28a65aa166da1664c65971decf3e472c/')" style="">
Could I implement this? Magento - Add Button to Sales Order View Page (Observer/Event) and if so where would I put this code?
I have it set up with the typical module structure as described here: http://alanstorm.com/magento_config. My config.xml in the etc folder has the following
<config>
<modules>
<CaitlinHavener_printOrder>
<version>0.1.0</version>
</CaitlinHavener_printOrder>
</modules>
<global>
<events>
<core_block_abstract_to_html_before>
<observers>
<CaitlinHavener_printOrder>
<class>CaitlinHavener_printOrder_Model_Observer</class>
<method>orderPageButton</method>
<type>model</type>
</CaitlinHavener_printOrder>
</observers>
</core_block_abstract_to_html_before>
</events>
</global>
</config>
My CaitlinHavener_printOrder.xml the following
<config>
<modules>
<CaitlinHavener_printOrder>
<active>true</active>
<codePool>local</codePool>
</CaitlinHavener_printOrder>
</modules>
</config>
and Observer.php
<?php
// Order View Page button
class CaitlinHavener_printOrder_Model_Observer
{
public function orderPageButton( Varien_Event_Observer $observer )
{
if(get_class($block) =='Mage_Adminhtml_Block_Sales_Order_View'
&& $block->getRequest()->getControllerName() == 'sales_order')
{
$block->addButton('test_print', array(
'label' => 'Test',
'onclick' => 'setLocation(\'' . $block->getUrl('html/sales_order/print') . '\')',
'class' => 'go'
));
}
}
}
?>
This is still not working. Any ideas?