conflict resolve

This commit is contained in:
rahul shukla 2018-10-04 12:32:30 +05:30
commit 58ad8184eb
16 changed files with 123 additions and 80 deletions

View File

@ -154,8 +154,6 @@ class Cart {
'base_total_weight' => $product->weight * $data['quantity'], 'base_total_weight' => $product->weight * $data['quantity'],
]; ];
// dd(['parent' => $parentData, 'child' => null]);
return ['parent' => $parentData, 'child' => null]; return ['parent' => $parentData, 'child' => null];
} }
} }
@ -447,6 +445,7 @@ class Cart {
*/ */
public function removeItem($itemId) public function removeItem($itemId)
{ {
dd($itemId);
if(session()->has('cart')) { if(session()->has('cart')) {
$cart = session()->get('cart'); $cart = session()->get('cart');
@ -486,11 +485,13 @@ class Cart {
} }
if ($result) { if ($result) {
session()->flash('sucess', 'Item Successfully Removed From Cart'); session()->flash('sucess', trans('shop::app.checkout.cart.remove.success'));
} else { } else {
session()->flash('error', 'Item Cannot Be Removed From Cart'); session()->flash('error', trans('shop::app.checkout.cart.remove.error'));
} }
} }
session()->flash('warning', trans('shop::app.checkout.cart.remove.cannot'));
return redirect()->back(); return redirect()->back();
} }

View File

