cart bug fixes and small css fix

This commit is contained in:
prashant-webkul 2018-11-30 13:10:41 +05:30
parent ac18050967
commit 36f6783db8
4 changed files with 19 additions and 7 deletions

View File

@ -111,7 +111,7 @@ class AttributeDataGrid
'name' => 'value_per_locale', 'name' => 'value_per_locale',
'alias' => 'attributeValuePerLocale', 'alias' => 'attributeValuePerLocale',
'type' => 'string', 'type' => 'string',
'label' => 'ValuePerLocale', 'label' => 'Locale based',
'sortable' => true, 'sortable' => true,
'wrapper' => function ($value) { 'wrapper' => function ($value) {
if($value == 0) if($value == 0)
@ -123,7 +123,7 @@ class AttributeDataGrid
'name' => 'value_per_channel', 'name' => 'value_per_channel',
'alias' => 'attributeValuePerChannel', 'alias' => 'attributeValuePerChannel',
'type' => 'string', 'type' => 'string',
'label' => 'ValuePerChannel', 'label' => 'Channel based',
'sortable' => true, 'sortable' => true,
'wrapper' => function ($value) { 'wrapper' => function ($value) {
if($value == 0) if($value == 0)

View File

@ -696,11 +696,15 @@ class Cart {
*/ */
public function collectTotals() public function collectTotals()
{ {
$validated = $this->validateItems();
if(!$validated) {
return false;
}
if(!$cart = $this->getCart()) if(!$cart = $this->getCart())
return false; return false;
$this->validateItems();
$this->calculateItemsTax(); $this->calculateItemsTax();
$cart->grand_total = $cart->base_grand_total = 0; $cart->grand_total = $cart->base_grand_total = 0;
@ -745,11 +749,15 @@ class Cart {
{ {
$cart = $this->getCart(); $cart = $this->getCart();
if(!$cart) {
return false;
}
//rare case of accident-->used when there are no items. //rare case of accident-->used when there are no items.
if(count($cart->items) == 0) { if(count($cart->items) == 0) {
$this->cart->delete($cart->id); $this->cart->delete($cart->id);
return redirect()->route('shop.home.index'); return false;
} else { } else {
$items = $cart->items; $items = $cart->items;
@ -1082,6 +1090,10 @@ class Cart {
return $result; return $result;
} else { } else {
$data['product'] = $id;
$data['is_configurable'] = false;
$data['quantity'] = 1;
$result = $this->add($id, $data); $result = $this->add($id, $data);
return $result; return $result;

View File

@ -91,7 +91,7 @@ class CartController extends Controller
if($result) { if($result) {
session()->flash('success', trans('shop::app.checkout.cart.item.success')); session()->flash('success', trans('shop::app.checkout.cart.item.success'));
} else { } else {
session()->flash('success', trans('shop::app.checkout.cart.item.error-add')); session()->flash('warning', trans('shop::app.checkout.cart.item.error-add'));
} }
Cart::collectTotals(); Cart::collectTotals();

View File

@ -911,7 +911,7 @@ section.slider-block {
} }
.dropdown-content .item-details{ .dropdown-content .item-details{
height: 75px; max-height: 125px;
} }
.item-details .item-name { .item-details .item-name {