我试图重写Pdf类来修改发票/货件/ Creditmemo pdf,但它似乎并没有反映出来。Magento 1.7覆盖PDF类
我创建了一个模块与所述Mymodule中的/ etc/config.xml的以下
<config>
<modules>
<Mymodule_Printtemplates>
<version>0.1.0</version>
</Mymodule_Printtemplates>
</modules>
<global>
<models>
<sales>
<rewrite>
<order_pdf_abstract>Mymodule_Printtemplates_Model_Order_Pdf_Abstract</order_pdf_abstract>
<order_pdf_invoice>Mymodule_Printtemplates_Model_Order_Pdf_Invoice</order_pdf_invoice>
<order_pdf_creditmemo>Mymodule_Printtemplates_Model_Order_Pdf_Creditmemo</order_pdf_Creditmemo>
<order_pdf_shipment>Mymodule_Printtemplates_Model_Order_Pdf_Shipment</order_pdf_shipment>
</rewrite>
</sales>
</models>
</global>
然后创建在Mymodule中/模型以下/ 作为Abstract.php,Invoice.php模型类,Shipment.php,Creditmemo.php
abstract class Mymodule_Printtemplates_Model_Order_Pdf_Abstract extends Mage_Sales_Model_Order_Pdf_Abstract
class Mymodule_Printtemplates_Model_Order_Pdf_Invoice extends Mymodule__Printtemplates_Model_Order_Pdf_Abstract { ... functions here ...}
class Mymodule_Printtemplates_Model_Order_Pdf_Shipment extends Mymodule__Printtemplates_Model_Order_Pdf_Abstract{ ... functions here ...}
class Mymodule_Printtemplates_Model_Order_Pdf_Creditmemo extends Mymodule__Printtemplates_Model_Order_Pdf_Abstract{ ... functions here ...}
模块使能 - 我已经通过检查其系统>配置>管理员>高级,但它似乎并没有反映更改
另一方面,如果我将Paste Mage/Sales/Model/Order/Pdf/*。php复制到本地并更改,则会反映更改。我知道这不是推荐的方法,但通过重写类的方法似乎不起作用。
通过类重写的第一种方法的任何帮助将不胜感激。
感谢, Loveleen
真正的问题是一个语法在等/ config.xml中[见大写字母C的结束标记]
Mymodule_Printtemplates_Model_Order_Pdf_Creditmemo
错误我使用以下方法来调试问题:将其放在index.php的底部,与Alans模块列表类似快速的代码复制/粘贴方法。记住所有Magento的XML都被合并到一个XML树中。
header(“Content-Type:text/xml”);模具(法师::应用程序() - > getConfig() - > getNode() - > asXML());
从答案摘自:How do I know whether my Config.xml file is working in Magento?
感谢Jmax!我会尝试你的建议。 –
如果回答您的问题,请记住标记为已回答。 –
你给了一个很好的清单。但真正的问题是,etc/config xml中的一个标签的结束标签有错误。 order_pdf_Creditmemo>有一个大写的C –