Hello. Help solve the problem with the open card. In the open card, when adding the same product to the basket many times, it is grouped in the basket by quantity, provided that it has the same parameters. That is, if the product is not set, for example, no option and clicking on the buy button in the product card, say 10 times, this product will be displayed in the basket 1 time with the number 10. http://prntscr.com/nghb1r

It is necessary that each time the same product is added to the cart, it will not be grouped by quantity, but added as a new unit with quantity 1. http://prntscr.com/nghbk8 Using the product options will not work for this.

I use ocstore 2.3.0.2.3. Tell me where to dig, what to change, how to achieve the desired result?

  • And what is the meaning of such customization? And yet there is the main basket, because there as a result, too, will have to pereidalivat. And there is also a letter to the client and the admin with the order, and how? And in the personal account of a registered customer in the history of orders? And in the admin in the history of orders? - Kirill Korushkin am
  • Order photoboots with the ability to crop photos. And the same photo can be cropped with different parameters, but have the same options. For example, 2 * 1m size and printing on the composite on the one hand, and also the photo is shrunk after just 2 * 1m, but the other part of the photo and this part already goes to the other side. In total, the same product is cut in different ways, with the same parameters for the options and not grouped into one - Joe Black
  • Here, you probably more suitable text option - Kirill Korushkin
  • And you can a little more, not quite caught the train of thought? - Joe Black

1 answer 1

Everything turned out to be much simpler.

In system / library / cart / cart.php, in the add () function, we find the code:

if (!$query->row['total']) { $this->db->query("INSERT " . DB_PREFIX . "cart SET api_id = '" . (isset($this->session->data['api_id']) ? (int)$this->session->data['api_id'] : 0) . "', customer_id = '" . (int)$this->customer->getId() . "', session_id = '" . $this->db->escape($this->session->getId()) . "', product_id = '" . (int)$product_id . "', recurring_id = '" . (int)$recurring_id . "', `option` = '" . $this->db->escape(json_encode($option)) . "', quantity = '" . (int)$quantity . "', date_added = NOW()"); } else { $this->db->query("UPDATE " . DB_PREFIX . "cart SET quantity = (quantity + " . (int)$quantity . ") WHERE api_id = '" . (isset($this->session->data['api_id']) ? (int)$this->session->data['api_id'] : 0) . "' AND customer_id = '" . (int)$this->customer->getId() . "' AND session_id = '" . $this->db->escape($this->session->getId()) . "' AND product_id = '" . (int)$product_id . "' AND recurring_id = '" . (int)$recurring_id . "' AND `option` = '" . $this->db->escape(json_encode($option)) . "'"); } 

and change it to this:

 $this->db->query("INSERT " . DB_PREFIX . "cart SET api_id = '" . (isset($this->session->data['api_id']) ? (int)$this->session->data['api_id'] : 0) . "', customer_id = '" . (int)$this->customer->getId() . "', session_id = '" . $this->db->escape($this->session->getId()) . "', product_id = '" . (int)$product_id . "', recurring_id = '" . (int)$recurring_id . "', `option` = '" . $this->db->escape(json_encode($option)) . "', quantity = '" . (int)$quantity . "', date_added = NOW()"); 

After that, everything works at all levels as needed - basket, admin, letters to the admin and buyer.