This commit is contained in:
merdan 2022-04-06 13:52:55 +05:00
parent d9215d7220
commit cea1f4126c
36 changed files with 1936 additions and 3 deletions

View File

@ -110,7 +110,8 @@
"Sarga\\API\\": "packages/Sarga/API",
"Sarga\\Admin\\": "packages/Sarga/Admin/src",
"Sarga\\Brand\\": "packages/Sarga/Brand/src",
"Sarga\\Payment\\": "packages/Sarga/Payment"
"Sarga\\Payment\\": "packages/Sarga/Payment",
"Webkul\\suggestion\\": "packages/Webkul/suggestion/src"
}
},
"autoload-dev": {

View File

@ -289,7 +289,7 @@ return [
Sarga\Admin\Providers\AdminServiceProvider::class,
Sarga\Brand\Providers\BrandServiceProvider::class,
Sarga\Payment\Providers\PaymentServiceProvider::class,
Webkul\suggestion\Providers\suggestionServiceProvider::class,
],

View File

@ -15,7 +15,7 @@ return [
|
*/
'driver' => env('SCOUT_DRIVER', 'algolia'),
'driver' => env('SCOUT_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------

View File

@ -0,0 +1,21 @@
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"cross-env": "^6.0.3",
"laravel-mix": "^5.0.0",
"laravel-mix-merge-manifest": "^0.1.2",
"sass": "^1.24.4",
"sass-loader": "^8.0.2",
"vue": "^2.6.10",
"vue-template-compiler": "^2.6.11"
}
}

View File

@ -0,0 +1 @@
.temp-icon{width:48px;height:48px;display:inline-block;background-size:cover;background-image:url(../images/Icon-Temp.svg)}.active.temp-icon,.active .temp-icon{background-image:url(../images/Icon-Temp-Active.svg)}

View File

@ -0,0 +1 @@
.suggest{position:absolute;width:100%;z-index:1;background-color:#fff;font-size:15px;max-height:600px;overflow-y:auto}.dcategory,.popular,.terms{border:1px solid #d8d7d8}.dcategory p{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.dcategory p,.termsa{margin-top:1%;margin-bottom:1%;margin-left:1%}.termsb{text-align:right;margin-top:-9%;margin-bottom:1%;margin-right:1%}.popular p{margin-top:.8%;margin-bottom:.8%;margin-left:1%;text-align:center}.product{border:1px solid #d8d7d8;width:100%;box-sizing:border-box}.product .img{width:26%}.imgp,.product .img{display:inline-block}.imgp{width:70%;float:right}.image_name{margin-top:3%;margin-bottom:-4%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.no_result{border:1px solid #d8d7d8;background-color:#fff}.no_result p{margin-top:.8%;margin-bottom:.8%;margin-left:1%;text-align:center}.suggests{font-size:20px;height:500px!important;overflow-y:auto;position:absolute}.velocity_category{border:1px solid #d8d7d8;background-color:#fff;height:40px!important}.velocity_category p{margin-top:.5%;margin-bottom:.5%;margin-left:1%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.suggests .velocity_terms{border:1px solid #d8d7d8;background-color:#fff;height:40px!important}.velocity_termsa{margin-top:.5%}.ar_termsa,.velocity_termsa{margin-bottom:.5%;margin-left:1%}.ar_termsa{text-align:left;margin-top:-9%}.ar_termsb{text-align:right!important;margin-top:-9%;margin-bottom:.5%;margin-right:1%}.velocity_popular{border:1px solid #d8d7d8;background-color:#fff;height:40px!important}.velocity_popular p{margin-top:.8%;margin-bottom:.8%;margin-left:1%;text-align:center}.velocity_product{border:1px solid #d8d7d8;background-color:#fff;width:100%;height:90px!important;box-sizing:border-box}.velocity_img{width:26%;display:inline-block}.velocity_img_name{margin-top:1%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.velocity_no_result{border:1px solid #d8d7d8;background-color:#fff;height:40px!important}.velocity_no_result p{margin-top:.8%;margin-bottom:.8%;margin-left:1%;text-align:center}#searchs{width:100%}

View File

@ -0,0 +1,5 @@
@media only screen and (max-width: 1185px) {
.suggest {
width: 30%;
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="48px" height="48px" viewBox="0 0 48 48" 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-Catalog-Active</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Icon-Catalog-Active" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
<g transform="translate(9.000000, 7.000000)" stroke="#0041FF" stroke-width="2">
<rect id="Rectangle-2" x="0" y="0" width="30" height="34"></rect>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 699 B

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="48px" height="48px" viewBox="0 0 48 48" 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-Catalog</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Icon-Catalog" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
<g transform="translate(9.000000, 7.000000)" stroke-width="2">
<rect id="Rectangle-2" stroke="#8E8E8E" x="0" y="0" width="30" height="34"></rect>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 685 B

View File

@ -0,0 +1 @@
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=0)}({0:function(e,t,n){n("uPOf"),n("y62a"),n("jTz4"),e.exports=n("WyvX")},WyvX:function(e,t){},jTz4:function(e,t){},uPOf:function(e,t){},y62a:function(e,t){}});

View File

@ -0,0 +1,3 @@
{
"/css/suggestion.css": "/css/suggestion.css?id=e4193aef15a2f96d4f46"
}

View File

@ -0,0 +1,10 @@
<?php
return [
[
'key' => 'suggestion',
'name' => 'Suggestion',
'route' => 'suggestion.admin.index',
'sort' => 2
]
];

View File

@ -0,0 +1,49 @@
<?php
return [
[
'key'=>'suggestion',
'name'=>'Search Suggestion',
'sort'=>1,
],[
'key'=>'suggestion.suggestion',
'name'=>'Search Suggestion Settings',
'sort'=>1,
],[
'key' => 'suggestion.suggestion.options',
'name' => 'Options',
'sort' => 1,
'fields' => [
['name' => 'show_terms',
'title' => 'Show Categories',
'type' => 'text',
'validation' => 'required|numeric',
'channel_based' => true,
],['name' => 'show_products',
'title' => 'Show Products ',
'type' => 'text',
'validation' => 'required|numeric',
'channel_based' => true,
],[
'name' => 'display_terms_toggle',
'title' => 'Display Terms',
'type' => 'boolean',
'locale_based' => true,
'channel_based' => true,
],[
'name' => 'display_product_toggle',
'title' => 'Display Product',
'type' => 'boolean',
'locale_based' => true,
'channel_based' => true,
],[
'name' => 'display_categories_toggle',
'title' => 'Display Categories',
'type' => 'boolean',
'locale_based' => true,
'channel_based' => true,
],
],
],
];

View File

@ -0,0 +1,66 @@
<?php
namespace Webkul\suggestion\Http\Controllers\Admin;
use Illuminate\Routing\Controller;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class suggestionController extends Controller
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
/**
* Contains route related configuration
*
* @var array
*/
protected $_config;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('admin');
$this->_config = request('_config');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\View\View
*/
public function index()
{
return view($this->_config['view']);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\View\View
*/
public function create()
{
return view($this->_config['view']);
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\View\View
*/
public function edit($id)
{
return view($this->_config['view']);
}
}

View File

@ -0,0 +1,78 @@
<?php
namespace Webkul\suggestion\Http\Controllers\Shop;
use Webkul\Velocity\Repositories\Product\ProductRepository as VelocityProductRepository;
use Webkul\Core\Eloquent\Repository;
use Illuminate\Routing\Controller;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Webkul\Product\Type\Configurable;
class suggestionController extends Controller
{
use DispatchesJobs, ValidatesRequests;
// protected $image_helper;
protected $configurables;
/**
* Contains route related configuration
*
* @var array
*/
protected $_config;
/**
* ProductRepository object of velocity package
*
* @var \Webkul\Velocity\Repositories\Product\ProductRepository
*/
protected $velocityProductRepository;
/**
* Create a new controller instance.
*
* @return void
*/
/**
* Index to handle the view loaded with the search results
*
* @return \Illuminate\View\View
*/
public function __construct(
VelocityProductRepository $velocityProductRepository,
Configurable $configurables
)
{
$this->_config = request('_config');
$this->velocityProductRepository = $velocityProductRepository;
$this->configurables = $configurables;
}
public function search()
{
$results = $this->velocityProductRepository->searchProductsFromCategory(request()->all());
$images=[];
$price=[];
foreach($results as $key => $result){
$productcategories[$key]=$result->product->categories;
$price[$key] = $result->getTypeInstance()->getPriceHtml();
$images[$key] = productimage()->getGalleryImages($result->product);
}
return [$results,$price,$images];
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\View\View
*/
public function index()
{
return view($this->_config['view']);
}
}

View File

@ -0,0 +1,9 @@
<?php
Route::group(['middleware' => ['web', 'admin']], function () {
Route::get('/admin/suggestion', 'Webkul\suggestion\Http\Controllers\Admin\suggestionController@index')->defaults('_config', [
'view' => 'suggestion::admin.index',
])->name('suggestion.admin.index');
});

View File

@ -0,0 +1,12 @@
<?php
Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function () {
Route::get('/suggestion', 'Webkul\suggestion\Http\Controllers\Shop\suggestionController@index')->defaults('_config', [
'view' => 'suggestion::shop.index',
])->name('suggestion.shop.index');
Route::get('/ajaxsearch', 'Webkul\suggestion\Http\Controllers\Shop\suggestionController@search')
->name('searchsuggestion.search.index');
});

View File

@ -0,0 +1,11 @@
<?php
namespace Webkul\suggestion\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
{
protected $models = [
];
}

View File

@ -0,0 +1,76 @@
<?php
namespace Webkul\suggestion\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Event;
class suggestionServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->loadRoutesFrom(__DIR__ . '/../Http/admin-routes.php');
$this->loadRoutesFrom(__DIR__ . '/../Http/shop-routes.php');
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'suggestion');
$this->publishes([
__DIR__ . '/../../publishable/assets' => public_path('themes/default/assets'),
], 'public');
$this->publishes([
__DIR__ . '/../Resources/views/shop/velocity/header/index.blade.php' => resource_path('themes/velocity/views/layouts/header/index.blade.php'),
]);
$this->publishes([
__DIR__ . '/../Resources/views/shop/default/header/index.blade.php' => resource_path('themes/default/views/layouts/header/index.blade.php'),
]);
$this->publishes([
__DIR__ . '/../Resources/views/shop/velocity/header/particals.blade.php' => resource_path('themes/velocity/views/UI/particals.blade.php'),
]);
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'suggestion');
Event::listen('bagisto.shop.layout.head', function($viewRenderEventManager) {
$viewRenderEventManager->addTemplate('suggestion::shop.layouts.style');
});
}
/**
* Register services.
*
* @return void
*/
public function register()
{
$this->registerConfig();
}
/**
* Register package config.
*
* @return void
*/
protected function registerConfig()
{
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/acl.php', 'acl'
);
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/system.php', 'core'
);
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="48px" height="48px" viewBox="0 0 48 48" 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-Catalog-Active</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Icon-Catalog-Active" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
<g transform="translate(9.000000, 7.000000)" stroke="#0041FF" stroke-width="2">
<rect id="Rectangle-2" x="0" y="0" width="30" height="34"></rect>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 699 B

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="48px" height="48px" viewBox="0 0 48 48" 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-Catalog</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Icon-Catalog" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
<g transform="translate(9.000000, 7.000000)" stroke-width="2">
<rect id="Rectangle-2" stroke="#8E8E8E" x="0" y="0" width="30" height="34"></rect>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 685 B

