This commit is contained in:
rahul shukla 2019-10-07 16:36:16 +05:30
parent 2020006d47
commit 878c0eb8e5
6 changed files with 47 additions and 30 deletions

View File

@ -166,7 +166,7 @@ class CustomerController extends Controller
*/
public function reviews()
{
$reviews = auth()->guard('customer')->user()->all_reviews;
$reviews = $this->productReview->getCustomerReview();
return view($this->_config['view'], compact('reviews'));
}

View File

@ -48,10 +48,7 @@ class WishlistController extends Controller
* Displays the listing resources if the customer having items in wishlist.
*/
public function index() {
$wishlistItems = $this->wishlist->findWhere([
'channel_id' => core()->getCurrentChannel()->id,
'customer_id' => auth()->guard('customer')->user()->id]
);
$wishlistItems = $this->wishlist->getCustomerWhishlist();
return view($this->_config['view'])->with('items', $wishlistItems);
}

View File

@ -61,4 +61,17 @@ class WishlistRepository extends Repository
public function getItemsWithProducts($id) {
return $this->model->find($id)->item_wishlist;
}
/**
* get customer wishlist Items.
*
* @return mixed
*/
public function getCustomerWhishlist() {
return $this->model->where([
'channel_id' => core()->getCurrentChannel()->id,
'customer_id' => auth()->guard('customer')->user()->id
])->paginate(5);
}
}

View File

@ -55,7 +55,7 @@ class ProductReviewRepository extends Repository
{
$customerId = auth()->guard('customer')->user()->id;
$reviews = $this->model->where(['customer_id'=> $customerId])->with('product')->get();
$reviews = $this->model->where(['customer_id'=> $customerId])->with('product')->paginate(5);
return $reviews;
}

View File

@ -65,6 +65,10 @@
</div>
<div class="horizontal-rule mb-10 mt-10"></div>
@endforeach
<div class="bottom-toolbar">
{{ $reviews->links() }}
</div>
@else
<div class="empty mt-15">
{{ __('customer::app.reviews.empty') }}

View File

@ -25,39 +25,42 @@
<div class="account-items-list">
@if ($items->count())
@foreach ($items as $item)
<div class="account-item-card mt-15 mb-15">
<div class="media-info">
@php
$image = $productImageHelper->getProductBaseImage($item->product);
@endphp
@foreach ($items as $item)
<div class="account-item-card mt-15 mb-15">
<div class="media-info">
@php
$image = $productImageHelper->getProductBaseImage($item->product);
@endphp
<img class="media" src="{{ $image['small_image_url'] }}" />
<img class="media" src="{{ $image['small_image_url'] }}" />
<div class="info">
<div class="product-name">
{{$item->product->name}}
<div class="info">
<div class="product-name">
{{$item->product->name}}
</div>
@inject ('reviewHelper', 'Webkul\Product\Helpers\Review')
<span class="stars" style="display: inline">
@for($i=1;$i<=$reviewHelper->getAverageRating($item->product);$i++)
<span class="icon star-icon"></span>
@endfor
</span>
</div>
</div>
@inject ('reviewHelper', 'Webkul\Product\Helpers\Review')
<div class="operations">
<a class="mb-50" href="{{ route('customer.wishlist.remove', $item->id) }}"><span class="icon trash-icon"></span></a>
<span class="stars" style="display: inline">
@for($i=1;$i<=$reviewHelper->getAverageRating($item->product);$i++)
<span class="icon star-icon"></span>
@endfor
</span>
<a href="{{ route('customer.wishlist.move', $item->id) }}" class="btn btn-primary btn-md">{{ __('shop::app.wishlist.move-to-cart') }}</a>
</div>
</div>
<div class="horizontal-rule mb-10 mt-10"></div>
@endforeach
<div class="operations">
<a class="mb-50" href="{{ route('customer.wishlist.remove', $item->id) }}"><span class="icon trash-icon"></span></a>
<a href="{{ route('customer.wishlist.move', $item->id) }}" class="btn btn-primary btn-md">{{ __('shop::app.wishlist.move-to-cart') }}</a>
</div>
<div class="bottom-toolbar">
{{ $items->links() }}
</div>
<div class="horizontal-rule mb-10 mt-10"></div>
@endforeach
@else
<div class="empty">
{{ __('customer::app.wishlist.empty') }}