私はMagento 1.7.0.2を使用しています。フロントエンドと同じ方法でバックエンドから請求書を印刷するにはどうすればよいですか? PDFではなくHTML形式にしたい。
質問する
2524 次
2 に答える
2
管理者の注文詳細ページから一度に 1 つの請求書を印刷するとします。
カスタム管理モジュールを作成する
以下のメソッドでコントローラーを追加します
public function printInvoiceAction()
{
$invoiceId = (int) $this->getRequest()->getParam('invoice_id');
if ($invoiceId) {
$invoice = Mage::getModel('sales/order_invoice')->load($invoiceId);
$order = $invoice->getOrder();
} else {
$order = Mage::registry('current_order');
}
if (isset($invoice)) {
Mage::register('current_invoice', $invoice);
}
$this->loadLayout('print');
$this->renderLayout();
}
app/code/core/Mage/Sales/controllers/GuestController.php で printInvoiceAction() を参照します。
次に、カスタム layout.xml<sales_guest_printinvoice>
で /app/design/frontend/base/default/layout/sales.xml をテンプレートとして使用します
次に、次の URL へのリンクを含むボタンを追加します (注文から請求書 ID を取得する必要があります) /customModule/controller/printInvoice/invoice_id/xxx
(テストしていないので、問題が発生した場合はお知らせください)
于 2012-11-24T15:38:51.187 に答える
0
印刷用のカスタム css ファイルを作成する必要がありますprint.css
。そして、「印刷ボタン」を追加する必要があります。window.print()
于 2012-11-22T14:37:15.427 に答える