2

After we got an order, in admin panel, we can get an invoice PDF and the invoice PDF consists of invoice number that will come automatically. but we want to give a manual invoice number in invoice PDF. means admin has to enter the invoice number and that number should display in invoice PDF.

Please help me to find a solution

1

1 Answer 1

2

First of all, it will be broad to answer all of it. But I will give you head start.

You will need to override few blocks, you can do this by just copy those files in local folder or create an extension (recommended). Learn magento extension development from here.

Learn how to override blocks and other files in magento from here.

First you will need to provide a text field in invoice view page so that admin can enter manually, which is obviously going to be recorded into database.

In your sql/your_setup/install-your_version.php, create column in sales_flat_invoice

<?php

$installer = $this;

$installer->startSetup();

$installer->addColumn($this->getTable('sales/invoice'),
    'your_column_name',
    array(
        'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
        'nullable' => true,
        'default' => null,
        'comment' => 'Custom Invoice No'
    )

$installer->endSetup();

This will insert a column called your_column_name in to sales_flat_invoice table, where you will store your custom invoice no.

You will now need to include an input field in your overridden invoice view block (I would override design/adminhtml/default/default/template/sales/order/invoice/create/form.phtml file)

<input type="text" name="invoice[custom_number]" id = "custom_invoice_no" value="<?php echo $invoice->getYourColumnName();?>/>

And then, will have a button to call your extension's controller to insert invoice number in that table. Learn here.

Finally, to include recorded custom invoice number, override invoice creator blocks. Learn from here.

It's not complete answer, but should help you to start with.

2
  • thanks a lot @Adarsh, do you have any idea so that how many hours it will take to implement? Jun 19, 2015 at 11:06
  • Cannot tell @BabyinMagento2. It will entirely depend upon your understanding of magento and it's functionality. Good Luck Jun 19, 2015 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.