I try to make simply pdf invoice:
class KM_PdfInvoice_Model_Sales_Order_Pdf_Invoice extends Mage_Sales_Model_Order_Pdf_Invoice
Already have designed skelet layout for PDF. But now my problem is access ordes data like:
Ordered items, customer name, shiping, billing adress, etc.. When you press button submit:
or press button print:
getPdf() is going exected:
public function getPdf($invoices = array()){
foreach ($invoices as $invoice) {
if ($invoice->getStoreId()) {
Mage::app()->getLocale()->emulate($invoice->getStoreId());
Mage::app()->setCurrentStore($invoice->getStoreId());
}
$OrderId = Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_INVOICE_PUT_ORDER_ID);
$order = Mage::getModel('sales/order')->load($OrderId);
// echo $OrderId;
echo '<pre>';
print_r($order);
echo '</pre>';
But $OrderId don't want work, so i can't start access order details. I need give order id to getPdf(); What I'm doing wrong?
P.S My config.xml:
<?xml version="1.0" encoding="utf-8"?>
<config>
<modules>
<KM_PdfInvoice>
<version>1.0.0</version>
</KM_PdfInvoice>
</modules>
<global>
<models>
<sales>
<rewrite>
<order_pdf_invoice>KM_PdfInvoice_Model_Sales_Order_Pdf_Invoice</order_pdf_invoice>
</rewrite>
</sales>
</models>
</global>
</config>
To Access $order just need call: