-
Notifications
You must be signed in to change notification settings - Fork 62
FAQs
- What Exactly Can I Configure?
- Where Can I Upload a Logo Which Is Shown On the Documents?
- How Can I Add Notes to the PDFs?
- How Can I Add Notes to the PDFs Programmatically?
- How Can I Put Some Fancy Stuff Wherever I Want To Without Writing My Own Engine?
- I Do Not Like The Standard Engines - How Can I Write My Own Engine?
- How Can I Add A Footer Without Using GermanSetup/MageSetup?
- How Can I Change or Remove Elements from the Imprint?
- How to hide the customer IP
Here is a screenshot of the configuration options:
Additionally, it is possible to show or hide the customer IP address (configurable under System - Configuration - Sales - General).
Upload your logo in the backend:
System > Config > SALES > Sales > Invoice and Packing Slip Design > Logo for PDF Print-outs (200x50)
You can define custom notes for invoices, shipments and credit memos under System - Configuration - Sales PDF - Invoice/Shipment/Credit Memo - Note. You can also add notes programmatically:
In your module's config.xml
, you define an observer on the event firegento_pdf_invoice_insert_note
, firegento_pdf_shipment_insert_note
or firegento_pdf_creditmemo_insert_note
respectively. Example:
<firegento_pdf_invoice_insert_note>
<observers>
<namespace_module>
<class>namespace_module/observer</class>
<method>addMyFunkyNote</method>
</namespace_module>
</observers>
</firegento_pdf_invoice_insert_note>
Then you create your Module/Observer.php
file with the following code:
<?php
class Namespace_Module_Observer
{
/**
* Add my super funky note
*
* @param Varien_Event_Observer $observer observer object
*
* @return $this
*/
public function addMyFunkyNote(Varien_Event_Observer $observer)
{
$result = $observer->getResult();
$notes = $result->getNotes();
$notes[] = 'My super funky note';
$result->setNotes($notes);
return $this;
}
}
That's it to add your super funky note to one of the PDFs!
In your module's config.xml
, you define an observer on the event firegento_pdf_invoice_edit_page
, firegento_pdf_shipment_edit_page
or firegento_pdf_creditmemo_edit_page
respectively. Example:
<firegento_pdf_invoice_edit_page>
<observers>
<namespace_module>
<class>namespace_module/observer</class>
<method>addFancyStuff</method>
</namespace_module>
</observers>
</firegento_pdf_invoice_edit_page>
Then you create your Module/Observer.php
file with the following code:
<?php
class Namespace_Module_Observer
{
/**
* Add my super fancy stuff
*
* @param Varien_Event_Observer $observer observer object
*
* @return $this
*/
public function addFancyStuff(Varien_Event_Observer $observer)
{
$page = $observer->getPage();
$page->drawText('This is really super fancy!', 200, 200, 'UTF-8');
return $this;
}
}
Create a module and put this into your config.xml
:
<global>
<models>
<namespace_module>
<class>Namespace_Module_Model</class>
</namespace_module>
</models>
<pdf>
<firegento_invoice_engines>
<namespace_module_default>
<class>namespace_module/firegento_pdf_engine_invoice_default</class>
<label>Standard MyModule</label>
</namespace_module_default>
</firegento_invoice_engines>
<firegento_shipment_engines>
<namespace_module_default>
<class>namespace_module/firegento_pdf_engine_shipment_default</class>
<label>Standard MyModule</label>
</namespace_module_default>
</firegento_shipment_engines>
<firegento_creditmemo_engines>
<namespace_module_default>
<class>namespace_module/firegento_pdf_engine_creditmemo_default</class>
<label>Standard MyModule</label>
</namespace_module_default>
</firegento_creditmemo_engines>
</pdf>
</global>
Create the three Default
classes in their respective folders, e.g. create the file Namespace/Module/Model/Firegento/Pdf/Engine/Invoice/Default.php
. Instead of starting from scratch, you probably want to extend the FireGento engine and overwrite whatever function you need. For instance, if you want to strip out the logo, sender address bar and footer because the client uses some custom paper where this information is already printed, you may use this class:
<?php
class Namespace_Module_Model_Firegento_Pdf_Engine_Invoice_Default
extends FireGento_Pdf_Model_Engine_Invoice_Default
{
/**
* Insert sender address bar.
*
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
* @return void
*/
protected function _insertSenderAddessBar(&$page)
{
// Do not print sender address bar
}
/**
* Insert logo
*
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
* @param mixed $store
* @return void
*/
protected function insertLogo(&$page, $store = null)
{
// Do not print logo
}
/**
* Insert footer
*
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
* @return void
*/
protected function _insertFooter(&$page)
{
// Do not print footer
}
}
One possibility is to put the following XML into your own module:
<config>
<default>
<general>
<imprint>
<shop_name>...</shop_name>
<company_first>...</company_first>
<company_second>...</company_second>
<street>...</street>
<zip>...</zip>
<city>Musterstadt</city>
<country>Musterland</country>
<telephone>...</telephone>
<telephone_additional>...</telephone_additional>
<fax>...</fax>
<email>...</email>
<web>...</web>
<tax_number>...</tax_number>
<vat_id>...</vat_id>
<court>...</court>
<financial_office>...</financial_office>
<ceo>...</ceo>
<owner>...</owner>
<content_responsable_name>...</content_responsable_name>
<content_responsable_address>...</content_responsable_address>
<content_responsable_press_law>...</content_responsable_press_law>
<register_number>...</register_number>
<business_rules>...</business_rules>
<authority>...</authority>
<shareholdings>...</shareholdings>
<editorial_concept>...</editorial_concept>
<bank_account_owner>...</bank_account_owner>
<bank_account>...</bank_account>
<bank_code_number>...</bank_code_number>
<bank_name>...</bank_name>
<swift>...</swift>
<iban>...</iban>
<clearing>...</clearing>
</imprint>
</general>
</default>
</config>
You could also write these values into the database table core_config_data
directly, although I would not recommend that.
In your module's config.xml
, you can define an observer on the event firegento_pdf_imprint_load_after
. Example:
<firegento_pdf_imprint_load_after>
<observers>
<namespace_module>
<class>namespace_module/observer</class>
<method>firegentoPdfImprintLoadAfter</method>
</namespace_module>
</observers>
</firegento_pdf_imprint_load_after>
Then you create your Module/Observer.php
file with the following code:
<?php
class Namespace_Module_Observer
{
/**
* Change the imprint somehow
*
* @param Varien_Event_Observer $observer observer object
*
* @return $this
*/
public function firegentoPdfImprintLoadAfter(Varien_Event_Observer $observer)
{
$transportObject = $observer->getEvent()->getTransportObject();
$imprint = $transportObject->getImprint();
// do some fancy stuff with the imprint array
unset($imprint['tax_number']);
$transportObject->setImprint($imprint);
return $this;
}
}
You can find information and code about this issue in pull request #350