Webkul copyright text, Search now working on product names only with a dedicated page for displaying results

This commit is contained in:
prashant-webkul 2018-10-29 14:51:59 +05:30
parent cd19e783e0
commit 1cd59b4b86
8 changed files with 101 additions and 55 deletions

View File

@ -1,9 +0,0 @@
<?php
namespace Webkul\Core\Models;
use Illuminate\Database\Eloquent\Model;
class Search extends Model
{
}

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\Core\Repositories;
namespace Webkul\Product\Repositories;
use Illuminate\Container\Container as App;
@ -46,6 +46,6 @@ class SearchRepository extends Repository
$products = $this->product->searchProductByAttribute($term);
dd($products);
return $products;
}
}

View File

@ -6,7 +6,7 @@ use Webkul\Shop\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Core\Repositories\SearchRepository as Search;
use Webkul\Product\Repositories\SearchRepository as Search;
/**
* Search controller
@ -31,15 +31,16 @@ use Webkul\Core\Repositories\SearchRepository as Search;
/**
* Index to handle the view loaded with the search results
*/
public function index() {
public function index()
{
$results = null;
$results = $this->search->search(request()->all());
if($results) {
return view($this->_config['view'])->with('results', $results);
return view($this->_config['view'])->with('products', $results);
} else {
return view($this->_config['view'])->with('results', null);
return view($this->_config['view'])->with('products', null);
}
}

View File

@ -316,6 +316,14 @@ input {
display: block;
width: 100%;
}
//no search results
.search-result-status {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
//main store front layouting
.main-container-wrapper {
@ -346,27 +354,6 @@ input {
grid-auto-rows: auto;
}
@media only screen and (max-width: 551px) {
.product-grid-3 {
grid-template-columns: 48.5% 48.5%;
grid-column-gap: 20px;
}
}
@media only screen and (max-width: 854px) {
.product-grid-4 {
grid-template-columns: 29.5% 29.5% 29.5%;
grid-column-gap: 35px;
}
}
@media only screen and (max-width: 653px) {
.product-grid-4 {
grid-template-columns: 48.5% 48.5%;
grid-column-gap: 17px;
}
}
.product-card {
position: relative;
@ -442,21 +429,6 @@ input {
}
}
@media only screen and (max-width: 425px) {
.product-card {
font-size: 90%;
.btn.btn-md {
padding: 5px;
}
}
.product-grid-4 {
grid-template-columns: 48.5% 48.5%;
grid-column-gap: 10px;
}
}
.product-list {
min-height: 200px;
@ -560,6 +532,42 @@ input {
}
}
}
//product components
@media only screen and (max-width: 551px) {
.product-grid-3 {
grid-template-columns: 48.5% 48.5%;
grid-column-gap: 20px;
}
}
@media only screen and (max-width: 854px) {
.product-grid-4 {
grid-template-columns: 29.5% 29.5% 29.5%;
grid-column-gap: 35px;
}
}
@media only screen and (max-width: 653px) {
.product-grid-4 {
grid-template-columns: 48.5% 48.5%;
grid-column-gap: 17px;
}
}
@media only screen and (max-width: 425px) {
.product-card {
font-size: 90%;
.btn.btn-md {
padding: 5px;
}
}
.product-grid-4 {
grid-template-columns: 48.5% 48.5%;
grid-column-gap: 10px;
}
}
//slider styles
section.slider-block {
@ -1158,7 +1166,7 @@ section.slider-block {
}
}
//footer responsive with out media query.
//footer
.footer {
background-color: $background-color;
padding-left: 10%;
@ -1242,6 +1250,19 @@ section.slider-block {
}
}
.footer-bottom {
margin-top: -16px;
width: 100%;
height: 120px;
font-size: 16px;
color: #A5A5A5;
letter-spacing: -0.26px;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
//category page
.main {
.category-container {

View File

@ -26,7 +26,9 @@ return [
'search' => [
'no-results' => 'No Results Found.',
'page-title' => 'Bagisto - Search'
'page-title' => 'Bagisto - Search',
'found-results' => 'Search Results Found',
'found-result' => 'Search Result Found'
],
'reviews' => [

View File

@ -70,4 +70,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@ -46,6 +46,11 @@
</div>
@include('shop::layouts.footer.footer')
<div class="footer-bottom">
<p>
© Copyright 2018 Webkul Software, All rights reserved.
</p>
</div>
</div>
<script type="text/javascript">

View File

@ -5,7 +5,33 @@
@endsection
@section('content-wrapper')
@if(!$results)
@if(!$products)
{{ __('shop::app.search.no-results') }}
@endif
<div class="main mb-30" style="min-height: 27vh;">
@if($products->isEmpty())
<div class="search-result-status">
<h2>{{ __('shop::app.products.whoops') }}</h2>
<span>{{ __('shop::app.search.no-results') }}</span>
</div>
@else
@if($products->count() == 1)
<div class="search-result-status mb-20">
<span><b>{{ $products->count() }} </b>{{ __('shop::app.search.found-result') }}</span>
</div>
@else
<div class="search-result-status mb-20">
<span><b>{{ $products->count() }} </b>{{ __('shop::app.search.found-results') }}</span>
</div>
@endif
{{-- @include ('shop::products.list.toolbar')
@inject ('toolbarHelper', 'Webkul\Product\Helpers\Toolbar') --}}
<div class="product-grid-4">
@foreach ($products as $product)
@include ('shop::products.list.card', ['product' => $product])
@endforeach
</div>
@endif
</div>
@endsection