Note that there are some explanatory texts on larger screens.

plurals
  1. POOrder view page print pdf button magento
    text
    copied!<p>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:</p> <p><img src="https://i.stack.imgur.com/ZjiJL.jpg" alt="orderbar"></p> <p>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?</p> <pre><code>&lt;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=""&gt; </code></pre> <p>Could I implement this? <a href="https://stackoverflow.com/questions/10691895/magento-add-button-to-sales-order-view-page-observer-event">Magento - Add Button to Sales Order View Page (Observer/Event)</a> and if so where would I put this code? <br><br> I have it set up with the typical module structure as described here: <a href="http://alanstorm.com/magento_config" rel="nofollow noreferrer">http://alanstorm.com/magento_config</a>. My config.xml in the etc folder has the following</p> <pre><code>&lt;config&gt; &lt;modules&gt; &lt;CaitlinHavener_printOrder&gt; &lt;version&gt;0.1.0&lt;/version&gt; &lt;/CaitlinHavener_printOrder&gt; &lt;/modules&gt; &lt;global&gt; &lt;events&gt; &lt;core_block_abstract_to_html_before&gt; &lt;observers&gt; &lt;CaitlinHavener_printOrder&gt; &lt;class&gt;CaitlinHavener_printOrder_Model_Observer&lt;/class&gt; &lt;method&gt;orderPageButton&lt;/method&gt; &lt;type&gt;model&lt;/type&gt; &lt;/CaitlinHavener_printOrder&gt; &lt;/observers&gt; &lt;/core_block_abstract_to_html_before&gt; &lt;/events&gt; &lt;/global&gt; &lt;/config&gt; </code></pre> <p>My CaitlinHavener_printOrder.xml the following</p> <pre><code>&lt;config&gt; &lt;modules&gt; &lt;CaitlinHavener_printOrder&gt; &lt;active&gt;true&lt;/active&gt; &lt;codePool&gt;local&lt;/codePool&gt; &lt;/CaitlinHavener_printOrder&gt; &lt;/modules&gt; &lt;/config&gt; </code></pre> <p>and Observer.php</p> <pre><code>&lt;?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' &amp;&amp; $block-&gt;getRequest()-&gt;getControllerName() == 'sales_order') { $block-&gt;addButton('test_print', array( 'label' =&gt; 'Test', 'onclick' =&gt; 'setLocation(\'' . $block-&gt;getUrl('html/sales_order/print') . '\')', 'class' =&gt; 'go' )); } } } ?&gt; </code></pre> <p>This is still not working. Any ideas?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload