cart item orders never change

This commit is contained in:
Joel Male
2024-08-16 16:29:46 +10:00
parent 66fd4c9099
commit d12a566366
3 changed files with 134 additions and 71 deletions
+4 -5
View File
@@ -196,11 +196,9 @@ public function add($id, $name = null, $price = null, $quantity = null, $attribu
// if the item is already in the cart we will just update it
if ($cart->has($id)) {
$this->update($id, $item);
} else {
$this->addRow($id, $item);
$this->addItem($id, $item);
}
$this->currentItemId = $id;
@@ -225,7 +223,7 @@ public function update($id, $data)
$cart = $this->getContent();
$item = $cart->pull($id);
$item = $cart->get($id);
foreach ($data as $key => $value) {
// if the key is currently "quantity" we will need to check if an arithmetic
@@ -255,6 +253,7 @@ public function update($id, $data)
}
}
// update the item in the cart
$cart->put($id, $item);
$this->save($cart);
@@ -725,7 +724,7 @@ protected function validate($item)
*
* @return bool
*/
protected function addRow($id, $item)
protected function addItem($id, $item)
{
if ($this->fireEvent('adding', $item) === false) {
return false;