MTERnto Shipping方法在ALTER表'sales_flat_quote_address'和'sales_flat_order_address'之后停止工作

时间:2012-12-18 11:24:07

标签: magento

我有ALTER表'sales_flat_quote_address'和'sales_flat_order_address'来添加新列,以便在结算和发货流程中添加自定义字段。但是在这样做之后,即使默认的运输方法也停止工作,并且在删除此列后它仍然无法正常工作。下面是我在我的模块的sql文件中使用的代码。

    $installer = $this;

    $installer->startSetup();

     /* @var $addressHelper Mage_Customer_Helper_Address */
    $addressHelper = Mage::helper('customer/address');
    $store         = Mage::app()->getStore(Mage_Core_Model_App::ADMIN_STORE_ID);

    /* @var $eavConfig Mage_Eav_Model_Config */
    $eavConfig = Mage::getSingleton('eav/config');

    // update customer address user defined attributes data
    $attributes = array(
        'suburb'           => array(   
            'label'    => 'Suburb',
            'type'     => 'varchar',
            'input'    => 'text',
            'is_user_defined'   => 1,
            'is_system'         => 0,
            'is_visible'        => 1,
            'sort_order'        => 140,
            'is_required'       => 1,
            'multiline_count'   => 0,
            'validate_rules'    => array(
                'max_text_length'   => 255,
                'min_text_length'   => 1
            ),
        ),
    );

    foreach ($attributes as $attributeCode => $data) {
        $attribute = $eavConfig->getAttribute('customer_address', $attributeCode);
        $attribute->setWebsite($store->getWebsite());
        $attribute->addData($data);
            $usedInForms = array(
                'adminhtml_customer_address',
                'customer_address_edit',
                'customer_register_address'
            );
            $attribute->setData('used_in_forms', $usedInForms);
        $attribute->save();
    }

    $installer->run("
        ALTER TABLE {$installer->getTable('sales_flat_quote_address')} ADD COLUMN suburb VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL AFTER fax;
        ALTER TABLE {$installer->getTable('sales_flat_order_address')} ADD COLUMN suburb VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL AFTER fax;


        ");     

    $installer->endSetup();

1 个答案:

答案 0 :(得分:0)

通过摆弄运输选项,我注意到它可能会停止结账(不加载运输方式),但它会产生致命的错误。在您的后端启用日志记录,然后导航到您的结帐并尝试选择所有内容到非工作的送货方式。完成后,检查您的异常日志和var / reports文件夹。这些可能会为您提供一些信息,说明您的具体情况出了什么问题。