【问题标题】:Magento 1.7.2 - Add custom field at Admin, Sales, OrderMagento 1.7.2 - 在 Admin、Sales、Order 中添加自定义字段
【发布时间】:2013-02-07 17:34:59
【问题描述】:

我正在关注本教程:http://www.excellencemagentoblog.com/magento-create-custom-payment-method。在第 2 步结束时,我应该在 Admin=>Sales=>Order 上看到我的字段,但我什么也看不到。

在 sales_flat_quote_payment 中,我可以看到 telefono_no 字段,在 sales_flat_order_payment 中也可以看到。当我买东西时,Magento 将手机数据telefono_no 保存在数据库中。反正我的mysql4-install-0.1.0.php是:

$install = $this;
$install->startSetup();

$install->run("
    ALTER TABLE `".$install->getTable('sales/quote_payment')."` ADD `telefono_no` VARCHAR(7) NOT NULL DEFAULT '0000000';
    ALTER TABLE `".$install->getTable('sales/order_payment')."` ADD `telefono_no` VARCHAR(7) NOT NULL DEFAULT '0000000';
");

$install->endSetup();

在我的 config.xml 中有:

<?xml version="1.0"?>
<config>
    <modules>
        <Xs_Pago>
            <version>0.1.0</version>
        </Xs_Pago>
    </modules>
    <global>
        <fieldsets>
            <sales_convert_quote_payment>
                <telefono_no>
                    <to_order_payment>*</to_order_payment>
                </telefono_no>
            </sales_convert_quote_payment>
        </fieldsets>
    </global>
</config>

【问题讨论】:

    标签: magento magento-1.7 ecommerce-sales


    【解决方案1】:

    about 代码应该只将字段添加到数据库中,并在下订单时将值从 quote_payment 复制到 order_payment。

    代码不会显示任何信息,在您引用的示例中显示信息的原因是因为Mage_Payment_Block_Info

    <?php
    class Excellence_Pay_Block_Info_Pay extends Mage_Payment_Block_Info
    {
        protected function _prepareSpecificInformation($transport = null)
        {
            if (null !== $this->_paymentSpecificInformation) {
                return $this->_paymentSpecificInformation;
            }
            $info = $this->getInfo();
            $transport = new Varien_Object();
            $transport = parent::_prepareSpecificInformation($transport);
            $transport->addData(array(
                Mage::helper('payment')->__('Check No#') => $info->getCheckNo(),
                Mage::helper('payment')->__('Check Date') => $info->getCheckDate()
            ));
            return $transport;
        }
    }
    

    看看@Magento custom "order" attribute / admin input and display

    【讨论】:

    • 如果我理解你的答案,你告诉我我所遵循的示例是不完整的,并且在“销售 - 订单”表中添加列的唯一方法是创建一个新模板?您发布的代码,它是做什么用的?我必须把它放在哪里?在我的目录“阻止”中?我关注了你的链接,但没有澄清任何事情。
    猜你喜欢
    • 2018-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-29
    • 1970-01-01
    • 2020-01-10
    • 2013-12-30
    相关资源
    最近更新 更多