Magento将自定义列添加到Order

时间:2018-02-22 20:59:47

标签: mysql magento magento-1.9.1

我正在尝试为magento中的每个订单保存Google Cookie。

我想添加新列,让我们说“google_cookie”到我的桌子。我怎样才能做到这一点?

哪个表应该更新?是sales_flat_order吗?

1 个答案:

答案 0 :(得分:1)

<?php

$installer = $this;
$connection = $installer->getConnection();
$installer->startSetup();

$tableSales = $this->getTable('sales_flat_order');

if ($connection->tableColumnExists($tableSales, 'google_cookie') === false) {
    $connection->addColumn(
        $tableSales,
        'google_cookie',
        'varchar(255) Default Null'
    );
}

$installer->endSetup(); 

使用上面的脚本添加新列,并根据您的要求保存数据

相关问题