예제 #1
0
 public function addCustomer($data)
 {
     $send_confirmation_mail_status = $this->config->get('config_account_mail');
     if ($send_confirmation_mail_status == '1') {
         parent::addCustomer($data);
     } else {
         $this->event->trigger('pre.customer.add', $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') . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', custom_field = '" . $this->db->escape(isset($data['custom_field']['account']) ? serialize($data['custom_field']['account']) : '') . "', salt = '" . $this->db->escape($salt = substr(md5(uniqid(rand(), true)), 0, 9)) . "', password = '******'password'])))) . "', newsletter = '" . (isset($data['newsletter']) ? (int) $data['newsletter'] : 0) . "', ip = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "', status = '1', approved = '" . (int) (!$customer_group_info['approval']) . "', date_added = NOW()");
         $customer_id = $this->db->getLastId();
         $this->db->query("INSERT INTO " . DB_PREFIX . "address SET customer_id = '" . (int) $customer_id . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', company = '" . $this->db->escape($data['company']) . "', address_1 = '" . $this->db->escape($data['address_1']) . "', address_2 = '" . $this->db->escape($data['address_2']) . "', city = '" . $this->db->escape($data['city']) . "', postcode = '" . $this->db->escape($data['postcode']) . "', country_id = '" . (int) $data['country_id'] . "', zone_id = '" . (int) $data['zone_id'] . "', custom_field = '" . $this->db->escape(isset($data['custom_field']['address']) ? serialize($data['custom_field']['address']) : '') . "'");
         $address_id = $this->db->getLastId();
         $this->db->query("UPDATE " . DB_PREFIX . "customer SET address_id = '" . (int) $address_id . "' WHERE customer_id = '" . (int) $customer_id . "'");
         $this->event->trigger('post.customer.add', $customer_id);
         return $customer_id;
     }
 }
예제 #2
0
파일: f.php 프로젝트: jetfire21/oc.loc
            curl_close($ch2);
            //var_dump($result2);
            $res2 = json_decode($result2);
            // обьект
            if ($res2->error) {
                exit($res2->error->message);
            }
            // print_r($res2);
            //echo $res2->name;
            echo $res2->email;
            $res2 = explode(" ", $res2->name);
            print_r($res2);
            $data['firstname'] = $res2[0];
            $data['lastname'] = $res2[1];
            require_once $domen . "/catalog/model/account/customer.php";
            $customer = new ModelAccountCustomer();
            $customer->addCustomer($data);
        } else {
            exit("no get access_token");
        }
    }
}
// else{
// 	 exit("Ошибка при получении кода!");
// }
?>

<!-- <a href="<?php 
echo $path;
?>
">login</a> -->