For efficient marketing, you should use every possible tool at your disposal. Branding is an essential aspect of marketing and success in business. But if you want to stand out of the pack, you should do something unique. MAGENTO INVOICE TEMPLATE PDF PDFPDF invoices are usually designed in a simple default format. Thus, as a responsible e-com seller, it is your duty that you send out the required invoice to your customers. Every customer has a right to get an invoice. It can also be used as a receipt of payment made by the purchaser to the vendor. Of course it might be usefull to transfer the object creation into constructor and add some error handling.Why Do You Need Magento 2 Print Order PDF Extension For Your Store?Īn invoice is a document that describes the list of items purchased and the rates applicable. MAGENTO INVOICE TEMPLATE PDF CODEI would propose the following code - the creation of the invoice pdf is tested and safe, the rest is theoretical :-). If you get the message from your transport class and add the attachement there it should work. You can use the method createAttachement of Zend_Mail class. If i have invoice id as a variable, how can i attach my pdf invoice to this email? Public function attachInvoicePdf($invoiceId) has been approved and processed. $transport = $this->_transportBuilder->getTransport() $this->generateTemplate($emailTemplateVariables,$senderInfo,$receiverInfo) $this->temp_id = $this->getTemplateId($typeId) $typeId = self::XML_PATH_EMAIL_TEMPLATE_FIELD_REJECT $typeId = self::XML_PATH_EMAIL_TEMPLATE_FIELD_APPROVE $typeId = self::XML_PATH_EMAIL_TEMPLATE_FIELD_REQUEST Public function sendMail($emailTemplateVariables,$senderInfo,$receiverInfo,$type,$invoiceId = null) >setTemplateVars($emailTemplateVariables) Store of template for which you prepare it */ 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, /* here you can defile area and $template = $this->_transportBuilder->setTemplateIdentifier($this->temp_id) Public function generateTemplate($emailTemplateVariables,$senderInfo,$receiverInfo) * with template file and tempaltes variables values Return $this->getConfigValue($xmlPath, $this->getStore()->getStoreId()) \Magento\Store\Model\ScopeInterface::SCOPE_STORE, Protected function getConfigValue($path, $storeId) * Return store configuration value of your template field that which id you set for template $this->_transportBuilder = $transportBuilder $this->inlineTranslation = $inlineTranslation \Magento\Sales\Model\Order\Invoice $invoice \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\App\Helper\Context $context, * Magento\Framework\Mail\Template\TransportBuilder $transportBuilder * Magento\Framework\Translate\Inline\StateInterface $inlineTranslation * Magento\Store\Model\StoreManagerInterface $storeManager * Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * Magento\Framework\App\Helper\Context $context * \Magento\Framework\Mail\Template\TransportBuilder * \Magento\Framework\Translate\Inline\StateInterface * \Magento\Store\Model\StoreManagerInterface * \Magento\Framework\App\Config\ScopeConfigInterface * Here section and group refer to name of section and group where you create this field in configuration*/ $data = $description Įmail helper: namespace Test\Xxxx\Helper Ĭlass Email extends \Magento\Framework\App\Helper\AbstractHelperĬonst XML_PATH_EMAIL_TEMPLATE_FIELD_REQUEST = 'test/xxxx/request_mail' Ĭonst XML_PATH_EMAIL_TEMPLATE_FIELD_APPROVE = 'test/xxxx/approve_mail' Ĭonst XML_PATH_EMAIL_TEMPLATE_FIELD_REJECT = 'test/xxxx/reject_mail' I created a custom email and it's working fine like this: $data = round($amount)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |