1
votes

How to make the "Telephone" field of magento "not required" only for mobile version?

I tried changing "is_required" column of "Telephone" row in "eav_attribute" table. But it changes telephone not required for both desktop and mobile version.

Commenting

if (!Zend_Validate::is($this->getTelephone(), 'NotEmpty')) {
$errors[] = $helper->__('Please enter telephone.');

in magento/app/code/core/Mage/Customer/Model/Address/Abstract.php also did the same!

Is there any other way to make this work for a particular theme?

1
You can't do it for particular theme. You can tell js validator that field is not required but attribute is marked as required in the database. So you will have troubles during checkout process with empty value in this field. - Yaroslav Rogoza
You could try removing the validation in the database and then do client-side in the desktop version by add class='.... required-entry'.. - Renon Stewart
Try not to edit database related settings if possible. Having said that it's hard in this case since validation happens at the database level too. - mkerstner

1 Answers

0
votes

I would add a system config field "telephone required" configurable on store view level and perform the telephone validation only for the normal version and not for mobile. This will obviously only work if you have created a different store for mobile.