View File

@ -0,0 +1,17 @@
.temp-icon {
width: 48px;
height: 48px;
display: inline-block;
background-size: cover;
background-image: url("../images/Icon-Temp.svg");
}
.active {
.temp-icon {
background-image: url("../images/Icon-Temp-Active.svg");
}
&.temp-icon {
background-image: url("../images/Icon-Temp-Active.svg");
}
}

View File

@ -0,0 +1,151 @@
.suggest{
position:absolute;
width:100%;
z-index:1;
background-color:white;
font-size:15px;
max-height:600px;
overflow-y:auto;
}
.dcategory,.terms,.popular{
border:1px solid #d8d7d8;
}
.dcategory p{
margin-top:1%;
margin-bottom:1%;
margin-left:1%;
white-space:nowrap;
text-overflow:ellipsis;
overflow: hidden;
}
.termsa{
margin-top:1%;
margin-bottom:1%;
margin-left:1%;
}
.termsb{
text-align:right;
margin-top:-9%;
margin-bottom:1%;
margin-right:1%;
}
.popular p{
margin-top:0.8%;
margin-bottom:0.8%;
margin-left:1%;
text-align:center;
}
.product{
border:1px solid #d8d7d8;
width:100%;
box-sizing:border-box;
}
.product .img{
width:26%;
display:inline-block;
}
.imgp{
width:70%;
float:right;
display:inline-block;
}
.image_name{
margin-top:3%;
margin-bottom:-4%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.no_result{
border:1px solid #d8d7d8;
background-color:white;
}
.no_result p{
margin-top:0.8%;
margin-bottom:0.8%;
margin-left:1%;
text-align:center;
}
.suggests{
font-size:20px;
height:500px !important;
overflow-y:auto;
position: absolute;
}
.velocity_category{
border:1px solid #d8d7d8;
background-color:white;
height:40px !important;
}
.velocity_category p{
margin-top:0.5%;
margin-bottom:0.5%;
margin-left:1%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.suggests .velocity_terms{
border:1px solid #d8d7d8;
background-color:white;
height:40px !important;
}
.velocity_termsa{
margin-top:0.5%;
margin-bottom:0.5%;
margin-left:1%;
}
.ar_termsa{
text-align:left;
margin-top:-9%;
margin-bottom:0.5%;
margin-left:1%;
}
.ar_termsb{
text-align:right !important;
margin-top:-9%;
margin-bottom:0.5%;
margin-right:1%;
}
.velocity_popular{
border:1px solid #d8d7d8;
background-color:white;
height:40px !important;
}
.velocity_popular p{
margin-top:0.8%;
margin-bottom:0.8%;
margin-left:1%;
text-align:center;
}
.velocity_product{
border:1px solid #d8d7d8;
background-color:white;
width:100%;
height:90px !important;
box-sizing:border-box;
}
.velocity_img{
width:26%;
display:inline-block;
}
.velocity_img_name{
margin-top:1%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.velocity_no_result{
border:1px solid #d8d7d8;
background-color:white;
height:40px !important;
}
.velocity_no_result p{
margin-top:0.8%;
margin-bottom:0.8%;
margin-left:1%;
text-align:center;
}
#searchs {
width:100%;
}

View File

@ -0,0 +1,5 @@
@media only screen and (max-width: 1185px) {
.suggest{
width:30%;
}
}

View File

@ -0,0 +1,9 @@
<?php
return [
'popular_products' => 'Popular products',
'in' =>'in',
'no_results' => 'No Results Found',
'starting_from' => 'Starting from',
]
?>

View File

@ -0,0 +1,603 @@
<?php
$term = request()->input('term');
$image_search = request()->input('image-search');
if (! is_null($term)) {
$serachQuery = 'term='.request()->input('term');
}
?>
<div class="header" id="header">
<div class="header-top">
<div class="left-content">
<ul class="logo-container">
<li>
<a href="{{ route('shop.home.index') }}" aria-label="Logo">
@if ($logo = core()->getCurrentChannel()->logo_url)
<img class="logo" src="{{ $logo }}" alt="" />
@else
<img class="logo" src="{{ bagisto_asset('images/logo.svg') }}" alt="" />
@endif
</a>
</li>
</ul>
<div class="newsearch" style="position:relative;">
<ul class="search-container">
<li class="search-group">
<form role="search" action="{{ route('shop.search.index') }}" method="GET" style="display: inherit;">
<label for="search-bar" style="position: absolute; z-index: -1;">Search</label>
<input
required
name="term"
type="search"
@keyup="someFunctionRun($event)"
value="{{ ! $image_search ? $term : '' }}"
class="search-field"
id="search-bar"
placeholder="{{ __('shop::app.header.search-text') }}"
>
<image-search-component></image-search-component>
<div class="search-icon-wrapper">
<button class="" class="background: none;" aria-label="Search">
<i class="icon icon-search"></i>
</button>
</div>
</form>
</li>
</ul>
<div id="old-new" class="suggest"> </div>
</div>
</div>
<div class="right-content">
<span class="search-box"><span class="icon icon-search" id="search"></span></span>
<ul class="right-content-menu">
{!! view_render_event('bagisto.shop.layout.header.comppare-item.before') !!}
@php
$showCompare = core()->getConfigData('general.content.shop.compare_option') == "1" ? true : false
@endphp
@if ($showCompare)
<li class="compare-dropdown-container">
<a
@auth('customer')
href="{{ route('velocity.customer.product.compare') }}"
@endauth
@guest('customer')
href="{{ route('velocity.product.compare') }}"
@endguest
style="color: #242424;"
>
<i class="icon compare-icon"></i>
<span class="name">
{{ __('shop::app.customer.compare.text') }}
<span class="count">(<span id="compare-items-count"></span>)<span class="count">
</span>
</a>
</li>
@endif
{!! view_render_event('bagisto.shop.layout.header.compare-item.after') !!}
{!! view_render_event('bagisto.shop.layout.header.currency-item.before') !!}
@if (core()->getCurrentChannel()->currencies->count() > 1)
<li class="currency-switcher">
<span class="dropdown-toggle">
{{ core()->getCurrentCurrencyCode() }}
<i class="icon arrow-down-icon"></i>
</span>
<ul class="dropdown-list currency">
@foreach (core()->getCurrentChannel()->currencies as $currency)
<li>
@if (isset($serachQuery))
<a href="?{{ $serachQuery }}&currency={{ $currency->code }}">{{ $currency->code }}</a>
@else
<a href="?currency={{ $currency->code }}">{{ $currency->code }}</a>
@endif
</li>
@endforeach
</ul>
</li>
@endif
{!! view_render_event('bagisto.shop.layout.header.currency-item.after') !!}
{!! view_render_event('bagisto.shop.layout.header.account-item.before') !!}
<li>
<span class="dropdown-toggle">
<i class="icon account-icon"></i>
<span class="name">{{ __('shop::app.header.account') }}</span>
<i class="icon arrow-down-icon"></i>
</span>
@guest('customer')
<ul class="dropdown-list account guest">
<li>
<div>
<label style="color: #9e9e9e; font-weight: 700; text-transform: uppercase; font-size: 15px;">
{{ __('shop::app.header.title') }}
</label>
</div>
<div style="margin-top: 5px;">
<span style="font-size: 12px;">{{ __('shop::app.header.dropdown-text') }}</span>
</div>
<div style="margin-top: 15px;">
<a class="btn btn-primary btn-md" href="{{ route('customer.session.index') }}" style="color: #ffffff">
{{ __('shop::app.header.sign-in') }}
</a>
<a class="btn btn-primary btn-md" href="{{ route('customer.register.index') }}" style="float: right; color: #ffffff">
{{ __('shop::app.header.sign-up') }}
</a>
</div>
</li>
</ul>
@endguest
@auth('customer')
@php
$showWishlist = core()->getConfigData('general.content.shop.wishlist_option') == "1" ? true : false;
@endphp
<ul class="dropdown-list account customer">
<li>
<div>
<label style="color: #9e9e9e; font-weight: 700; text-transform: uppercase; font-size: 15px;">
{{ auth()->guard('customer')->user()->first_name }}
</label>
</div>
<ul>
<li>
<a href="{{ route('customer.profile.index') }}">{{ __('shop::app.header.profile') }}</a>
</li>
@if ($showWishlist)
<li>
<a href="{{ route('customer.wishlist.index') }}">{{ __('shop::app.header.wishlist') }}</a>
</li>
@endif
<li>
<a href="{{ route('shop.checkout.cart.index') }}">{{ __('shop::app.header.cart') }}</a>
</li>
<li>
<a href="{{ route('customer.session.destroy') }}">{{ __('shop::app.header.logout') }}</a>
</li>
</ul>
</li>
</ul>
@endauth
</li>
{!! view_render_event('bagisto.shop.layout.header.account-item.after') !!}
{!! view_render_event('bagisto.shop.layout.header.cart-item.before') !!}
<li class="cart-dropdown-container">
@include('shop::checkout.cart.mini-cart')
</li>
{!! view_render_event('bagisto.shop.layout.header.cart-item.after') !!}
</ul>
<span class="menu-box" ><span class="icon icon-menu" id="hammenu"></span>
</div>
</div>
<div class="header-bottom" id="header-bottom">
@include('shop::layouts.header.nav-menu.navmenu')
</div>
<div class="search-responsive mt-10" id="search-responsive">
<form role="search" action="{{ route('shop.search.index') }}" method="GET" style="display: inherit;">
<div class="search-content">
<button style="background: none; border: none; padding: 0px;">
<i class="icon icon-search"></i>
</button>
<image-search-component></image-search-component>
<input type="search" name="term" @keyup="someFunctionRun($event)" class="search">
<i class="icon icon-menu-back right"></i>
</div>
<div id="old-ne" class="suggest" style="
width:100%;
z-index:1;
background-color:white;
font-size:15px;
max-height:600px;
overflow-y:auto;
">
</div>
</form>
</div>
</div>
@push('scripts')
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs" defer></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/mobilenet" defer></script>
<script type="text/x-template" id="image-search-component-template">
<div v-if="image_search_status">
<label class="image-search-container" :for="'image-search-container-' + _uid">
<i class="icon camera-icon"></i>
<input type="file" :id="'image-search-container-' + _uid" ref="image_search_input" v-on:change="uploadImage()"/>
<img :id="'uploaded-image-url-' + + _uid" :src="uploaded_image_url" alt="" width="20" height="20" />
</label>
</div>
</script>
<script>
Vue.component('image-search-component', {
template: '#image-search-component-template',
data: function() {
return {
uploaded_image_url: '',
image_search_status: "{{core()->getConfigData('general.content.shop.image_search') == '1' ? 'true' : 'false'}}" == 'true'
}
},
methods: {
uploadImage: function() {
var imageInput = this.$refs.image_search_input;
if (imageInput.files && imageInput.files[0]) {
if (imageInput.files[0].type.includes('image/')) {
var self = this;
if (imageInput.files[0].size <= 2000000) {
self.$root.showLoader();
var formData = new FormData();
formData.append('image', imageInput.files[0]);
axios.post("{{ route('shop.image.search.upload') }}", formData, {headers: {'Content-Type': 'multipart/form-data'}})
.then(function(response) {
self.uploaded_image_url = response.data;
var net;
async function app() {
var analysedResult = [];
var queryString = '';
net = await mobilenet.load();
const imgElement = document.getElementById('uploaded-image-url-' + + self._uid);
try {
const result = await net.classify(imgElement);
result.forEach(function(value) {
queryString = value.className.split(',');
if (queryString.length > 1) {
analysedResult = analysedResult.concat(queryString)
} else {
analysedResult.push(queryString[0])
}
});
} catch (error) {
self.$root.hideLoader();
window.flashMessages = [
{
'type': 'alert-error',
'message': "{{ __('shop::app.common.error') }}"
}
];
self.$root.addFlashMessages();
};
localStorage.searched_image_url = self.uploaded_image_url;
queryString = localStorage.searched_terms = analysedResult.join('_');
self.$root.hideLoader();
window.location.href = "{{ route('shop.search.index') }}" + '?term=' + queryString + '&image-search=1';
}
app();
})
.catch(function(error) {
self.$root.hideLoader();
window.flashMessages = [
{
'type': 'alert-error',
'message': "{{ __('shop::app.common.error') }}"
}
];
self.$root.addFlashMessages();
});
} else {
imageInput.value = '';
window.flashMessages = [
{
'type': 'alert-error',
'message': "{{ __('shop::app.common.image-upload-limit') }}"
}
];
self.$root.addFlashMessages();
}
} else {
imageInput.value = '';
alert('Only images (.jpeg, .jpg, .png, ..) are allowed.');
}
}
}
}
});
</script>
<script>
$(document).ready(function() {
$('body').delegate('#search, .icon-menu-close, .icon.icon-menu', 'click', function(e) {
toggleDropdown(e);
});
@auth('customer')
@php
$compareCount = app('Webkul\Velocity\Repositories\VelocityCustomerCompareProductRepository')
->count([
'customer_id' => auth()->guard('customer')->user()->id,
]);
@endphp
let comparedItems = JSON.parse(localStorage.getItem('compared_product'));
$('#compare-items-count').html({{ $compareCount }});
@endauth
@guest('customer')
let comparedItems = JSON.parse(localStorage.getItem('compared_product'));
$('#compare-items-count').html(comparedItems ? comparedItems.length : 0);
@endguest
function toggleDropdown(e) {
var currentElement = $(e.currentTarget);
if (currentElement.hasClass('icon-search')) {
currentElement.removeClass('icon-search');
currentElement.addClass('icon-menu-close');
$('#hammenu').removeClass('icon-menu-close');
$('#hammenu').addClass('icon-menu');
$("#search-responsive").css("display", "block");
$("#header-bottom").css("display", "none");
} else if (currentElement.hasClass('icon-menu')) {
currentElement.removeClass('icon-menu');
currentElement.addClass('icon-menu-close');
$('#search').removeClass('icon-menu-close');
$('#search').addClass('icon-search');
$("#search-responsive").css("display", "none");
$("#header-bottom").css("display", "block");
} else {
currentElement.removeClass('icon-menu-close');
$("#search-responsive").css("display", "none");
$("#header-bottom").css("display", "none");
if (currentElement.attr("id") == 'search') {
currentElement.addClass('icon-search');
} else {
currentElement.addClass('icon-menu');
}
}
}
});
</script>
@endpush
@push('scripts')
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
var url = window.location.toString();
if(url.match(/%3Cb%3E/gi) == '%3Cb%3E'){
var urla = url.replace('%3Cb%3E','');
window.location = urla.replace('%3C/b%3E','');
}
function someFunctionRun(event){
var display_product_toggle= '<?php $hello= core()->getConfigData('suggestion.suggestion.options.display_product_toggle');
echo $hello ?>';
var no_of_terms = '<?php $hello= core()->getConfigData('suggestion.suggestion.options.show_terms');
echo $hello ?>';
var display_terms_toggle ='<?php $hello= core()->getConfigData('suggestion.suggestion.options.display_terms_toggle');
echo $hello ?>';
var no_of_products ='<?php $hello= core()->getConfigData('suggestion.suggestion.options.show_products');
echo $hello ?>';
var display_terms_number_toggle ='<?php $hello= core()->getConfigData('suggestion.suggestion.options.display_terms_number_toggle');
echo $hello ?>';
var display_category='<?php $hello= core()->getConfigData('suggestion.suggestion.options.display_categories_toggle');
echo $hello ?>';
var term =event.target.value;
var obj={
category:'',
term:term
};
$.ajax({
url:"{{ route('searchsuggestion.search.index') }}",
type:"get",
data:obj,
success:function(data){
$('.suggest').html('');
if(term.length !== 0){
if(data[0].data.length !== 0){
if(display_category == 1){
if(data[0].data.length < no_of_terms){
for (let index = 0; index < data[0].data.length; index++){
if(data[0].data[index].product.categories[0]){
if(data[0].data[index].product.categories[0].name == 'Root'){
$('.suggest').append('<a style="color:black;text-decoration:none;"'+
'href="'+ data[0].data[index].url_key+'"> <div class="dcategory">'+
'<p>'+data[0].data[index].name+'</p>'+
'</div></a>');
}else{
$('.suggest').append('<a style="color:black;text-decoration:none;"'+
'href="'+ data[0].data[index].url_key+'"> <div class="dcategory">'+
'<p>'+data[0].data[index].name+' in '+data[0].data[index].product.categories[0].name+'</p>'+
'</div></a>');
}
}else{
$('.suggest').append('<a style="color:black;text-decoration:none;"'+
'href="'+ data[0].data[index].url_key+'"> <div class="dcategory">'+
'<p>'+data[0].data[index].name+'</p>'+
'</div></a>');
}
}
}else if (data[0].data.length >= no_of_terms) {
for (let index = 0; index < no_of_terms; index++){
if(data[0].data[index].product.categories[0]){
if(data[0].data[index].product.categories[0].name == 'Root'){
$('.suggest').append('<a style="color:black;text-decoration:none;"'+
'href="'+ data[0].data[index].url_key+'"> <div class="dcategory">'+
'<p>'+data[0].data[index].name+'</p>'+
'</div></a>');
}else{
$('.suggest').append('<a style="color:black;text-decoration:none;"'+
'href="'+ data[0].data[index].url_key+'"> <div class="dcategory">'+
'<p>'+data[0].data[index].name+' in '+data[0].data[index].product.categories[0].name+'</p>'+
'</div></a>');
}
}else{
$('.suggest').append('<a style="color:black;text-decoration:none;"'+
'href="'+ data[0].data[index].url_key+'"> <div class="dcategory">'+
'<p>'+data[0].data[index].name+'</p>'+
'</div></a>');
}
}
}
}
if(display_terms_toggle == 1){
$('.suggest').append('<a style="color:black;text-decoration:none;"'+
'href="categorysearch?category=&term='+term+'"><div class="terms">'+
'<p class="termsa">'+term+'</p>'+
'<p class="termsb">'+data[0].data.length+'</p>'+
'</div></a>');
}
if(display_product_toggle == 1){
$('.suggest').append('<div class="popular">'+
'<p>{{ __('suggestion::app.popular_products') }}</p>'+
'</div>');
if (data[0].data.length < no_of_products) {
for(let index = 0; index < data[0].data.length; index++) {
$('.suggest').append('<a style="color:black;text-decoration:none;"'+
'href="'+ data[0].data[index].url_key+'">'+
'<div class="product">'+
'<div class="img">'+
'<img style="'+
'width:100%;'+
'" src="'+data[2][index][0].small_image_url+'" >'+
'</div>'+
'<div class="imgp">'+
'<p class="image_name">'+data[0].data[index].name+'</p>'+
'<p>'+data[1][index]+'</p>'+
'</div></div></a>');
}
}else if(data[0].data.length >= no_of_products){
for (let index = 0; index < no_of_products; index++) {
$('.suggest').append('<a style="color:black;text-decoration:none;"'+
'href="'+ data[0].data[index].url_key+'">'+
'<div class="product">'+
'<div class="img">'+
'<img style="'+
'width:100%;'+
'" src="'+data[2][index][0].small_image_url+'" >'+
'</div>'+
'<div class="imgp">'+
'<p class="image_name">'+data[0].data[index].name+'</p>'+
'<p>'+data[1][index]+'</p>'+
'</div></div></a>');
}
}
}
var search = event.target.value;
var n = search.length;
if(n >= 2){
var str = document.getElementById("old-new").innerHTML;
var search = document.querySelector('input[type="search"]').value;
var regex = new RegExp(search, 'g');
var result = str.replace(regex, '<b>' + search + '</b>');
document.getElementById("old-new").innerHTML = result;
}
}else{
$('.suggest').append('<div class="no_result">'+
'<p>{{ __('suggestion::app.no_results') }}</p>'+
'</div>');
}
}
}
});
}
</script>
<script>
$(document).ready(function(){
$(document).mouseup(function(e){
var container = $('input[type="search"]');
var scroll_bar = $(".suggest");
if(!scroll_bar.is(e.target) && !container.is(e.target) && container.has(e.target).length === 0){
$('.suggest').hide();
}else{
$('.suggest').show();
}
});
$('.search').on('keyup', () => {
var search = document.querySelector('.search').value;
var n = search.length;
if(n >= 2){
setTimeout(time,400);
function time(){
var str = document.getElementById("old-ne").innerHTML;
var search = document.querySelector('.search').value;
var regex = new RegExp(search, 'g');
var result = str.replace(regex, '<b>' + search + '</b>');
document.getElementById("old-ne").innerHTML = result;
}
}
});
});
</script>
@endpush

View File

@ -0,0 +1,13 @@
@extends('shop::layouts.master')
@section('page_title')
Package Suggestion
@stop
@section('content-wrapper')
<div class="main">
Package Suggestion
</div>
@stop

View File

@ -0,0 +1 @@
<link href="{{ asset('themes/default/assets/css/suggestion.css') }}" rel="stylesheet">

View File

@ -0,0 +1,39 @@
<header class="sticky-header">
<div class="row remove-padding-margin velocity-divide-page">
<logo-component add-class="navbar-brand"></logo-component>
<searchbar-component></searchbar-component>
</div>
</header>
@push('scripts')
<script type="text/javascript">
(() => {
document.addEventListener('scroll', e => {
scrollPosition = Math.round(window.scrollY);
if (scrollPosition > 50){
document.querySelector('header').classList.add('header-shadow');
} else {
document.querySelector('header').classList.remove('header-shadow');
}
});
})()
</script>
@endpush
@push('scripts')
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(document).mouseup(function(e){
var container = $(".form-control");
if(!container.is(e.target) && container.has(e.target).length === 0){
$('.suggests').hide();
}else{
$('.suggests').show();
}
});
});
</script>
@endpush

