3

I had ALTER tables 'sales_flat_quote_address' and 'sales_flat_order_address' to add a new column in order to add a custom field in Billing and Shipping process. But after doing that even the default shipping method stops working and it is not still not working after drop of this column. Below is the code I had used in my sql file of my module.

    $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();
4

1 回答 1

0

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

于 2013-06-25T12:03:07.807 回答