创造一种在 checkout/checkout 上注册的新方法

Making a New way to Register on checkout/checkout

大家好,我想在 checkout/checkout 上添加一些客户信息 - 电话、生日、手机 关于 register.php 只有电子邮件和密码。 但问题是除了名字,姓氏我无法保存在数据库中 Opencart 2.3.0.2 我在默认模板上制作所有内容,但我有 themeforest 模板

所以在 tpl 上我把这个放在 payment_adress

<div class="telefone required col-lg-6" style="padding-left: 0;">
                   <label class="col-sm-12 control-label" for="input-telephone"><?php //echo $entry_telephone; ?></label> 
                  <div class="col-sm-12 inputWithIcon">                     
                     <input type="text" name="telephone" value="" placeholder="<?php echo $entry_telephone; ?>" id="input-payment-telephone" class="form-control" title="Coloque o número de telefone celular ou fixo" required="required"/>
                     <i class="fa fa-phone" aria-hidden="true"></i>
                 </div>

在控制器上 payment_adress

$data['entry_telephone'] = $this->language->get('entry_telephone'); 

if ((utf8_strlen($this->request->post['telephone']) < 3) || (utf8_strlen($this->request->post['telephone']) > 32)) {
                $json['error']['telephone'] = $this->language->get('error_telephone');
            }

在模型地址上,我创建了另一个 public 函数,名为 addCustomer2。目的是INSERT INTO客户的所有信息。我放的这个文件也是

public function addCustomer2($data) {
    if (isset($data['customer_group_id']) && is_array($this->config->get('config_customer_group_display')) && in_array($data['customer_group_id'], $this->config->get('config_customer_group_display'))) {
        $customer_group_id = $data['customer_group_id'];
    } else {
        $customer_group_id = $this->config->get('config_customer_group_id');
    }

    $this->load->model('account/customer_group');

    $customer_group_info = $this->model_account_customer_group->getCustomerGroup($customer_group_id);

    $this->db->query("INSERT INTO " . DB_PREFIX . "customer SET customer_group_id = '" . (int)$customer_group_id . "', store_id = '" . (int)$this->config->get('config_store_id') . "', language_id = '" . (int)$this->config->get('config_language_id') . "', firstname = '" . strtoupper($this->db->escape($data['firstname'])) . "', lastname = '" . strtoupper($this->db->escape($data['lastname'])) . "', telephone = '" . $this->db->escape($data['telephone']) . "', custom_field = '" . $this->db->escape(isset($data['custom_field']['account']) ? json_encode($data['custom_field']['account']) : '') . "', salt = '" . $this->db->escape($salt = token(9)) . "', ip = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "', status = '1', approved = '" . (int)!$customer_group_info['approval'] . "', date_added = NOW()");}

我的配置没有消息错误,但没有保存信息。 谁能帮帮我

您检查过控制器中是否调用了模型函数 addCustomer2(不是 addCustomer)

根据我从您的消息中了解到的情况(如果您没有收到任何错误)似乎在控制器中称为旧函数 addCustomer,而不是您的新函数。

此外,如果您有一些 OCMOD 扩展并且该模型已更改,请确保检查 storage/modification/... 并重建 ocmod 缓存(如果您更改的文件也被其他 ocmod 扩展修改)

祝你有愉快的一天