fixes in minicart
This commit is contained in:
parent
ed9a3baed9
commit
59ff9cbb84
|
|
@ -41,11 +41,13 @@ class CustomerController extends Controller
|
|||
*
|
||||
* @return response JSON
|
||||
*/
|
||||
public function getProfile() {
|
||||
public function getProfile()
|
||||
{
|
||||
return response()->json($this->customer, 200);
|
||||
}
|
||||
|
||||
public function updateProfile($id) {
|
||||
public function updateProfile($id)
|
||||
{
|
||||
$validator = Validator::make(request()->all(), [
|
||||
'first_name' => 'string|required',
|
||||
'last_name' => 'string|required',
|
||||
|
|
|
|||
|
|
@ -34,22 +34,19 @@ class WishlistController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
public function unAuthorized() {
|
||||
public function unAuthorized()
|
||||
{
|
||||
return response()->json($this->customer, 401);
|
||||
}
|
||||
|
||||
public function getWishlist()
|
||||
{
|
||||
if($this->customer == false) {
|
||||
return response()->json($this->customer, 401);
|
||||
} else {
|
||||
$wishlist = $this->customer->wishlist_items;
|
||||
$wishlist = $this->customer->wishlist_items;
|
||||
|
||||
if($wishlist->count() > 0) {
|
||||
return response()->json($wishlist, 200);
|
||||
} else {
|
||||
return response()->json(['message' => 'Wishlist Empty', 'Items' => null], 200);
|
||||
}
|
||||
if($wishlist->count() > 0) {
|
||||
return response()->json($wishlist, 200);
|
||||
} else {
|
||||
return response()->json(['message' => 'Wishlist Empty', 'Items' => null], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +89,8 @@ class WishlistController extends Controller
|
|||
*
|
||||
* @param integer $itemId
|
||||
*/
|
||||
public function delete($itemId) {
|
||||
public function delete($itemId)
|
||||
{
|
||||
$result = $this->wishlist->deleteWhere(['customer_id' => auth()->guard('customer')->user()->id, 'channel_id' => core()->getCurrentChannel()->id, 'id' => $itemId]);
|
||||
|
||||
if($result) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
Route::get('login', function() {
|
||||
return response()->json(['message' => 'unauthorized'])->name('login');
|
||||
});
|
||||
Route::group(['middleware' => 'api','namespace' => 'Webkul\API\Http\Controllers\Customer', 'prefix' => 'api/customer'], function ($router) {
|
||||
Route::post('/register', 'RegistrationController@create');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@ class CartController extends Controller
|
|||
* @return Mixed
|
||||
*/
|
||||
public function add($id) {
|
||||
// dd($id, request()->all());
|
||||
|
||||
$result = Cart::add($id, request()->except('_token'));
|
||||
|
||||
if($result) {
|
||||
|
|
|
|||
|
|
@ -918,7 +918,7 @@ section.slider-block {
|
|||
}
|
||||
|
||||
.dropdown-content .item-details{
|
||||
height: 75px;
|
||||
max-height: 125px;
|
||||
}
|
||||
|
||||
.item-details .item-name {
|
||||
|
|
@ -927,6 +927,12 @@ section.slider-block {
|
|||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.item-details .item-options {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.item-details .item-price {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,28 +5,20 @@
|
|||
@stop
|
||||
|
||||
@section('content-wrapper')
|
||||
|
||||
@inject ('productImageHelper', 'Webkul\Product\Helpers\ProductImage')
|
||||
|
||||
<section class="cart">
|
||||
|
||||
@if ($cart)
|
||||
|
||||
<div class="title">
|
||||
{{ __('shop::app.checkout.cart.title') }}
|
||||
</div>
|
||||
|
||||
<div class="cart-content">
|
||||
|
||||
<div class="left-side">
|
||||
<form action="{{ route('shop.checkout.cart.update') }}" method="POST" @submit.prevent="onSubmit">
|
||||
|
||||
<div class="cart-item-list" style="margin-top: 0">
|
||||
|
||||
@csrf
|
||||
|
||||
@foreach($cart->items as $item)
|
||||
|
||||
<?php
|
||||
if($item->type == "configurable")
|
||||
$productBaseImage = $productImageHelper->getProductBaseImage($item->child->product);
|
||||
|
|
|
|||
|
|
@ -21,35 +21,14 @@
|
|||
<div class="dropdown-cart">
|
||||
<div class="dropdown-header">
|
||||
<p class="heading">
|
||||
{{ __('shop::app.checkout.cart.cart-subtotal') }} -
|
||||
{{ __('shop::app.checkout.cart.cart-subtotal') }} -
|
||||
{{ core()->currency($cart->sub_total) }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="dropdown-content">
|
||||
@foreach($items as $item)
|
||||
@if($item->type == "configurable")
|
||||
|
||||
<div class="item">
|
||||
<div class="item-image" >
|
||||
@php
|
||||
$images = $productImageHelper->getProductBaseImage($item->child->product);
|
||||
@endphp
|
||||
<img src="{{ $images['small_image_url'] }}" />
|
||||
</div>
|
||||
|
||||
<div class="item-details">
|
||||
|
||||
<div class="item-name">{{ $item->child->name }}</div>
|
||||
|
||||
<div class="item-price">{{ core()->currency($item->total) }}</div>
|
||||
|
||||
<div class="item-qty">Quantity - {{ $item->quantity }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@else
|
||||
|
||||
{{-- @if($item->type == "configurable") --}}
|
||||
<div class="item">
|
||||
<div class="item-image" >
|
||||
@php
|
||||
|
|
@ -59,7 +38,29 @@
|
|||
</div>
|
||||
|
||||
<div class="item-details">
|
||||
<div class="item-name">{{ $item->name }}</div>
|
||||
|
||||
@if($item->product->type == "configurable")
|
||||
<div class="item-options">
|
||||
{{ trim(Cart::getProductAttributeOptionDetails($item->child->product)['html']) }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="item-price">{{ core()->currency($item->total) }}</div>
|
||||
|
||||
<div class="item-qty">Quantity - {{ $item->quantity }}</div>
|
||||
</div>
|
||||
</div>
|
||||
{{-- @else
|
||||
<div class="item">
|
||||
<div class="item-image" >
|
||||
@php
|
||||
$images = $productImageHelper->getProductBaseImage($item->product);
|
||||
@endphp
|
||||
<img src="{{ $images['small_image_url'] }}" />
|
||||
</div>
|
||||
|
||||
<div class="item-details">
|
||||
<div class="item-name">{{ $item->name }}</div>
|
||||
|
||||
<div class="item-price">{{ core()->currency($item->total) }}</div>
|
||||
|
|
@ -67,8 +68,7 @@
|
|||
<div class="item-qty">Quantity - {{ $item->quantity }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
@endif --}}
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue