Hi,
I ‘am Using OC 3.0.2. designing 3 stores, from which 2 are for common access and one is for registered dealers only.
The standard registration allows access to all stores.
I noticed that there is a store_id field in the OC_cutomer table. How can I use this field to add an extra check for login? (if not 2 than access denied)
Or has someone another suggestion to accomplice a unique login?
I ‘am Using OC 3.0.2. designing 3 stores, from which 2 are for common access and one is for registered dealers only.
The standard registration allows access to all stores.
I noticed that there is a store_id field in the OC_cutomer table. How can I use this field to add an extra check for login? (if not 2 than access denied)
Or has someone another suggestion to accomplice a unique login?
The standard registration of Opencart with default installation allows logins by stores for all customers ... not for all stores for all customers. As for the extra check, could you elaborate that a little?The standard registration allows access to all stores.
I noticed that there is a store_id field in the OC_cutomer table. How can I use this field to add an extra check for login? (if not 2 than access denied)
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Thanks for the swift aswer.
May be edit the store’s account login.twig (by using the theme/template editor).
add a line where there is a check if the store_id = 2
if yes then login success else the standard error message will doo fine
May be edit the store’s account login.twig (by using the theme/template editor).
add a line where there is a check if the store_id = 2
if yes then login success else the standard error message will doo fine
Strange that a store_id would be stored on the database but not re-gathered when a customer logs in ...
in catalog/model/account/customer.php file,
find:
replace with:
in catalog/model/account/customer.php file,
find:
Code: Select all
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE customer_id = '" . (int)$customer_id . "'");
Code: Select all
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE customer_id = '" . (int)$customer_id . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "'");
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
thank you,
I did the modification, but sadly without result. I can still login using any customer account. Just to be sure, I cleared all cookies, restarted the server and tried different browsers, but that did not change anything. I hope you have some other tricks to solve my problem.
Best regards,
Petra
I did the modification, but sadly without result. I can still login using any customer account. Just to be sure, I cleared all cookies, restarted the server and tried different browsers, but that did not change anything. I hope you have some other tricks to solve my problem.
Best regards,
Petra
One more location is needed. In your system/library/cart/customer.php file,
find:
replace with:
Then, find:
replace with:
find:
Code: Select all
$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE customer_id = '" . (int)$this->session->data['customer_id'] . "' AND status = '1'");
Code: Select all
$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE customer_id = '" . (int)$this->session->data['customer_id'] . "' AND status = '1' AND store_id = '" . (int)$this->config->get('config_store_id') . "'");
Code: Select all
$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(utf8_strtolower($email)) . "' AND (password = SHA1(CONCAT(salt, SHA1(CONCAT(salt, SHA1('" . $this->db->escape($password) . "'))))) OR password = '" . $this->db->escape(md5($password)) . "') AND status = '1'");
Code: Select all
$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(utf8_strtolower($email)) . "' AND (password = SHA1(CONCAT(salt, SHA1(CONCAT(salt, SHA1('" . $this->db->escape($password) . "'))))) OR password = '" . $this->db->escape(md5($password)) . "') AND status = '1' AND store_id = '" . (int)$this->config->get('config_store_id') . "'");
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester