Magento 1.4.2 - No registration fields required

I tried a very often used method so that the telephone field is not required during registration, but it does not seem to work with Magento 1.4.2

I made a copy

magento / app / code / core / Mage / Customer / Model / Address / Abstract.php

to

Magento / application / code / local / Mage / Client / Model / Address / Abstract.php

and removed the following code from the verification function in this file

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

}

I also deleted

class="input-text required-entry"

from register.phtml file, but I can not pass the check. I keep getting an error

"Phone" is a required value. The length of the "Phone" must be equal to or greater than 1 character.

thank

+3
source share
3 answers

. . is_required eav_attribute, attribute_code = 'telephone'.

, , script.

$telephone = Mage::getModel('eav/entity_attribute')
           ->loadByCode('customer_address', 'telephone')
           ->setIsRequired(false)
           ->save();

* checkout\onepage\billing.phtml

( ~ 120)

<label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>

<label for="billing:telephone"><?php echo $this->__('Telephone') ?></label>

.

+8

( 1.7.0.2).

  • : eav_attribute. Phpmyadmin - .

  • 3 :

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

    :

    • App/code/core/Mage/Customer/Model/Address/Abstract.php
    • includes/src/Mage_Customer_Model_Address_Abstract.php
    • includes/src/_checkout.php
  • * register.phtml billing.phtml app/design/frontend/base/default/template/persistent app/design/frontend/base/default/template/customer.

, Magento !

.

+6

I know all the proposed solutions for copying and editing the main files, but it will be suicide with the update.

At the moment (Magento 1.9 and later), the only way that does not require modification of the main Magento files is to use a dummy value for the telephone field.

A simple layout solution is to add to the bottom of the address / edit.phtml file:

jQuery(function($){
    $('#form-validate').submit(function(){
        var telephone = $('#telephone');
        if( !telephone.val().length )
            telephone.val("<?= $this->__('Not supplied') ?>");
    });
});
0
source

Source: https://habr.com/ru/post/1791520/


All Articles