Post by Daddio » Sat Jan 28, 2012 4:54 am

hello, I would like to create details for opencart customers out side of opencart, so they have customer ids in the mysql database that is linked to my shop, so they could go to the shop later for the first time and login as an existing customer.

I can write information into the relevant fields in the database except for the password field of the customer table.

Is there a way either to make a call to the part of the opencart script that creates password code or is there a way to allow some customers to login without a password?

Kindest regards

Adrian ( A Daddio!)

Newbie

Posts

Joined
Sat Jan 28, 2012 4:41 am

Post by straightlight » Sun Jan 29, 2012 12:53 am

The specific part you'd be looking for where it originally stores password upon customers registration would be in: catalog/model/account/customer.php file:

Code: Select all

$this->db->query("INSERT INTO " . DB_PREFIX . "customer SET 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']) . "', password = '" . $this->db->escape(md5($data['password'])) . "', newsletter = '" . (isset($data['newsletter']) ? (int)$data['newsletter'] : 0) . "', customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "', status = '1', date_added = NOW()");
and here:

Code: Select all

$this->db->query("UPDATE " . DB_PREFIX . "customer SET password = '" . $this->db->escape(md5($password)) . "' WHERE email = '" . $this->db->escape($email) . "'");
Then, within this method in system/library/customer.php file:

Code: Select all

public function login($email, $password, $override = false) {
and within this method in system/library/user.php file:

Code: Select all

public function login($username, $password) {

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 5 guests