@ -76,16 +76,11 @@ class CartController extends Controller
} }
/** /**
* Method to populate * Method to populate the cart page which will be populated before the checkout process.
* the cart page which
* will be populated
* before the checkout
* process.
* *
* @return Mixed * @return Mixed
*/ */
public function index() { public function index() {
// dd(Cart::getCart());
return view($this->_config['view'])->with('cart', Cart::getCart()); return view($this->_config['view'])->with('cart', Cart::getCart());
} }
@ -126,6 +121,14 @@ class CartController extends Controller
public function updateBeforeCheckout() { public function updateBeforeCheckout() {
$data = request()->except('_token'); $data = request()->except('_token');
foreach($data['qty'] as $id => $quantity) {
// dd($id, $quantity);
if($quantity <= 0) {
session()->flash('warning', trans('shop::app.checkout.cart.quantity.illegal'));
return redirect()->back();
}
}
Cart::update($data); Cart::update($data);
return redirect()->back(); return redirect()->back();

View File

@ -41,11 +41,6 @@ Route::group(['middleware' => ['web']], function () {
'view' => 'shop::products.view' 'view' => 'shop::products.view'
])->name('shop.products.index'); ])->name('shop.products.index');
// //Routes for product cart
// Route::get('/checkout/cart', 'Webkul\Shop\Http\Controllers\CartController@index')->defaults('_config', [
// 'view' => 'shop::checkout.cart.index'
// ])->name('shop.checkout.cart.index');
Route::post('product/cart/add/{id}', 'Webkul\Shop\Http\Controllers\CartController@add')->name('cart.add'); Route::post('product/cart/add/{id}', 'Webkul\Shop\Http\Controllers\CartController@add')->name('cart.add');
Route::get('product/cart/remove/{id}', 'Webkul\Shop\Http\Controllers\CartController@remove')->name('cart.remove'); Route::get('product/cart/remove/{id}', 'Webkul\Shop\Http\Controllers\CartController@remove')->name('cart.remove');

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -974,7 +974,7 @@ section.product-detail {
width: 100%; width: 100%;
div.product-image-group { div.product-image-group {
margin-right: 36px; margin-right: 30px;
div { div {
display: flex; display: flex;
@ -985,7 +985,7 @@ section.product-detail {
flex-direction: column; flex-direction: column;
margin-right: 4px; margin-right: 4px;
height: 480px; height: 480px;
width: 120px; min-width: 120px;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
justify-content: flex-start; justify-content: flex-start;
@ -993,8 +993,7 @@ section.product-detail {
.thumb-frame { .thumb-frame {
border: 2px solid transparent; border: 2px solid transparent;
background: #F2F2F2; background: #F2F2F2;
max-width: 120px; width: 120px;
width: auto;
height: 120px; height: 120px;
&.active { &.active {
@ -1002,8 +1001,8 @@ section.product-detail {
} }
img { img {
width: 100%;
height: 100%; height: 100%;
width: 100%;
} }
} }
@ -1077,8 +1076,9 @@ section.product-detail {
} }
} }
.cart-fav-seg { .add-to-buttons {
display: block; display: flex;
flex-direction: row;
margin-top: 10px; margin-top: 10px;
.addtocart { .addtocart {

View File

@ -83,16 +83,25 @@
.cart-fav-seg { .cart-fav-seg {
display: inline-flex; display: inline-flex;
width: 100%; align-items: center;
.addtocart { .addtocart {
margin-right: 10px; margin-right: 10px;
text-transform: uppercase; text-transform: uppercase;
white-space: nowrap; white-space: nowrap;
} }
.product-card.wishlist-icon {
cursor: pointer;
}
} }
} }
//wishlist-icon-hover
.product-card.wishlist-icon:hover {
background-image: url('../images/wishadd.svg');
}
//product page price styles //product page price styles
.product-price { .product-price {
margin-bottom: 14px; margin-bottom: 14px;

View File

@ -71,4 +71,16 @@
background-image: url('../images/payment.svg'); background-image: url('../images/payment.svg');
width: 32px; width: 32px;
height: 32px; height: 32px;
}
.cart-icon {
background-image: url("../images/icon-cart.svg");
width: 24px;
height: 24px;
}
.wishlist-icon {
background-image: url('../images/wishlist.svg');
width: 32px;
height: 32px;
} }

View File

@ -70,7 +70,16 @@ return [
'proceed-to-checkout' => 'Proceed To Checkout', 'proceed-to-checkout' => 'Proceed To Checkout',
'quantity' => 'Quantity', 'quantity' => 'Quantity',
'remove' => 'Remove', 'remove' => 'Remove',
'move-to-wishlist' => 'Move to Wishlist' 'move-to-wishlist' => 'Move to Wishlist',
'quantity' => [
'quantity' => 'Quantity',
'illegal' => 'Quantity cannot be lesser than one.'
],
'remove' => [
'cannot' => 'No items to remove from the cart',
'success' => 'Item successfully removed from the cart',
'error' => 'Cannot remove item from cart'
]
], ],
'onepage' => [ 'onepage' => [

View File

@ -48,21 +48,28 @@
@if ($product->type == 'configurable') @if ($product->type == 'configurable')
<div class="summary"> <div class="summary">
{{-- @foreach (cart::getItemAttributeOptionDetails($item) as $key => $option)
{{ Cart::getItemAttributeOptionDetails($item)['html'] }} {{ Cart::getItemAttributeOptionDetails($item)['html'] }}
@endforeach --}}
</div> </div>
@endif @endif
<div class="misc" :class="[errors.has('quantity') ? 'has-error' : '']"> <div class="misc">
<div class="qty-text">{{ __('shop::app.checkout.cart.quantity') }}</div> <div class="qty-text" :class="[errors.has('qty') ? 'has-error' : '']">{{ __('shop::app.checkout.cart.quantity.quantity') }}</div>
{{-- <div class="box">{{ $item->quantity }}</div> --}} {{-- <div class="box">{{ $item->quantity }}</div> --}}
<input class="box" type="text" v-validate="'required|numeric|min_value:1'" name="qty[{{$item->id}}]" value="{{ $item->quantity }}"> <input class="box" type="text" v-validate="'required|numeric|min_value:1'" name="qty[{{$item->id}}]" value="{{ $item->quantity }}">
<span class="control-error" v-if="errors.has('qty[{{$item->qty}}]')">@{{ errors.first('quantity') }}</span>
<span class="control-error" v-if="errors.has('qty[{{$item->id}}]')">@{{ errors.first('qty') }}</span>
{{-- @if($product->type == 'configurable') {{-- @if($product->type == 'configurable')
<span class="remove"><a href="{{ route('shop.checkout.cart.remove', $item->child->id) }}">{{ __('shop::app.checkout.cart.remove') }}</a></span> <span class="remove"><a href="{{ route('shop.checkout.cart.remove', $item->child->id) }}">{{ __('shop::app.checkout.cart.remove') }}</a></span>
@else --}} @else --}}
<span class="remove"><a href="{{ route('shop.checkout.cart.remove', $item->id) }}">{{ __('shop::app.checkout.cart.remove') }}</a></span>
<span class="remove"><a href="{{ route('shop.checkout.cart.remove', $item->id) }}">{{ __('shop::app.checkout.cart.remove') }}</a></span>
{{-- @endif --}} {{-- @endif --}}
<span class="towishlist">{{ __('shop::app.checkout.cart.move-to-wishlist') }}</span> <span class="towishlist">{{ __('shop::app.checkout.cart.move-to-wishlist') }}</span>
</div> </div>

View File

@ -2,6 +2,6 @@
@include ('shop::products.add-to-cart', ['product' => $product]) @include ('shop::products.add-to-cart', ['product' => $product])
<span class="wishlist"><img src="{{ bagisto_asset('images/wishlist.svg') }}" /></span> <span class="product-card wishlist-icon"></span>
</div> </div>

View File

@ -1,4 +1,4 @@
<div class="cart-fav-seg"> <div class="add-to-buttons">
@include ('shop::products.add-to-cart', ['product' => $product]) @include ('shop::products.add-to-cart', ['product' => $product])

View File

@ -78,35 +78,3 @@
@endsection @endsection
@push('scripts')
<script>
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
var scrollTop = window.pageYOffset
var elems = document.getElementById("header-bottom");
if(scrollTop > 200){
elems.style.display = "none";
}else {
elems.style.display = "block";
}
}
</script>
@endpush

View File

@ -8,7 +8,7 @@ mix.setPublicPath(publicPath).mergeManifest();
mix.disableNotifications(); mix.disableNotifications();
mix.js([__dirname + "/src/Resources/assets/js/app.js"], "js/shop.js") mix.js([__dirname + "/src/Resources/assets/js/app.js"], "js/shop.js")
// .copy(__dirname + "/src/Resources/assets/images", publicPath + "/images") .copyDirectory(__dirname + "/src/Resources/assets/images", publicPath + "/images")
.sass(__dirname + "/src/Resources/assets/sass/app.scss", "css/shop.css") .sass(__dirname + "/src/Resources/assets/sass/app.scss", "css/shop.css")
.options({ .options({
processCssUrls: false processCssUrls: false

View File

@ -132,12 +132,6 @@
height: 24px; height: 24px;
} }
.cart-icon {
background-image: url("../images/icon-cart.svg");
width: 24px;
height: 24px;
}
.expand-icon { .expand-icon {
background-image: url("../images/Expand-Light.svg"); background-image: url("../images/Expand-Light.svg");
width: 18px; width: 18px;

View File

@ -73,6 +73,18 @@
height: 32px; height: 32px;
} }
.cart-icon {
background-image: url("../images/icon-cart.svg");
width: 24px;
height: 24px;
}
.wishlist-icon {
background-image: url("../images/wishlist.svg");
width: 32px;
height: 32px;
}
.product-grid-4 { .product-grid-4 {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
@ -155,7 +167,9 @@
display: -webkit-inline-box; display: -webkit-inline-box;
display: -ms-inline-flexbox; display: -ms-inline-flexbox;
display: inline-flex; display: inline-flex;
width: 100%; -webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
} }
.product-card .cart-fav-seg .addtocart { .product-card .cart-fav-seg .addtocart {
@ -164,6 +178,14 @@
white-space: nowrap; white-space: nowrap;
} }
.product-card .cart-fav-seg .product-card.wishlist-icon {
cursor: pointer;
}
.product-card.wishlist-icon:hover {
background-image: url("../images/wishadd.svg");
}
.product-price { .product-price {
margin-bottom: 14px; margin-bottom: 14px;
width: 100%; width: 100%;
@ -1509,7 +1531,7 @@ section.product-detail div.layouter form {
} }
section.product-detail div.layouter form div.product-image-group { section.product-detail div.layouter form div.product-image-group {
margin-right: 36px; margin-right: 30px;
} }
section.product-detail div.layouter form div.product-image-group div { section.product-detail div.layouter form div.product-image-group div {
@ -1532,7 +1554,7 @@ section.product-detail div.layouter form div.product-image-group div .thumb-list
flex-direction: column; flex-direction: column;
margin-right: 4px; margin-right: 4px;
height: 480px; height: 480px;
width: 120px; min-width: 120px;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
-webkit-box-pack: start; -webkit-box-pack: start;
@ -1543,8 +1565,7 @@ section.product-detail div.layouter form div.product-image-group div .thumb-list
section.product-detail div.layouter form div.product-image-group div .thumb-list .thumb-frame { section.product-detail div.layouter form div.product-image-group div .thumb-list .thumb-frame {
border: 2px solid transparent; border: 2px solid transparent;
background: #F2F2F2; background: #F2F2F2;
max-width: 120px; width: 120px;
width: auto;
height: 120px; height: 120px;
} }
@ -1553,8 +1574,8 @@ section.product-detail div.layouter form div.product-image-group div .thumb-list
} }
section.product-detail div.layouter form div.product-image-group div .thumb-list .thumb-frame img { section.product-detail div.layouter form div.product-image-group div .thumb-list .thumb-frame img {
width: 100%;
height: 100%; height: 100%;
width: 100%;
} }
section.product-detail div.layouter form div.product-image-group div .thumb-list .gallery-control { section.product-detail div.layouter form div.product-image-group div .thumb-list .gallery-control {
@ -1625,18 +1646,24 @@ section.product-detail div.layouter form div.product-image-group div .product-he
right: 45px; right: 45px;
} }
section.product-detail div.layouter form div.product-image-group .cart-fav-seg { section.product-detail div.layouter form div.product-image-group .add-to-buttons {
display: block; display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
margin-top: 10px; margin-top: 10px;
} }
section.product-detail div.layouter form div.product-image-group .cart-fav-seg .addtocart { section.product-detail div.layouter form div.product-image-group .add-to-buttons .addtocart {
border-radius: 0px; border-radius: 0px;
width: 49%; width: 49%;
background: black; background: black;
} }
section.product-detail div.layouter form div.product-image-group .cart-fav-seg .buynow { section.product-detail div.layouter form div.product-image-group .add-to-buttons .buynow {
border-radius: 0px; border-radius: 0px;
width: 49%; width: 49%;
float: right; float: right;

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 50.2 (55047) - http://www.bohemiancoding.com/sketch -->
<title>icon-cart</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="icon-cart" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group" transform="translate(2.000000, 2.000000)">
<path d="M3.5,1.5 L8.5,13.5" id="Line-2" stroke="#242424" stroke-width="3" stroke-linecap="round"></path>
<path d="M15.5,5.5 L19.5,13.5" id="Line-2" stroke="#242424" stroke-width="3" stroke-linecap="round" transform="translate(17.500000, 9.500000) scale(-1, 1) translate(-17.500000, -9.500000) "></path>
<path d="M5.5,5.5 L19.5,5.5" id="Line-2" stroke="#242424" stroke-width="3" stroke-linecap="round"></path>
<path d="M0.5,1.5 L3.5,1.5" id="Line-2" stroke="#242424" stroke-width="3" stroke-linecap="round"></path>
<path d="M8.5,13.5 L15.5,13.5" id="Line-2" stroke="#242424" stroke-width="3" stroke-linecap="round"></path>
<circle id="Oval" fill="#242424" cx="9" cy="18" r="2"></circle>
<circle id="Oval" fill="#242424" cx="15" cy="18" r="2"></circle>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB