2

I added the Dhl Account module in my magento 1.9.2.4 installation to get the possibility to ship to a dhl packing station. The module appends a field called dhlaccount to the shipping address of an order.

Now I have the problem that this field does not exist in the salesOrderInfo API request. Is there a way to append a custom shipping address field to the API result?

Thanks in advance!

Install script

/* @var $installer Mage_Customer_Model_Entity_Setup */
$installer = $this;
$installer->startSetup();

/* @var $addressHelper Mage_Customer_Helper_Address */
$addressHelper = Mage::helper('customer/address');

// update customer address user defined attributes data
$attributes = array(
    'dhlaccount' => array(
        'backend_type'    => 'varchar',
        'backend_model'   => '',
        'backend_table'   => '',
        'frontend_model'  => '',
        'frontend_input'  => 'text',
        'frontend_label'  => 'DHL Account',
        'frontend_class'  => '',
        'source_model'    => '',
        'default_value'   => '',
        'is_user_defined' => 1,
        'is_system'       => 0,
        'is_visible'      => 1,
        'sort_order'      => 140,
        'is_required'     => 0,
        'multiline_count' => 0,
        'validate_rules'  => array(
            'max_text_length' => 10,
            'min_text_length' => 6
        ),
    ),

);

/* @var $eavConfig Mage_Eav_Model_Config */
$eavConfig = Mage::getSingleton('eav/config');
foreach ($attributes as $attributeCode => $data) {
    $attribute = $eavConfig->getAttribute('customer_address', $attributeCode);
    $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 {$this->getTable('sales_flat_quote_address')} ADD COLUMN `dhlaccount` VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL AFTER `fax`;
    ALTER TABLE {$this->getTable('sales_flat_order_address')} ADD COLUMN `dhlaccount` VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL AFTER `fax`;
");
$installer->endSetup();
6
  • can you share the code?
    – R T
    Dec 7, 2016 at 17:09
  • if you mean the code which appends the attribute, I added it. Dec 7, 2016 at 17:22
  • did you also updated the config.xml of your module for this new attribute under sales_convert_quote and sales_convert_quote_address ?
    – R T
    Dec 7, 2016 at 18:05
  • It isn't my module. It's a module from DHL which can be found here: magentocommerce.com/magento-connect/…. But yes, the attribute is appended coorectly in the config.xml Dec 7, 2016 at 18:19
  • Where can I locate this method or reference salesOrderInfo in the module?
    – R T
    Dec 7, 2016 at 18:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.