Magento 1.9 Как добавить настраиваемое поле в форму регистрации заказа - PullRequest
0 голосов
/ 22 февраля 2019

У меня есть вопрос из моего magento версии 1.9.3.6, я создаю модуль для добавления настраиваемого поля в форму регистрации клиента и форму регистрации Checkout.

config.xml

    <?xml version="1.0"?>
<config>
  <modules>
    <Webcomnet_Field>
      <version>1.0.0</version>
    </Webcomnet_Field>
  </modules>
  <global>
    <helpers>
      <field>
        <class>Webcomnet_Field_Helper</class>
      </field>
    </helpers>
    <models>
      <field>
        <class>Webcomnet_Field_Model</class>
        <resourceModel>field_mysql4</resourceModel>
      </field>
    </models>
    <resources>
      <customerattribute1550847105_setup>
        <setup>
          <module>Webcomnet_Field</module>
          <class>Mage_Customer_Model_Entity_Setup</class>
        </setup>
        <connection>
          <use>core_setup</use>
        </connection>
      </customerattribute1550847105_setup>
      <customerattribute1550847105_write>
        <connection>
          <use>core_write</use>
        </connection>
      </customerattribute1550847105_write>
      <customerattribute1550847105_read>
        <connection>
          <use>core_read</use>
        </connection>
      </customerattribute1550847105_read>
    </resources>
  </global>
</config> 

intall code

<?php
$installer = $this;
$installer->startSetup();


$installer->addAttribute("customer", "cod_univoco",  array(
    "type"     => "varchar",
    "backend"  => "",
    "label"    => "Codice Univoco",
    "input"    => "text",
    "source"   => "",
    "visible"  => true,
    "required" => false,
    "default" => "",
    "frontend" => "",
    "unique"     => false,
    "note"       => ""

    ));

        $attribute   = Mage::getSingleton("eav/config")->getAttribute("customer", "cod_univoco");


$used_in_forms=array();

$used_in_forms[]="adminhtml_customer";
$used_in_forms[]="checkout_register";
$used_in_forms[]="customer_account_create";
$used_in_forms[]="customer_account_edit";
$used_in_forms[]="adminhtml_checkout";
        $attribute->setData("used_in_forms", $used_in_forms)
        ->setData("is_used_for_customer_segment", true)
        ->setData("is_system", 0)
        ->setData("is_user_defined", 1)
        ->setData("is_visible", 1)
        ->setData("sort_order", 100)
        ;
        $attribute->save();



$installer->endSetup();

Затем я отредактировал файлы register.phtml, чтобы показать поле в регистрационной форме, файл form / edit.phtml, чтобы показать поле в форме редактирования в разделе учетной записи клиента и файл биллинга.phtml для отображения поля в форме регистрации заказа.

Модуль отлично работает для формы регистрации клиента и формы редактирования, проблема в форме проверки, появится поле, но если я добавлю значение, это значениене сохраняется.

Что я могу сделать?Спасибо

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...