Open minhtu-cloudtek opened 5 years ago
The row id is the id of your item + options and allows to merge items with the same type and options. This is per design, you would have to implement a different solution to achieve what you want.
@minhtu-cloudtek You could disable line 216 in CartItem.php to achieve what you want.
// $this->rowId = $this->generateRowId($this->id, $this->options->all());
/**
* Update the cart item from an array.
*
* @param array $attributes
* @return void
*/
public function updateFromArray(array $attributes)
{
$this->id = array_get($attributes, 'id', $this->id);
$this->qty = array_get($attributes, 'qty', $this->qty);
$this->name = array_get($attributes, 'name', $this->name);
$this->price = array_get($attributes, 'price', $this->price);
$this->priceTax = $this->price + $this->tax;
$this->options = new CartItemOptions(array_get($attributes, 'options', $this->options));
// $this->rowId = $this->generateRowId($this->id, $this->options->all());
};
Thanks for your reply. I've updated my Laravel app to 6. And this package is no longer compatible. Do you have plan for Crinsane/LaravelShoppingcart for Laravel 6?
@minhtu-cloudtek there are many forks of this package, some just keeping it compatible to the latest Laravel releases and some building upon the existing codebase. Except of those there is no version for L6+.
Hi, I create a controller method to update my cart row.
It functions normally if I update only
qty
. If I updateoptions
, therowId
of that row changes as follows. I found that annoying and I have to refresh all the cart data in my view so that I can continue to update the cart.Is there a way for me to update
options
of row without changing therowId
?