Custom field not showing on order details (admin)
-
16-10-2019 - |
Question
I created three new fields in the register address, I need to show them in the order details. I tried adding them going:
System > Customers > Settings > Templates Address
And added the fields with the same name that is in the database. Here's an example of how I tried:
{{number_address}}
{{depend number_address}}{{var number_address}}{{/depend}}
{{if number_address}}{{var number_address}}, {{/if}}
Solution
I've read this tutorial: http://www.magentocommerce.com/wiki/5_-_modules_and_development/how_to_add_custom_field_in_billing_and_shipping_address_in_frontend_and_backend
Check the attribute creation:
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();
}
See the $usedInForms
array ? Try to insert the handles of order details pages there.
It may not suffice, but I think it's necessary.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange