1

We only have quest sales in our shop. Nevertheless the customer data (name, gender, email) is set in the order - not only in addresses. This data also shows in right top corner (account information) when looking on an order in backend.

When editing an order you get an form left in account information which on our shop only includes email and gender. After saving the edited order the new order has looses the customer name in it's account information.

I am searching for the fieldlist which creates email and gender and only found Mage_Adminhtml_Block_Sales_Order_Create_Form_Account::_prepareForm().

Does anyone have to solve that issue too? How I could include other fields like firstname, lastname and so on. How to prefill I know - I override the method getFormValues to preselect the gender dropdown.

2
  • This isn't the case when I edit an order, customer name just stays the same in the edited order.
    – Lucasmus
    Jul 1, 2013 at 15:40
  • @philwinkle: Is on quest or logged-in sales with real customers?
    – Krysis
    Jul 10, 2013 at 5:21

1 Answer 1

2

The reason that these attributes do not show on the edit order form is because they do not have an entry in the table customer_form_attribute for the form code adminhtml_checkout

When building this form all attributes with an entry in this table for that form will be considered, they will then be ignored if the are user defined and also if they are not required.

Code for building this form can be found at Mage_Adminhtml_Block_Sales_Order_Create_Form_Account::_prepareForm

Here you can see it sets the type of form.

/* @var $customerForm Mage_Customer_Model_Form */
$customerForm   = Mage::getModel('customer/form');
$customerForm->setFormCode('adminhtml_checkout')
    ->setStore($this->getStore())
    ->setEntity($customerModel);

And then proceeds to get all the required system attributes:

foreach ($customerForm->getSystemAttributes() as $attribute) {
    /* @var $attribute Mage_Customer_Model_Attribute */
    if ($attribute->getIsRequired()) {
        $attributes[$attribute->getAttributeCode()] = $attribute;
    }
}

When loading the attributes in Mage_Eav_Model_Form::getAttributes() it takes into account the form code.

$collection->setStore($this->getStore())
    ->setEntityType($this->getEntityType())
    ->addFormCodeFilter($this->getFormCode())
    ->setSortOrder();

Your Answer

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

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