Magento – Making the telephone field not required at checkout
In this post we will show you “how to convert required telephone field to telephone field not required at checkout in magento “, the Magento checkout prepare obliges clients to enter a telephone number for both charging and transporting addresses.
telephone field not required in Magento : On the off chance that your business doesn’t have this prerequisite, we might need to expel this approval from one or both address shapes.
The means underneath will evacuate the telephone prerequisite on the delivery address shape amid checkout. This has been tried with Magento.
Step 1 for telephone field not required
The initial step is to change the one page checkout layouts for the address form(s) in which we need to expel the telephone prerequisite. The transportation address shape is situated here:
/app/design/frontend/base/default/template/checkout/onepage/shipping.phtml
DO NOT adjust the base format document straightforwardly. Rather, duplicate this document into your site’s own topic and make your alterations there.
Base format records can be overwritten amid Magento updates, so on the off chance that we alter these documents specifically, we’ll presumably free the greater part of your work! Open your duplicate of shipping.phtml
and search for the line:
// Supplant it with (expel required class): // for telephone field not required
Next, search for the line:
// And supplant it with (remark out reverberate): // for telephone field not requiredThat is it. Spare your new format record.
Step 2 for telephone field not required
Next, we have to adjust the Magento Customer Address class to remark out some approval code. The code is situated in a unique class, so we can't supersede it.
Rather, we'll make a duplicate of the record in the
app/code/local
, which Magento will discover and use rather than the center document. Duplicate the document:/app/code/core/Mage/Customer/Model/Address/Abstract.php
To:
/app/code/local/Mage/Customer/Model/Address/Abstract.php
NOTE: You'll likely need to make the correct envelope under
app/code/local
Now, open/app/code/local/Mage/Customer/Model/Address/Abstract.php
and on line 375 locate the accompanying code:if (!Zend_Validate::is($this->getTelephone(), 'NotEmpty')) { $errors[] = Mage::helper('customer')- >__('Please enter the telephone number.'); } // Supplant the above code with (remark out the whole piece): // for telephone field not required /* // Disable telephone field for approval if (!Zend_Validate::is($this->getTelephone(), 'NotEmpty')) { $errors[] = Mage::helper('customer')- >__('Please enter the telephone number.'); } */Spare your adjusted
Abstract.php
record and continue to the following stride.Step 3 for telephone field not required
Some of Magento's field approval rationale is controlled by the arrangement of
EAV
property estimations, so we'll have to overhaul a couple pushes in the Magento database.we'll have to make two little alters for telephone field not required:
Open the table eav_attribute and scan for the column with
attribute_code = "telephone"
. Make note of the attribute_id of this line. Next, set the segment is_required to 0 (zero).Presently, open the table
customer_eav_attribute
and scan for the column with an indistinguishable attribute_id from we noted in the past stride. Set the segmentvalidation_rules
on this column toNULL
.Step 4 for telephone field not required
At last, we'll have to clear the greater part of Magento's reserves so that your progressions produce results. In the Magento administrator, got to
System - > Cache Management
, andclear all stores
.Make a point to tap the '
Flush Magento Cache
' and 'Flush Cache Storage
' catches too. This will constrain Magento to observe your database changes.conclusion for telephone field not required
That is it! When entering another transportation address at checkout, Magento ought to no longer require an incentive for telephone. In the event that we have any proposals for enhancing these means, please leave a remark underneath.