I have config set to display 2 lines for address during checkout (Configuration → Customer → Customer Configuration → Name and Address Options):
Number of lines in a street address
: 2
How can I make the second line a required field? Only the first field seems to be required. I've looked in the eav_attribute
table & can't seem to find it listed there.
Best Answer
If you plan to make the second field mandatory for the checkout, you should make it mandatory in the customer add/edit address form for consistency.
For the client side validation you need to edit each template that holds an address for and add
required-entry
class on the second row. Here are the templates I found for this:As for server side validation you need to copy the file
app/code/core/Mage/Customer/Model/Address.php
to the local folder/app/code/local/Mage/Customer/Model/Address.php
. You cannot extend this class because the class is never instantiated.And you need to add something in the
validate
method.After this section:
Add the validation for the second row