[ACCEPTED]-Magento - make the field "company" required-magento

Accepted answer
Score: 22

You should as well add it in your attribute 5 on the server side.

If you're using Magento 4 Entreprise Edition, you can simply edit the company attribute 3 through back end, and set it to "required".

If you're working 2 with a Community Edition, you'll have to manually change this value with SQL. It's in eav_attribute table, the 1 attribute_code is company and you just need to set is_required to 1.

Score: 11

Additionally to haltabush answer (which 2 is the correct one) here is the SQL for 1 lazy developers:

UPDATE eav_attribute SET is_required = 1 WHERE attribute_code = 'company';
Score: 5

For Customer Address Book Section (registered customers ) :


For checkout billing section :


For checkout shipping section :


For registration section :



Find 2 looks like following line for required fields 1 :

class="input-text validate-email required-entry"
Score: 2

This is how to do it using installer. The 6 proper way to do it in magento. This works 5 for enterprise edition and comunity edition. But 4 you will have to have the module configured 3 to understand a file under sql folder

    $installer = new Mage_Customer_Model_Entity_Setup('core_setup');;


    $installer->run("UPDATE eav_attribute SET is_required = 1 WHERE attribute_code = 'company';");


This 2 is how is my module xml file looks like.

<?xml version="1.0" encoding="UTF-8"?>

This 1 is what I did to edit.phtml to make it dynamic

    <li class="wide">
            $validation_class = $this->helper('customer/address')->getAttributeValidationClass('company') ;
            $required = strstr($validation_class, 'required-entry');
        <label for="company" class=<?php echo $required?"required":""?>><?php echo $this->__('Company') ?> <?php echo $required?"<em>*</em>":""?> </label>
        <div class="input-box">
            <input type="text" name="company" id="company" title="<?php echo $this->__('Company') ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" class="input-text <?php echo $validation_class ?>" />

More Related questions