Add Custom Info on Invoice Pdf for Magento
来源:互联网 发布:主流社交软件 编辑:程序博客网 时间:2024/06/06 07:24
如何在打印出来的Pdf里面增加额外信息,其实只要知道如何操纵数据,最终打印的handle还是Zend来执行,Magento内置了Zend_Pdf类,用他来打印PDF文件,下面是一个示例,比较简单易懂,在此抛砖引玉。以下代码加在Mage_Sales_Model_Order_Pdf_Invoice这个类中。
/* Gfit Msg Notice */$freegiftboxHandle = "Free gift box set";$freestandardHandle = "Free gift box set and Free Standard Shipping";$freeDHLHandle = "Free gift box set & DHL shipping & Free Gift";//$payPrice = $this->helper('checkout')->formatPrice(Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal());;$_totalData = $order->getData();$_grand = $_totalData['grand_total'];$payPrice = $_grand;if($payPrice>65&&$payPrice<160){$additionalGift = $freegiftboxHandle;}if($payPrice>160&&$payPrice<200){$additionalGift = $freestandardHandle;}if($payPrice>=200){$additionalGift = $freeDHLHandle;}$page->drawText(Mage::helper('sales')->__('Additonal Gift: ') . $additionalGift, 250, 780, 'UTF-8');/* end of Gift Msg Notice */附上效果,带额外信息还有带图打印,大家可以琢磨下,迟些做个高级打印模块出来供大家参考:
That's all ! Enjoy it~
- Add Custom Info on Invoice Pdf for Magento
- 让Magento生成的PDF打印图片(Magento invoice shipment pdf add product images)
- Add custom Field in Order Total for Magento
- add custom font on iOS
- magento add custom column to order grid
- [Magento] Add custom attribute by SQL
- How to add some custom registration fields while creating your magento account?(compatible also for 1.4.2.0 version)
- Magento How To Display Product Custom Option On list.phtml
- Collect On-site info for the diagnosing
- Add Custom Tab in Detail screen for MIGO Transaction
- How to add custom fields to Customer Registration and Account page in magento
- Magento - how to add custom variables to new order E-mail?
- How to Programmatically Add/Delete Custom Options in Magento? - See more at: http://apptha.com/blog/
- How to create Magento invoice from order
- Magento - get custom attributes
- create magento custom api
- magento custom api configuration
- Writing Magento Custom API
- 串口--=中断机制分析
- centos 开启snmp服务
- DLL导出变量/对象/类
- 两张网卡分别连接不同的网络 保证各自的应用正常使用
- XSLT轻松入门第四章:XPath的语法
- Add Custom Info on Invoice Pdf for Magento
- 建立directshow的filter工程的过程
- 聚焦虚拟化安全之“无代理防毒”(视频)
- Content Provider使用
- css背景居中,固定,不重复的效果
- 劳动法
- DirectFB-1.4.11 Ubuntu 10.04 install
- shell得到半年后的日期
- C语言中的__FILE__、__LINE__和#line