質問

データベースを直接更新して、lastName = 0にis_requiredを作成しました。

CoreのLastNameのJS Validatorを削除しました。

Widget/name.phtmlのFrontendで必要なフィールドを削除しました。

ただし、「姓は必要なフィールド」メッセージは、まだ3つの場所でポップアップします。

During onepage checkout
When creating an order in admin for billing/shipping address
When inputing billing/shipping address for a customer in admin

誰かが私を助けてくれませんか?私たちは卸売を行っており、発注書とタラのみを使用しています。したがって、顧客は通常、最初の名前フィールドにアウトレット名のみを入れます。姓は彼らにとってオプションです。

役に立ちましたか?

解決

フィールド姓を作成するには、管理者の顧客編集に必要なものなしSQLアップグレードスクリプトを作成します

/* @var $this Mage_Customer_Model_Resource_Setup */
$this->updateAttribute('customer_address','lastname','is_required','false');

他のヒント

私は自分でその問題に対する答えを探していました、そして、あなたがこれらすべての手順を実行する必要があるので、私はあなたの両方の答えを統合しました。

1.最初に、SQLクエリを実行するのは良いことです(つまり、phpmyAdminで):

UPDATE eav_attribute SET is_required = 0 WHERE attribute_code = 'lastname'

2. JS検証のクラスを取り除きます

class = "必須"およびclass = "reburce-entry"は、保存するフォームがある「lastname」フィールドに関連する任意の場所(すなわち顧客/address/edit.phtml、persistent/checkout/billing.phtml)があります)

3.次のコアファイルをコピーします。

/app/code/core/Mage/customer/Model/Address/Abstract.php
/app/code/core/Mage/customer/Model/Customer.php
/app/code/core/Mage/customer/etc/config.xml

の中へ:

/app/code/local/Mage/customer/Model/Address/Abstract.php
/app/code/local/Mage/customer/Model/Customer.php
/app/code/local/Mage/customer/etc/config.xml

lastNameのZend検証に関連するすべてをコメントしてください。

/app/code/local/mage/customer/model/address/abstract.php:

   /* if (!Zend_Validate::is($this->getLastname(), 'NotEmpty')) {
         $this->addError(Mage::helper('customer')->__('Please enter the last name.'));
     }
*/

/app/code/local/mage/customer/model/customer.php

/*        if (!Zend_Validate::is( trim($this->getLastname()) , 'NotEmpty')) {
        $errors[] = Mage::helper('customer')->__('The last name cannot be empty.');
    }
*/

/app/code/local/mage/customer/etc/config.xml

あなたは検索する必要があります:

 <lastname>
                <billing>1</billing>
                <shipping>1</shipping>
                **<required>0</required>** // change from 1 to 0
                <mapped>1</mapped>
 </lastname>

1.テンプレートからJS検証のクラスを削除します。

customer/widget/name.phtml

削除する class="required" に関連するラベルから lastname 80行目のフィールド

削除する <?php echo $this->helper('customer/address') ->getAttributeValidationClass('lastname') ?> に関連する入力から lastname 82行目

2.次のコアファイルをコピーします。

/app/code/core/mage/customer/model/address/abstract.php/code/core/mage/customer/model/customer.php

の中へ:

/app/code/local/mage/customer/model/address/abstract.php/code/local/mage/customer/model/customer.php

lastNameのZend検証に関連するすべてをコメントしてください。

/app/code/local/mage/customer/model/address/abstract.php:

    /*
    if (!Zend_Validate::is($this->getLastname(), 'NotEmpty')) {
        $this->addError(Mage::helper('customer')->__('Please enter the last name.'));
    }
*/

/app/code/local/mage/customer/model/customer.php

PHPコード

   /*
    if (!Zend_Validate::is( trim($this->getLastname()) , 'NotEmpty')) {
        $errors[] = Mage::helper('customer')->__('The last name cannot be empty.');
    }
*/

3.顧客のconfig.xmlファイルを更新します

/app/code/core/mage/customer/etc/config.xml

ファイルにコピーします

/app/code/local/mage/customer/etc/config.xml

にとって last_name フィールド、必要な値「1」から「0」を設定します

4.最後に、データベースの行クエリを使用して更新します

UPDATE eav_attribute SET is_required = 0 WHERE attribute_code = 'lastname'

私にとって、私がこれを解決するためにしたことはこれだけでした:

update eav_attribute set is_required=0 where attribute_code like 'firstname'; update eav_attribute set is_required=0 where attribute_code like 'lastname';

ライセンス: CC-BY-SA帰属
所属していません magento.stackexchange
scroll top