mirror of
https://github.com/wearepixel/laravel-cart.git
synced 2026-11-14 13:51:44 +00:00
cart item orders never change
This commit is contained in:
+4
-5
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user