Magento – How to add the Company Name to the Billing Address information in a new order email

billing-addressemail-templatesorders

How can I add the Company Name to the Billing Address information in a new order email? I would like to see the customer name, company name (which is a required field), and the rest of the address. But I'm not sure how to go about doing this?

Best Answer

You will need to add the attribute as a field to the tables sales_flat_quote_address and sales_flat_order_address. Then update you config.xml to copy the attributes when the address is converted from quote to order.

<sales_convert_quote_address>
    <your_attribute>
        <to_order_address>*</to_order_address>
        <to_customer_address>*</to_customer_address>
    </your_attribute>
<sales_convert_quote_address>

Now once this is done the item should be on the address object that you have in the email so simply calling $address->getYourAttribute() should work here.

Related Topic