Page 2 of 2

Re: [REQUEST] Disable shopping cart saving [SOLVED]

Posted: Tue Oct 04, 2011 7:47 pm
by werepair
j8yba wrote:
werepair wrote:You have been logged off your account. It is now safe to leave the computer.
Is this a normal exit quote? "safe to leave the computer" ? Surely safe to leave this website or something would be better?

Hi, Yes his is the normal quote in opencart

Code: Select all

You have been logged off your account. It is now safe to leave the computer.
this can easilly be changed to what ever text you want.
Best Regards

Re: [REQUEST] Disable shopping cart saving [SOLVED]

Posted: Tue Nov 01, 2011 4:03 pm
by bepdaniels
Perfect j8yba! I was just about to use $this->cart->clear() in my logout script, but this is much cleaner. Hooray for vQmod! :)

Re: [REQUEST] Disable shopping cart saving [SOLVED]

Posted: Fri Feb 03, 2012 8:49 pm
by jussi
Hi,

vqmod doesn´t work for me (1.5.1.3). The log gives this error: REQUEST URI : /admin/index.php?route=tool/error_log&token=a3ab1d27adc8615b99be3ff8f75d9900
DOM UNABLE TO LOAD: /public_html/vqmod/xml/disable_shopping_cart_saving.xml

Any suggestions? I would really like to use this mod!

Re: [REQUEST] Disable shopping cart saving [SOLVED]

Posted: Tue Feb 07, 2012 2:27 pm
by 92marriw8
Yes I have exactly the same problem! Does anybody have a solution for this mistake?





Image

Re: [REQUEST] Disable shopping cart saving [SOLVED]

Posted: Tue Mar 06, 2012 1:11 am
by wakabayashi
Does anybody have a solution for this "problem" which works with the version 1.5.2?

Re: [REQUEST] Disable shopping cart saving [SOLVED]

Posted: Sat Mar 30, 2013 1:49 am
by rdvapors
I have been running OP 1.5.5.1, and noticed that when a customer (logged in or not) adds items to the cart and then abandoned it, then returns later the cart still has the items in it. Is there a way to clear the cart when it is abandoned by simply the customer closing the browser?

Re: [REQUEST] Disable shopping cart saving [SOLVED]

Posted: Tue Oct 17, 2017 7:53 pm
by SXGuy
I apreciate this is an old thread, but i thouht id add the fix for OC 2.X as i searched around and didnt find anywhere with this information.

To do this in OC 2.x you need to go to System/Library/Cart/Customer.php

Find

Code: Select all

	public function login($email, $password, $override = false) {
		if ($override) {
			$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(utf8_strtolower($email)) . "' AND status = '1'");
		} else {
			$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 approved = '1'");
		} 
Replace with

Code: Select all

	public function login($email, $password, $override = false) {
		if ($override) {
			$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(utf8_strtolower($email)) . "' AND status = '1'");
		} else {
			$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 approved = '1'");
			$this->db->query("DELETE FROM " . DB_PREFIX . "cart WHERE customer_id = '" . $customer_query->row['customer_id'] . "'");
		} 
So if any cart data in the cart table was assigned to a customer after login during a session, but the customer fails to check out, this will clear the cart table of cart data associated with the customer when they next login. This does not clear any cart contents added prior to logining in either.

On side note. i didnt like the way the cart table keeps entries with customer id's of 0, which may never be assigned to a customer in the future so to clear the content i added this to System\Cart\Cart.php

find

Code: Select all

if ($this->customer->getId()) {
Add above

Code: Select all

$this->db->query("DELETE FROM " . DB_PREFIX . "cart WHERE (api_id = '0' AND customer_id = '0') AND date_added < DATE_SUB(NOW(), INTERVAL 1 HOUR)"); 

Re: [REQUEST] Disable shopping cart saving [SOLVED]

Posted: Tue Feb 13, 2018 7:08 am
by Vapeministry
That's nice, but if the customer makes an error in the log-in (inputs wrong username or password) the system returns a Notice: Undefined index: customer_id in /system/library/cart/customer.php on line XX i guess cos there's no customer_id passed.