1

Does somebody know why field customer_address_id is null on sales_flat_order_address table? As regards to order for customer who has an address.

In class: Mage_Sales_Model_Order_Address I found this:

protected function _beforeSave()

{
    parent::_beforeSave();

    if (!$this->getParentId() && $this->getOrder()) {
        $this->setParentId($this->getOrder()->getId());
    }

    // Init customer address id if customer address is assigned
    if ($this->getCustomerAddress()) {
        $this->setCustomerAddressId($this->getCustomerAddress()->getId());
    }

    return $this;
}
3

The field customer_address_id is a reference to the customer_address table.
When placing an order as guest you have to fill in the address manually.
When you do that there is no customer address object to reference in the checkout so customer_address_id is null.
This also happens when you checkout as a customer, but fill in a new address and you DO NOT choose to save the address in your address book.

The field has a value only when you checkout as a logged in customer and select one of the addresses in your address book, or you add a new address and choose to save it in your address book.

  • Thank you for a quick answer. Cause of problem was a custom modification of opc. – Krzysztof Jul 9 '14 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.