2011-12-21 86 views
1

我试图在magento订单页面(printscreen:sbx.mujjo.com/media/images/action.png)上创建一个打印动作。现在'打印标签'是一个html页面的网址。我试图把它打开一个PDF,而不是(就像“打印发票”但我不能找到合适的代码Magento销售>订单>添加打印动作

的代码创建的网址:。

class AquiveMedia_Orderlabel_Model_Observer { 

public function add_action($observer) { 
    $block = $observer->getEvent()->getBlock(); 
    if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction) { 
     if ($block->getParentBlock() instanceof Mage_Adminhtml_Block_Sales_Order_Grid) { 
     $block->addItem('print_labels', array(
      'label' => Mage::helper('sales')->__('Print Labels'), 
      'url' => $block->getUrl('orderlabel/adminhtml_orderlabel/massprint') 
       ) 
     ); 
     } 
    } 
    } 
} 

回答

0

由于链接已经存在,只是使用的URL为自己在这里是如何覆盖。

在你的模块的​​3210文件,

<config> 
    ... 
    <admin> 
     <routers> 
      <adminhtml> 
       <args> 
        <modules> 
         <aquivemedia_orderlabel before="Mage_Adminhtml"> 
          AquiveMedia_Orderlabel_Adminhtml 
         </aquivemedia_orderlabel> 
        </modules> 
       </args> 
      </adminhtml> 
     </routers> 
    </admin> 
</config> 

现在你可以做一个控制器,它会被所谓的F IRST。
app/code/local/AquiveMedia/Orderlabel/controllers/Adminhtml/Sales/Order/InvoiceController.php

class AquiveMedia_Orderlabel_Adminhtml_Sales_Order_InvoiceController 
    extends Mage_Adminhtml_Controller_Action 
{ 
    public function printAction() 
    { 
     // this is called instead of the path "index.php/admin/sales_order_invoice/print" 
    } 
} 
+0

嗨!感谢您的回答! 我想我没有真正解释得够好。我想打开此页面(orderlabel/adminhtml_orderlabel/massprint)而不是html。 所以我很遗憾,我应该创建一个invoicecontroller,但像labelcontroller。你对此有何想法?我没有很多这样的经验,所以如果你能帮助我愿意为你付出一些东西! 此致! – 2011-12-25 11:01:16

相关问题