View File

@ -0,0 +1,659 @@
@push('scripts')
<script type="text/x-template" id="cart-btn-template">
<button
type="button"
id="mini-cart"
@click="toggleMiniCart"
:class="`btn btn-link disable-box-shadow ${itemCount == 0 ? 'cursor-not-allowed' : ''}`">
<div class="mini-cart-content">
<i class="material-icons-outlined text-down-3">shopping_cart</i>
<span class="badge" v-text="itemCount" v-if="itemCount != 0"></span>
<span class="fs18 fw6 cart-text">{{ __('velocity::app.minicart.cart') }}</span>
</div>
<div class="down-arrow-container">
<span class="rango-arrow-down"></span>
</div>
</button>
</script>
<script type="text/x-template" id="close-btn-template">
<button type="button" class="close disable-box-shadow">
<span class="white-text fs20" @click="togglePopup">×</span>
</button>
</script>
<script type="text/x-template" id="quantity-changer-template">
<div :class="`quantity control-group ${errors.has(controlName) ? 'has-error' : ''}`">
<label class="required" for="quantity-changer">{{ __('shop::app.products.quantity') }}</label>
<button type="button" class="decrease" @click="decreaseQty()">-</button>
<input
:value="qty"
class="control"
:name="controlName"
:v-validate="validations"
id="quantity-changer"
data-vv-as="&quot;{{ __('shop::app.products.quantity') }}&quot;"
readonly />
<button type="button" class="increase" @click="increaseQty()">+</button>
<span class="control-error" v-if="errors.has(controlName)">@{{ errors.first(controlName) }}</span>
</div>
</script>
@endpush
@include('velocity::UI.header')
@push('scripts')
<script type="text/x-template" id="logo-template">
<a
:class="`left ${addClass}`"
href="{{ route('shop.home.index') }}"
aria-label="Logo">
@if ($logo = core()->getCurrentChannel()->logo_url)
<img class="logo" src="{{ $logo }}" alt="" width="200" height="50" />
@else
<img class="logo" src="{{ asset('themes/velocity/assets/images/logo-text.png') }}" alt="" width="200" height="50" />
@endif
</a>
</script>
<script type="text/x-template" id="searchbar-template">
<div class="right searchbar">
<div class="row">
<div class="col-lg-5 col-md-12">
<div class="input-group">
<form
method="GET"
role="search"
id="search-form"
action="{{ route('velocity.search.index') }}">
<div style="position:relative;">
<div
class="btn-toolbar full-width"
role="toolbar">
<div class="btn-group full-width force-center" >
<div class="selectdiv">
<select class="form-control fs13 styled-select" name="category" @change="focusInput($event)" aria-label="Category">
<option value="">
{{ __('velocity::app.header.all-categories') }}
</option>
<template v-for="(category, index) in $root.sharedRootCategories">
<option
:key="index"
selected="selected"
:value="category.id"
v-if="(category.id == searchedQuery.category)">
@{{ category.name }}
</option>
<option :key="index" :value="category.id" v-else>
@{{ category.name }}
</option>
</template>
</select>
<div class="select-icon-container d-inline-block float-right">
<span class="select-icon rango-arrow-down"></span>
</div>
</div>
<input
required
id ="searchs"
name="term"
type="search"
@keyup="someFunctionRun($event)"
class="form-control"
placeholder="{{ __('velocity::app.header.search-text') }}"
aria-label="Search"
v-model:value="inputVal" />
<image-search-component></image-search-component>
<button class="btn" type="button" id="header-search-icon" aria-label="Search" @click="submitForm">
<i class="fs16 fw6 rango-search"></i>
</button>
</div>
</div>
<div id="old-new" class="suggests full-width"> </div>
</div>
</form>
</div>
</div>
<div class="col-lg-7 col-md-12 vc-full-screen">
<div class="left-wrapper">
@php
$showWishlist = core()->getConfigData('general.content.shop.wishlist_option') == "1" ? true : false;
$showCompare = core()->getConfigData('general.content.shop.compare_option') == "1" ? true : false;
@endphp
{!! view_render_event('bagisto.shop.layout.header.wishlist.before') !!}
@if($showWishlist)
<a class="wishlist-btn unset" :href="`{{ route('customer.wishlist.index') }}`">
<i class="material-icons">favorite_border</i>
<div class="badge-container" v-if="wishlistCount > 0">
<span class="badge" v-text="wishlistCount"></span>
</div>
<span>{{ __('shop::app.layouts.wishlist') }}</span>
</a>
@endif
{!! view_render_event('bagisto.shop.layout.header.wishlist.after') !!}
{!! view_render_event('bagisto.shop.layout.header.compare.before') !!}
@if ($showCompare)
<a
class="compare-btn unset"
@auth('customer')
href="{{ route('velocity.customer.product.compare') }}"
@endauth
@guest('customer')
href="{{ route('velocity.product.compare') }}"
@endguest
>
<i class="material-icons">compare_arrows</i>
<div class="badge-container" v-if="compareCount > 0">
<span class="badge" v-text="compareCount"></span>
</div>
<span>{{ __('velocity::app.customer.compare.text') }}</span>
</a>
@endif
{!! view_render_event('bagisto.shop.layout.header.compare.after') !!}
{!! view_render_event('bagisto.shop.layout.header.cart-item.before') !!}
@include('shop::checkout.cart.mini-cart')
{!! view_render_event('bagisto.shop.layout.header.cart-item.after') !!}
</div>
</div>
</div>
</div>
</script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/mobilenet"></script>
<script type="text/x-template" id="image-search-component-template">
<div class="d-inline-block image-search-container" v-if="image_search_status">
<label for="image-search-container">
<i class="icon camera-icon"></i>
<input
type="file"
class="d-none"
ref="image_search_input"
id="image-search-container"
v-on:change="uploadImage()" />
<img
class="d-none"
id="uploaded-image-url"
:src="uploadedImageUrl" alt="" width="20" height="20" />
</label>
</div>
</script>
<script>
var url = window.location.toString();
if(url.match(/%3Cb%3E/gi) == '%3Cb%3E'){
var urla = url.replace('%3Cb%3E','');
window.location = urla.replace('%3C/b%3E','');
}
</script>
<script type="text/javascript">
(() => {
Vue.component('cart-btn', {
template: '#cart-btn-template',
props: ['itemCount'],
methods: {
toggleMiniCart: function () {
let modal = $('#cart-modal-content')[0];
if (modal)
modal.classList.toggle('hide');
let accountModal = $('.account-modal')[0];
if (accountModal)
accountModal.classList.add('hide');
event.stopPropagation();
}
}
});
Vue.component('close-btn', {
template: '#close-btn-template',
methods: {
togglePopup: function () {
$('#cart-modal-content').hide();
}
}
});
Vue.component('quantity-changer', {
template: '#quantity-changer-template',
inject: ['$validator'],
props: {
controlName: {
type: String,
default: 'quantity'
},
quantity: {
type: [Number, String],
default: 1
},
minQuantity: {
type: [Number, String],
default: 1
},
validations: {
type: String,
default: 'required|numeric|min_value:1'
}
},
data: function() {
return {
qty: this.quantity
}
},
watch: {
quantity: function (val) {
this.qty = val;
this.$emit('onQtyUpdated', this.qty)
}
},
methods: {
decreaseQty: function() {
if (this.qty > this.minQuantity)
this.qty = parseInt(this.qty) - 1;
this.$emit('onQtyUpdated', this.qty)
},
increaseQty: function() {
this.qty = parseInt(this.qty) + 1;
this.$emit('onQtyUpdated', this.qty)
}
}
});
Vue.component('logo-component', {
template: '#logo-template',
props: ['addClass'],
});
Vue.component('searchbar-component', {
template: '#searchbar-template',
data: function () {
return {
inputVal: '',
compareCount: 0,
wishlistCount: 0,
searchedQuery: [],
isCustomer: '{{ auth()->guard('customer')->user() ? "true" : "false" }}' == "true",
}
},
watch: {
'$root.headerItemsCount': function () {
this.updateHeaderItemsCount();
}
},
created: function () {
let searchedItem = window.location.search.replace("?", "");
searchedItem = searchedItem.split('&');
let updatedSearchedCollection = {};
searchedItem.forEach(item => {
let splitedItem = item.split('=');
updatedSearchedCollection[splitedItem[0]] = decodeURI(splitedItem[1]);
});
if (updatedSearchedCollection['image-search'] == 1) {
updatedSearchedCollection.term = '';
}
this.searchedQuery = updatedSearchedCollection;
if (this.searchedQuery.term) {
this.inputVal = decodeURIComponent(this.searchedQuery.term.split('+').join(' '));
}
this.updateHeaderItemsCount();
},
methods: {
'someFunctionRun': function(event) {
var display_product_toggle= '<?php $hello= core()->getConfigData('suggestion.suggestion.options.display_product_toggle');
echo $hello ?>';
var no_of_terms = '<?php $hello= core()->getConfigData('suggestion.suggestion.options.show_terms');
echo $hello ?>';
var display_terms_toggle ='<?php $hello= core()->getConfigData('suggestion.suggestion.options.display_terms_toggle');
echo $hello ?>';
var no_of_products ='<?php $hello= core()->getConfigData('suggestion.suggestion.options.show_products');
echo $hello ?>';
var display_terms_number_toggle ='<?php $hello= core()->getConfigData('suggestion.suggestion.options.display_terms_number_toggle');
echo $hello ?>';
var display_category='<?php $hello= core()->getConfigData('suggestion.suggestion.options.display_categories_toggle');
echo $hello ?>';
var display='<?php $hello= core()->getCurrentLocale()->code;
echo $hello ?>';
var term =event.target.value;
var obj={
category:'',
term:term
};
$.ajax({
url:"{{ route('searchsuggestion.search.index') }}",
type:"get",
data:obj,
success:function(data){
$('.suggests').html('');
if(term.length !== 0){
if(data[0].data.length !== 0){
if(display_category == 1){
if(data[0].data.length < no_of_terms){
for (let index = 0; index < data[0].data.length; index++) {
if(data[0].data[index].product.categories[0]){
if(data[0].data[index].product.categories[0].name == 'Root'){
$('.suggests').append('<a style="color:black;text-decoration:none;"'+
'href="'+data[0].data[index].url_key+'"> <div class="velocity_category">'+
'<p>'+data[0].data[index].name+'</p>'+
'</div></a>');
}else{
$('.suggests').append('<a style="color:black;text-decoration:none;"'+
'href="'+data[0].data[index].url_key+'"> <div class="velocity_category">'+
'<p>'+data[0].data[index].name+' {{ __('suggestion::app.in') }} '+data[0].data[index].product.categories[0].name+'</p>'+
'</div></a>');
}
}else{
$('.suggests').append('<a style="color:black;text-decoration:none;"'+
'href="'+data[0].data[index].url_key+'"> <div class="velocity_category">'+
'<p>'+data[0].data[index].name+'</p>'+
'</div></a>');
}
}
}else if (data[0].data.length >= no_of_terms) {
for (let index = 0; index < no_of_terms; index++) {
if(data[0].data[index].product.categories[0]){
if(data[0].data[index].product.categories[0].name == 'Root'){
$('.suggests').append('<a style="color:black;text-decoration:none;"'+
'href="'+data[0].data[index].url_key+'"> <div class="velocity_category">'+
'<p>'+data[0].data[index].name+'</p>'+
'</div></a>');
}else{
$('.suggests').append('<a style="color:black;text-decoration:none;"'+
'href="'+data[0].data[index].url_key+'"> <div class="velocity_category">'+
'<p>'+data[0].data[index].name+' {{ __('suggestion::app.in') }} '+data[0].data[index].product.categories[0].name+'</p>'+
'</div></a>');
}
}else{
$('.suggests').append('<a style="color:black;text-decoration:none;"'+
'href="'+data[0].data[index].url_key+'"> <div class="velocity_category">'+
'<p>'+data[0].data[index].name+'</p>'+
'</div></a>');
}
}
}
}
if(display_terms_toggle == 1){
if(display == 'ar'){
$('.suggests').append('<a style="color:black;text-decoration:none;"'+
'href="categorysearch?category=&term='+term+'"><div class="velocity_terms">'+
'<p class="velocity_termsa">'+term+'</p>'+
'<p class="ar_termsa">'+data[0].data.length+'</p>'+
'</div></a>');
}else{
$('.suggests').append('<a style="color:black;text-decoration:none;"'+
'href="categorysearch?category=&term='+term+'"><div class="velocity_terms">'+
'<p class="velocity_termsa">'+term+'</p>'+
'<p class="ar_termsb">'+data[0].data.length+'</p>'+
'</div></a>');
}
}
if(display_product_toggle == 1){
$('.suggests').append('<div class="velocity_popular">'+
'<p>{{ __('suggestion::app.popular_products') }}</p>'+
'</div>');
if (data[0].data.length < no_of_products) {
for (let index = 0; index < data[0].data.length; index++) {
if(data[0].data[index].product.type == 'bundle'){
var mini_price = parseInt(data[0].data[index].min_price);
var minimum = mini_price.toFixed(2);
$('.suggests').append('<a style="color:black;text-decoration:none;"'+
'href="'+data[0].data[index].url_key+'">'+
'<div class="velocity_product">'+
'<div class="velocity_img">'+
'<img style="'+
'width:100%;'+
'" src="'+data[2][index][0].small_image_url+'" >'+
'</div>'+
'<div class="imgp">'+
'<p class="velocity_img_name">'+data[0].data[index].name+'<br>{{ __('suggestion::app.starting_from') }} $'+minimum+'</p>'+
'</div></div></a>');
}else{
$('.suggests').append('<a style="color:black;text-decoration:none;"'+
'href="'+data[0].data[index].url_key+'">'+
'<div class="velocity_product">'+
'<div class="velocity_img">'+
'<img style="'+
'width:100%;'+
'" src="'+data[2][index][0].small_image_url+'" >'+
'</div>'+
'<div class="imgp">'+
'<p class="velocity_img_name">'+data[0].data[index].name+'<br>'+data[1][index]+'</p>'+
'</div></div></a>');
}
}
}else if(data[0].data.length >= no_of_products){
for (let index = 0; index < no_of_products; index++) {
if(data[0].data[index].product.type == 'bundle'){
var mini_price = parseInt(data[0].data[index].min_price);
var minimum = mini_price.toFixed(2);
$('.suggests').append('<a style="color:black;text-decoration:none;"'+
'href="'+data[0].data[index].url_key+'">'+
'<div class="velocity_product">'+
'<div class="velocity_img">'+
'<img style="'+
'width:100%;'+
'" src="'+data[2][index][0].small_image_url+'" >'+
'</div>'+
'<div class="imgp">'+
'<p class="velocity_img_name">'+data[0].data[index].name+'<br>{{ __('suggestion::app.starting_from') }} $'+minimum+'</p>'+
'</div></div></a>');
}else{
$('.suggests').append('<a style="color:black;text-decoration:none;"'+
'href="'+data[0].data[index].url_key+'">'+
'<div class="velocity_product">'+
'<div class="velocity_img">'+
'<img style="'+
'width:100%;'+
'" src="'+data[2][index][0].small_image_url+'" >'+
'</div>'+
'<div class="imgp">'+
'<p class="velocity_img_name">'+data[0].data[index].name+'<br>'+data[1][index]+'</p>'+
'</div></div></a>');
}
}
}
}
var search = event.target.value;
var n = search.length;
if(n >= 2){
var str = document.getElementById("old-new").innerHTML;
var search = event.target.value;
var regex = new RegExp(search, 'g');
var result = str.replace(regex, '<b>' + search + '</b>');
document.getElementById("old-new").innerHTML = result;
}
}else{
$('.suggests').append('<div class="velocity_no_result">'+
'<p>{{ __('suggestion::app.no_results') }}</p>'+
'</div>');
}
}
}
});
},
'focusInput': function (event) {
$(event.target.parentElement.parentElement).find('input').focus();
},
'submitForm': function () {
if (this.inputVal !== '') {
$('input[name=term]').val(this.inputVal);
$('#search-form').submit();
}
},
'updateHeaderItemsCount': function () {
if (! this.isCustomer) {
let comparedItems = this.getStorageValue('compared_product');
if (comparedItems) {
this.compareCount = comparedItems.length;
}
} else {
this.$http.get(`${this.$root.baseUrl}/items-count`)
.then(response => {
this.compareCount = response.data.compareProductsCount;
this.wishlistCount = response.data.wishlistedProductsCount;
})
.catch(exception => {
console.log(this.__('error.something_went_wrong'));
});
}
}
}
});
Vue.component('image-search-component', {
template: '#image-search-component-template',
data: function() {
return {
uploadedImageUrl: '',
image_search_status: "{{core()->getConfigData('general.content.shop.image_search') == '1' ? 'true' : 'false'}}" == 'true'
}
},
methods: {
uploadImage: function() {
var imageInput = this.$refs.image_search_input;
if (imageInput.files && imageInput.files[0]) {
if (imageInput.files[0].type.includes('image/')) {
if (imageInput.files[0].size <= 2000000) {
this.$root.showLoader();
var formData = new FormData();
formData.append('image', imageInput.files[0]);
axios.post(
"{{ route('shop.image.search.upload') }}",
formData,
{
headers: {
'Content-Type': 'multipart/form-data'
}
}
).then(response => {
var net;
var self = this;
this.uploadedImageUrl = response.data;
async function app() {
var analysedResult = [];
var queryString = '';
net = await mobilenet.load();
const imgElement = document.getElementById('uploaded-image-url');
try {
const result = await net.classify(imgElement);
result.forEach(function(value) {
queryString = value.className.split(',');
if (queryString.length > 1) {
analysedResult = analysedResult.concat(queryString)
} else {
analysedResult.push(queryString[0])
}
});
} catch (error) {
self.$root.hideLoader();
window.showAlert(
`alert-danger`,
this.__('shop.general.alert.error'),
"{{ __('shop::app.common.error') }}"
);
}
localStorage.searchedImageUrl = self.uploadedImageUrl;
queryString = localStorage.searched_terms = analysedResult.join('_');
self.$root.hideLoader();
window.location.href = "{{ route('shop.search.index') }}" + '?term=' + queryString + '&image-search=1';
}
app();
}).catch(() => {
this.$root.hideLoader();
window.showAlert(
`alert-danger`,
this.__('shop.general.alert.error'),
"{{ __('shop::app.common.error') }}"
);
});
} else {
imageInput.value = '';
window.showAlert(
`alert-danger`,
this.__('shop.general.alert.error'),
"{{ __('shop::app.common.image-upload-limit') }}"
);
}
} else {
imageInput.value = '';
alert('Only images (.jpeg, .jpg, .png, ..) are allowed.');
}
}
}
}
});
})()
</script>
@endpush

View File

@ -0,0 +1,13 @@
@extends('shop::layouts.master')
@section('page_title')
Package Suggestion
@stop
@section('content-wrapper')
<div class="main">
Package Suggestion
</div>
@stop

View File

@ -0,0 +1 @@
<link href="{{ asset('themes/default/assets/css/suggestion.css') }}" rel="stylesheet">

View File

@ -0,0 +1,30 @@
const mix = require("laravel-mix");
if (mix == 'undefined') {
const { mix } = require("laravel-mix");
}
require("laravel-mix-merge-manifest");
if (mix.inProduction()) {
var publicPath = 'publishable/assets';
} else {
var publicPath = '../../../public/themes/default/assets';
}
publicPath = 'publishable/assets';
mix.setPublicPath(publicPath).mergeManifest();
mix.disableNotifications();
mix.sass(__dirname + '/src/Resources/assets/sass/suggestion.scss', 'css/suggestion.css')
.options({
processCssUrls: false
});
if (! mix.inProduction()) {
mix.sourceMaps();
}
if (mix.inProduction()) {
mix.version();
}