0

In my store when dealing with orders in the admin section via Admin > Sales > Orders > Edit Shipping Address the "State" field is missing for some reason.

I finally found the file in the backend located

app/design/adminhtml/default/default/template/sales/order/address/form.phtml

But when I try to add the field it only has this php code:

<?php echo $this->getForm()->toHtml() ?> in line 41.

Where can I edit the getForm()?

Is it a file someplace, or in the database, or in the configuration settings somewhere?


UPDATE - Still stuck been 4 hours :(

I see in the database the "adminhtml_customer_address" and changed values around - flushed cache and nothing changed....

Database screenshot

Admin screenshot mission "state/region" missing

3 Answers 3

1

The form uses the block Mage_Adminhtml_Block_Sales_Order_Address_Form.

This can be found by searching for where the template is used in the code base or by turning on the template hints via the admin config.

The block mentioned mainly extends the block Mage_Adminhtml_Block_Sales_Order_Create_Form_Address and in this block you can find the function _prepareForm which is actually used to add the elements to the form element.

I think the part that might be breaking for you is the addition of field elements with the line $this->_addAttributesToForm($attributes, $fieldset);.

What this should do is add all the attributes needed to the form.

Have a look in the table customer_form_attribute for the form code adminhtml_customer_address and see what attributes are set to be shown in this form. If state or region is not set then try adding that attribute here and see what happens.

8
  • Yea but the order itself has the "State" visible, but when click on "edit" shipping address or billing address.. the "state" select field is missing entirely from the editable options...?
    – MuhuPower
    Aug 31, 2015 at 15:19
  • is the order placed via admin or frontend because the forms are different. Aug 31, 2015 at 15:19
  • Front End, and I understand some countries can have the "state" turned off.. but this is all from the united states and there is a state labeled on the order
    – MuhuPower
    Aug 31, 2015 at 15:24
  • The two forms are different so they can easily have different options show, either by choice or mistake. Check out the database table mentioned and see what the difference is between the frontend and admin Aug 31, 2015 at 15:26
  • I took a screenshot of the "customer_form_attribute" in the database.. i see a lot of info not sure what to look at... oi57.tinypic.com/1602ypf.jpg
    – MuhuPower
    Aug 31, 2015 at 15:45
0

The template is actually a renderer for the block Mage_Adminhtml_Block_Sales_Order_Create_Form_Address that extends Mage_Adminhtml_Block_Sales_Order_Create_Form_Abstract.
This last one has a method called getForm that looks like this:

public function getForm()
{
    if (is_null($this->_form)) {
        $this->_form = new Varien_Data_Form();
        $this->_prepareForm();
    }

    return $this->_form;
}

This means that if the class has the _form member populated it returns is, if not, it creates an instance of Varien_Data_Form and returns it.
The form is manipulated in the _prepareForm method

-1

I found all the element display in the form in the eav_attribute table in the database. Hope it helps.

Your Answer

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

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