用magento重写销售订单打印块

时间:2016-11-25 09:14:43

标签: php xml magento

我正在尝试重写销售订单打印块。检索商店增值税号码。但是增值税号的字段是空白的。当我在核心上创建我的函数时,这很好用。

这是我的config.xml 应用程序/代码/本地/公司/销售/块的/ etc / config.xml中

<config>
    <global>
        <blocks>
            <sales>
                <rewrite>
                    <order_print>Invent_Sales_Block_Order_Print</order_print>
                </rewrite>
            </sales>
        </blocks>
    </global>
</config>

这是我的print.php

应用程序/代码/本地/公司/销售/块/订购/ Print.php 类Invent_Sales_Block_Order_Print扩展Mage_Sales_Block_Order_Print

 public function getVatNumber()
    {
        $storeVAT = Mage::getStoreConfig("general/store_information/merchant_vat_number");

        return $storeVAT;
    }

这是我的print.phtml

应用程序/设计/前端/主题/包/模板/销售/订单/ print.phtml

<?php echo "VAT Number:".' '.$this->getVatNumber(); ?>

我们将不胜感激。感谢

1 个答案:

答案 0 :(得分:0)

我正在修理这个问题。我错放了etc目录。我放在Block里面,而不是让它在同一级别。

谢谢