Поиск по товарам

This commit is contained in:
RedHood 2021-01-24 16:25:08 +10:00
parent 212694c917
commit c2afcfcc5a
28 changed files with 715 additions and 124 deletions

View File

@ -9,6 +9,7 @@
namespace app\assets;
use yii\web\AssetBundle;
use yii\web\View;
/**
* Main application asset bundle.
@ -31,15 +32,18 @@ class AppAsset extends AssetBundle
];
public $js = [
'https://kit.fontawesome.com/d7e922c226.js',
'https://code.jquery.com/jquery-3.5.1.min.js',
'js/bootstrap/popper.min.js',
'js/bootstrap/bootstrap.min.js',
'https://cdn.jsdelivr.net/bxslider/4.1.1/jquery.bxslider.min.js',
'https://unpkg.com/cookielib/src/cookie.min.js',
'js/menu.js',
'js/account.js',
'js/search.js',
'js/reinitialization.js'
];
public $jsOptions = [
// 'position' => View::POS_HEAD
];
public $depends = [
'yii\web\YiiAsset',
// 'yii\bootstrap\BootstrapAsset'

View File

@ -3,7 +3,7 @@
use ArangoDBClient\ConnectionOptions;
return [
'class' => '\explosivebit\arangodb\Connection',
'class' => '\mirzaev\yii2\arangodb\Connection',
'connectionOptions' => [
ConnectionOptions::OPTION_DATABASE => '',
ConnectionOptions::OPTION_ENDPOINT => 'tcp://127.0.0.1:8529',

View File

@ -45,7 +45,7 @@ class AuthenticationController extends Controller
// Запись ответа
$return = [
'nav' => (new AccountForm())->deauthenticationGenHtml(),
'menu' => (new AccountForm())->deauthenticationGenHtml(),
'_csrf' => Yii::$app->request->getCsrfToken()
];

View File

@ -44,7 +44,7 @@ class DeauthenticationController extends Controller
// Ответа
return [
'nav' => $model->authenticationGenHtml($this->renderPartial('/account', compact('model'))),
'menu' => $model->authenticationGenHtml($this->renderPartial('/account', compact('model'))),
'main' => $this->renderPartial('/index'),
'redirect' => '/',
'_csrf' => Yii::$app->request->getCsrfToken()

View File

@ -24,7 +24,7 @@ class IdentificationController extends Controller
// Запись ответа
$return = [
'nav' => $model->authenticationGenHtml($this->renderPartial('/account', compact('model'))),
'menu' => $model->authenticationGenHtml($this->renderPartial('/account', compact('model'))),
'_csrf' => Yii::$app->request->getCsrfToken()
];
} else {
@ -35,7 +35,7 @@ class IdentificationController extends Controller
// Запись ответа
$return = [
'nav' => (new AccountForm())->deauthenticationGenHtml(),
'menu' => (new AccountForm())->deauthenticationGenHtml(),
'_csrf' => Yii::$app->request->getCsrfToken()
];
}

View File

@ -49,7 +49,7 @@ class RegistrationController extends Controller
// Запись ответа
$return = [
'nav' => (new AccountForm())->deauthenticationGenHtml(),
'menu' => (new AccountForm())->deauthenticationGenHtml(),
'_csrf' => Yii::$app->request->getCsrfToken()
];

View File

@ -0,0 +1,100 @@
<?php
namespace app\controllers;
use Yii;
use yii\web\Controller;
use yii\web\Response;
use app\models\Product;
use yii\web\Cookie;
class SearchController extends Controller
{
public function actionIndex(): array|string
{
// Инициализация
$request = Yii::$app->request->post('request') ?? Yii::$app->request->get('q');
if (Yii::$app->request->post('type') === 'product' || Yii::$app->request->get('type') === 'product') {
// Поиск по продуктам
// Инициализация сессии
$session = Yii::$app->session;
$session->open();
// Инициализация ответа
$response = null;
// Период пропуска запросов (в секундах)
$period = 1;
// Запись времени последнего запроса и вычисление об истечении таймера
$timer = ($session['last_request'] ?? $session['last_request'] = time() + $period) - time();
if ($timer > 0) {
// Ожидание перед повторным запросом при условии что старых запросов нет
Yii::$app->response->statusCode = 202;
$return = [
'timer' => $timer,
'search_line_window' => $this->renderPartial('/loading'),
'_csrf' => Yii::$app->request->getCsrfToken()
];
} else {
// Повторный запрос по истечению ожидания
// Очистка времени последнего запроса
unset($session['last_request']);
//
// Здесь запись истории запросов (в базе данных)
//
if ($response = Product::search($request)) {
// Данные найдены
// Запись ответа
$return = [
'search_line_window' => $this->renderPartial('/search/panel', compact('response')),
'_csrf' => Yii::$app->request->getCsrfToken()
];
if ((int) Yii::$app->request->post('advanced')) {
// Полноценный поиск
// Запись ответа
$return['main'] = $this->renderPartial('/search/index', compact('response'));
$return['search_line_window_hide'] = 1;
$return['redirect'] = '/search?type=product&q=' . $request;
}
} else {
// Данные не найдены
Yii::$app->response->statusCode = 404;
}
}
if (Yii::$app->request->isAjax) {
// AJAX-POST-запрос
Yii::$app->response->format = Response::FORMAT_JSON;
return $return ?? [
'search_line_window' => $this->renderPartial('/search/panel'),
'_csrf' => Yii::$app->request->getCsrfToken()
];
} else {
// GET-запрос
return $this->render('/search/index', compact('response', 'timer'));
}
}
if (Yii::$app->user->isGuest) {
return $this->render('/search/index', ['error_auth' => true]);
} else {
return $this->render('/search/index');
}
}
}

View File

@ -3,7 +3,7 @@
namespace app\models;
use Yii;
use explosivebit\arangodb\ActiveRecord;
use mirzaev\yii2\arangodb\ActiveRecord;
abstract class Document extends ActiveRecord
{

View File

@ -2,8 +2,6 @@
namespace app\models;
use explosivebit\arangodb\ActiveRecord;
abstract class Edge extends Document
{
public function attributes()

View File

@ -3,6 +3,7 @@
namespace app\models;
use moonland\phpexcel\Excel;
use mirzaev\yii2\arangodb\Query;
class Product extends Document
{
@ -139,6 +140,11 @@ class Product extends Document
return false;
}
public static function search(string $text): array
{
return (new Query)->limit(10)->search('product_search', ['id' => '_key', 'catn' => 'catn'], ['catn' => $text], 1);
}
private static function writeEdgeBetweenGroup(string $from, string $to): bool
{
// Инициализация

View File

@ -39,7 +39,7 @@ AppAsset::register($this);
</div>
<div class="mr-auto p-0 h-divider-title-right"></div>
</div>
<nav class="col-3 mt-auto d-flex justify-content-end"></nav>
<menu class="col-3 mb-0 d-flex justify-content-end"></menu>
</div>
<div class="h-divider"></div>
</header>
@ -47,11 +47,11 @@ AppAsset::register($this);
<aside class="container mb-4">
<div class="row">
<div class="col-lg-3 d-flex flex-column align-center justify-content-end dropdownMenuButton_column">
<button id="dropdownMenuButton" class="btn form-control d-flex align-items-center button_clean catalog_button" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<button id="catalog" class="btn form-control d-flex align-items-center button_clean catalog_button" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-bars col-auto text-left p-0 mr-auto h-100 d-flex flex-column justify-content-center"></i>
<p class="col-10 m-0 p-0">Каталог товаров</p>
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<div class="dropdown-menu" aria-labelledby="catalog">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
@ -65,9 +65,14 @@ AppAsset::register($this);
<label class="mb-0 px-3 px-md-4 py-1" for="catalog_search_panel_button_2">Вторая кнопка</label>
<input id="catalog_search_panel_button_3" class="btn btn-sm5 text-white button_clean" type="radio" name="catalog_search_panel_buttons" value="catalog_search_panel_button_3">
<label class="mb-0 px-3 px-md-4 py-1" for="catalog_search_panel_button_3">Третья кнопка</label> -->
<form class="d-flex catalog_search">
<input type="text" class="form-control col-8 col-lg-10 catalog_search_line" id="productNumber" placeholder="Введите номер запчасти, например: 45223503481">
<button type="submit" class="col btn button_clean catalog_search_button">ПОИСК</button>
<form class="d-flex catalog_search" onsubmit="return false;">
<div class="position-relative col-8 col-lg-10 px-0">
<input id="search_line" type="text" class="form-control col-12 catalog_search_line button_clean" placeholder="Введите номер запчасти, например: 45223503481" onclick="$('#search_line').dropdown('toggle')" onmouseenter="$('#search_line').dropdown('show')" oninput="$('#search_line').dropdown('hide'); product_search(this);" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<div id="search_line_window" class="dropdown-menu w-100" aria-labelledby="search_line" onmouseout="$('#search_line').dropdown('show')">
<a class="dropdown-item button_white text-dark inactive">Здесь будет история поиска</a>
</div>
</div>
<button type="submit" class="col btn button_clean catalog_search_button" onclick="product_search(this.parentElement.getElementsByTagName('input')[0], 1)">ПОИСК</button>
</form>
</div>
</div>

View File

@ -0,0 +1,4 @@
<link href="/css/loading.css" rel="stylesheet">
<p class="my-2 d-flex justify-content-center"><i class="loading mr-2"></i><br>Поиск</p>

View File

@ -1,18 +1,19 @@
<?php
?>
<link href="/css/pages/product.css" rel="stylesheet">
<div id="page_product" class="h-100">
<div class="container h-100">
<div class="row h-100 py-3">
<div class="col-12">
<div class="block_main h-100 p-3 rounded">
<article class="col-12">
<div class="h-100 p-3 rounded">
<h4 class="ml-4"><?php echo $model['name'] ?></h4>
<div class="dropdown-divider"></div>
<p class="ml-4">Дата создания: <?php echo date('d.m.Y H:i', $model['date']) ?></p>
<p class="ml-4">Дата создания: <time><?php echo date('d.m.Y H:i', $model['date']) ?></time></p>
<pre class="ml-4"><?php var_dump($model) ?></pre>
</div>
</div>
</article>
</div>
</div>
</div>

View File

@ -6,24 +6,23 @@ use app\models\Product;
use app\models\Supply;
?>
<link href="/css/pages/profile.css" rel="stylesheet">
<div id="page_profile" class="h-100">
<div class="container h-100">
<div id="page_profile" class="container h-100">
<div class="row h-100 py-3">
<div class="col-3">
<div class="block_sidebar h-100 p-3 rounded">
<nav class="col-3">
<div class="p-3 rounded">
<div class="d-flex">
<p>Почта: </p>
<p class="ml-auto"><?php echo Yii::$app->user->identity->mail ?></p>
</div>
</div>
</div>
<div class="col-9">
<div class="block_main h-100 p-3 rounded">
</nav>
<article class="col-9">
<div class="h-100 p-3 rounded">
<h4 class="ml-4">Личный кабинет</h4>
<div class="dropdown-divider"></div>
<p>Не знаю что сюда пока добавить</p>
<?php
$form = ActiveForm::begin([
'id' => 'form_product_import_excel',
@ -53,8 +52,7 @@ use app\models\Supply;
<p>Всего товаров: <?php echo Product::readAmount() ?></p>
<p>Всего поставок: <?php echo Supply::readAmount() ?></p>
</div>
</div>
</div>
</article>
</div>
</div>

View File

@ -0,0 +1,39 @@
<link href="/css/pages/search.css" rel="stylesheet">
<div id="page_search" class="container h-100">
<div class="row py-3">
<nav class="col-3">
<div class="p-3 rounded">
</div>
</nav>
<article class="col-9">
<div class="row p-3 rounded">
<div class="d-flex flex-column mx-auto">
<?php
if (isset($timer) && $timer > 0) {
echo <<<HTML
<p class="d-flex justify-content-center mb-3">Слишком частые запросы, повторите попытку через: $timer секунд</p>
<a class="btn text-white button_clean button_blue mx-auto" onclick="window.location.reload();">Повторить</a>
HTML;
} else {
if (isset($response) && $response) {
foreach ($response as $row) {
$id = $row['id'];
$catn = $row['catn'];
echo <<<HTML
<a class="dropdown-item button_white text-dark" href="/product/$id">$catn</a>
HTML;
}
} else {
echo '<p class="m-0 py-2 d-flex justify-content-center">Ничего не найдено</p>';
}
}
?>
</div>
</div>
</article>
</div>
</div>

View File

@ -0,0 +1,22 @@
<?php
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use app\models\AccountForm;
// var_dump($response);
if (isset($response) && $response) {
foreach ($response as $row) {
$id = $row['id'];
$catn = $row['catn'];
echo <<<HTML
<a class="dropdown-item button_white text-dark" href="/product/$id">$catn</a>
HTML;
}
} else {
echo '<p class="m-0 py-2 d-flex justify-content-center">Ничего не найдено</p>';
}
?>

View File

@ -124,6 +124,7 @@ nav {
.catalog_search_button {
height: 2rem;
margin: 0 0 0 .8rem;
font-size: 85%;
line-height: 100%;
border-radius: 3px;

View File

@ -0,0 +1,15 @@
.loading {
margin-top: 0.25em;
width: 1em;
height: 1em;
border-radius: 50%;
border: 1px solid #04040433;
border-top-color: #123eab;
animation: rotation 1s infinite linear;
}
@keyframes rotation {
to {
transform: rotate(360deg);
}
}

View File

@ -12,6 +12,10 @@ a {
cursor: pointer;
}
p {
margin: auto;
}
a:hover {
text-decoration: none;
}
@ -32,19 +36,15 @@ main {
background-color: #f0eefb;
}
.block_sidebar {
background-color: #fff;
}
.block_main {
background-color: #fff;
}
.button_clean, .button_clean:hover, .button_clean:focus, .button_clean:active {
outline: none !important;
box-shadow: none !important;
}
.inactive, .inactive:hover, .inactive:focus, .inactive:active {
pointer-events: none;
}
.button_blue {
background-color: #123EAB;
}

View File

@ -0,0 +1,3 @@
#page_product nav > div, #page_product article > div {
background-color: #fff;
}

View File

@ -0,0 +1,3 @@
#page_profile nav > div, #page_profile article > div {
background-color: #fff;
}

View File

@ -0,0 +1,3 @@
#page_search nav > div, #page_search article > div {
background-color: #fff;
}

View File

@ -0,0 +1,247 @@
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12212") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12212") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12212") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12212") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "asdas") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "asdas") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "asdas") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12eaw") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12eaw") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12eaw") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12eaw") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12eaw") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12eaw2") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12eaw12") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12eaw12u") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12eaw12uыф") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12eaw12uыф") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12eaw12uыфыв") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12eaw12uыфыв") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112342rsd") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112342rsd") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112342rsd") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112342rsd") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112342rsd") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112342rsd") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112342rsd") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112342rsd") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112342rsd") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112342rsda") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "123123123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "123123123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "123123123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "123123123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "123123123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "123123123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "11") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "11") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112323") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "11232345") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112323455") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112323455") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112323455") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112323455") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112323455") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112323455") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112323455") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "42342") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "42342") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "42342") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "42342") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "42342") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "42342") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "ass") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "ass") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "121") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1212") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "11232") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112321") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1123211") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "11232111") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-2") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-12") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1223") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1223") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1223") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1223") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-12323") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-12323") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-12323") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-12323") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-12323") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-12323") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-11") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12323") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12323") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12323") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "d") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "dsdfsdf") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "dsdfsdf") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "a") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "asdasd") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "asdasd") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-101") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1011") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "11212") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "123123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12342") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1232") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1232с") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-12") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-121") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-12111") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1233") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-2") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "12") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "EF") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "ED") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "FA") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "EF") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-2") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-E") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-F") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "10") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-2") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-2") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-22") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-2222") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-22") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-2") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-2=") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-12") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "111") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "111") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1111") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "11") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1123") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "112") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "11211") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "11") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-12") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}
FOR product_search IN product_search SEARCH STARTS_WITH(product_search.catn, "1-1") LIMIT 0,10 RETURN {"id": product_search._key, "catn": product_search.catn}

View File

@ -1,8 +1,8 @@
<?php
// comment out the following two lines when deployed to production
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require __DIR__ . '/../../../../vendor/autoload.php';
require __DIR__ . '/../../../../vendor/yiisoft/yii2/Yii.php';

View File

@ -5,9 +5,9 @@ function identification() {
dataType: 'json',
data: { '_csrf': yii.getCsrfToken() },
success: function (data) {
if (data.nav !== undefined) {
if (data.menu !== undefined) {
// Обновление документа
document.getElementsByTagName('nav')[0].innerHTML = data.nav;
document.getElementsByTagName('menu')[0].innerHTML = data.menu;
}
if (data.redirect !== undefined) {
// Перенаправление
@ -34,16 +34,18 @@ function authentication(form) {
dataType: 'json',
data: form,
success: function (data, status) {
if (data.nav !== undefined) {
if (data.menu !== undefined) {
// Обновление документа
document.getElementsByTagName('nav')[0].innerHTML = data.nav;
document.getElementsByTagName('menu')[0].innerHTML = data.menu;
}
if (data.main !== undefined && document.getElementById('page_index') === null) {
main = document.getElementsByTagName('main')[0];
// Обновление документа
document.getElementsByTagName('main')[0].innerHTML = data.main;
main.innerHTML = data.main;
// Реинициализация
reinitialization();
reinitialization(main);
}
if (data.redirect !== undefined) {
// Перенаправление
@ -56,8 +58,13 @@ function authentication(form) {
},
error: function (data, status) {
if (data.responseJSON.main !== undefined) {
main = document.getElementsByTagName('main')[0];
// Обновление документа
document.getElementsByTagName('main')[0].innerHTML = data.responseJSON.main;
main.innerHTML = data.responseJSON.main;
// Реинициализация
reinitialization(main);
}
if (data.responseJSON.redirect !== undefined) {
// Перенаправление
@ -78,16 +85,18 @@ function deauthentication() {
dataType: 'json',
data: { '_csrf': yii.getCsrfToken() },
success: function (data) {
if (data.nav !== undefined) {
if (data.menu !== undefined) {
// Обновление документа
document.getElementsByTagName('nav')[0].innerHTML = data.nav;
document.getElementsByTagName('menu')[0].innerHTML = data.menu;
}
if (data.main !== undefined) {
main = document.getElementsByTagName('main')[0];
// Обновление документа
document.getElementsByTagName('main')[0].innerHTML = data.main;
main.innerHTML = data.main;
// Реинициализация
reinitialization();
reinitialization(main);
}
if (data.redirect !== undefined) {
// Перенаправление
@ -114,17 +123,19 @@ function registration(form) {
dataType: 'json',
data: form,
success: function (data) {
if (data.nav !== undefined) {
if (data.menu !== undefined) {
// Обновление документа
document.getElementsByTagName('nav')[0].innerHTML = data.nav;
document.getElementsByTagName('menu')[0].innerHTML = data.menu;
}
// Разобраться нужна ли ещё првоерка на page_index, избавиться от неё
if (data.main !== undefined && document.getElementById('page_index') === null) {
main = document.getElementsByTagName('main')[0];
// Обновление документа
document.getElementsByTagName('main')[0].innerHTML = data.main;
main.innerHTML = data.main;
// Реинициализация
reinitialization();
reinitialization(main);
}
if (data.redirect !== undefined) {
// Перенаправление
@ -137,8 +148,13 @@ function registration(form) {
},
error: function (data) {
if (data.responseJSON.main !== undefined) {
main = document.getElementsByTagName('main')[0];
// Обновление документа
document.getElementsByTagName('main')[0].innerHTML = data.responseJSON.main;
main.innerHTML = data.responseJSON.main;
// Реинициализация
reinitialization(main);
}
if (data.responseJSON.redirect !== undefined) {
// Перенаправление

View File

@ -9,11 +9,13 @@ function page_main() {
data: { '_csrf': yii.getCsrfToken() },
success: function (data, status) {
if (data.main !== undefined) {
main = document.getElementsByTagName('main')[0];
// Обновление документа
document.getElementsByTagName('main')[0].innerHTML = data.main;
main.innerHTML = data.main;
// Реинициализация
reinitialization();
reinitialization(main);
}
if (data.redirect !== undefined) {
// Перенаправление
@ -26,11 +28,13 @@ function page_main() {
},
error: function (data, status) {
if (data.responseJSON.main !== undefined) {
main = document.getElementsByTagName('main')[0];
// Обновление документа
document.getElementsByTagName('main')[0].innerHTML = data.responseJSON.main;
main.innerHTML = data.responseJSON.main;
// Реинициализация
reinitialization();
reinitialization(main);
}
if (data.responseJSON.redirect !== undefined) {
// Перенаправление
@ -57,11 +61,13 @@ function page_profile() {
data: { '_csrf': yii.getCsrfToken() },
success: function (data, status) {
if (data.main !== undefined) {
main = document.getElementsByTagName('main')[0];
// Обновление документа
document.getElementsByTagName('main')[0].innerHTML = data.main;
main.innerHTML = data.main;
// Реинициализация
reinitialization();
reinitialization(main);
}
if (data.redirect !== undefined) {
// Перенаправление
@ -74,10 +80,13 @@ function page_profile() {
},
error: function (data, status) {
if (data.responseJSON.main !== undefined) {
main = document.getElementsByTagName('main')[0];
// Обновление документа
document.getElementsByTagName('main')[0].innerHTML = data.responseJSON.main;
main.innerHTML = data.responseJSON.main;
// Реинициализация
reinitialization();
reinitialization(main);
}
if (data.responseJSON.redirect !== undefined) {
// Перенаправление
@ -92,15 +101,3 @@ function page_profile() {
return false;
};
// $('#profile_button').on('show.bs.dropdown', function () {
// alert('Пизда');
// return false;
// })
// document.getElementById('profile_button').dropdown({
// trigger: "hover"
// });
// Popper.createPopper(button, tooltip);

View File

@ -1,9 +1,11 @@
function reinitialization() {
// Уничтожает все внешние файлы загруженные внутри <main> и загружает их в <head> и <body>
function reinitialization(target) {
// Уничтожает все внешние файлы загруженные внутри блока с переданным ID и загружает их в <head> и <body>
main = document.getElementsByTagName('main')[0];
links = main.getElementsByTagName('link');
if (target !== undefined) {
links = target.getElementsByTagName('link');
scripts = target.getElementsByTagName('script');
// Запись CSS
for (link of links) {
new_link = document.createElement("link");
new_link.href = link.href;
@ -12,12 +14,16 @@ function reinitialization() {
link.remove();
}
scripts = document.getElementsByTagName('main')[0].getElementsByTagName('script');
// Запись JS
for (script of scripts) {
new_script = document.createElement("script");
new_script.src = script.src;
document.getElementsByTagName("body")[0].appendChild(new_script);
script.remove();
}
return true;
}
return false;
};

View File

@ -0,0 +1,123 @@
function product_search(object, advanced = 0) {
if (object.value.length > 1) {
// Проверка на длину запроса пройдена
$.ajax({
url: '/search',
type: 'post',
dataType: 'json',
data: {
'_csrf': yii.getCsrfToken(),
'type': 'product',
'advanced': advanced,
'request': object.value
},
success: function (data, status) {
if (data.search_line_window !== undefined) {
search_line_window = document.getElementById('search_line_window');
// Обновление окна результатов поиска
search_line_window.innerHTML = data.search_line_window;
// Отображение окна (потом надо переделать)
$('#search_line').dropdown('show');
// Реинициализация
reinitialization(search_line_window);
}
if (data.timer !== undefined) {
// Ожидание перед повторным запросом
if (getCookie('search') !== 'processing') {
// На данный момент нет других запросов поиска
// Запись о существовании запроса
document.cookie = "search=processing; path=/";
// Запрос
setTimeout(product_search, data.timer + '000', object, advanced);
}
}
if (data.search_line_window_hide === 1) {
// Скрытие окна (потом надо переделать)
$('#search_line').dropdown('hide');
}
if (data.main !== undefined) {
main = document.getElementsByTagName('main')[0];
// Обновление документа
main.innerHTML = data.main;
// Реинициализация
reinitialization(main);
}
if (data.redirect !== undefined) {
// Перенаправление
history.pushState({}, document.title, data.redirect);
}
if (data._csrf !== undefined) {
// Обновление документа
$('meta[name=csrf-token]').prop("content", data._csrf);
}
},
error: function (data, status) {
if (data.responseJSON.search_line_window !== undefined) {
search_line_window = document.getElementById('search_line_window');
// Обновление окна результатов поиска
search_line_window.innerHTML = data.responseJSON.search_line_window;
// Отображение окна (потом надо переделать)
$('#search_line').dropdown('show');
// Реинициализация
reinitialization(search_line_window);
}
if (data.responseJSON.main !== undefined) {
main = document.getElementsByTagName('main')[0];
// Обновление окна результатов поиска
main.innerHTML = data.main;
// Реинициализация
reinitialization(main);
}
if (data.responseJSON.redirect !== undefined) {
// Перенаправление
history.pushState({}, document.title, data.responseJSON.redirect);
}
if (data.responseJSON.timer !== undefined) {
// Ожидание перед повторным запросом
if (getCookie('search') !== 'processing') {
// На данный момент нет других запросов поиска
// Запись о существовании запроса
document.cookie = "search=processing; path=/";
// Запрос
setTimeout(product_search, data.responseJSON.timer + '000', object, advanced);
}
}
if (data.responseJSON.search_line_window_hide === 1) {
// Скрытие окна (потом надо переделать)
$('#search_line').dropdown('hide');
}
if (data.responseJSON._csrf !== undefined) {
// Обновление документа
$('meta[name=csrf-token]').prop("content", data.responseJSON._csrf);
}
},
statusCode: {
200: function () {
// Ожидание нового запроса
document.cookie = "search=waiting; path=/";
},
404: function () {
// Ожидание нового запроса
document.cookie = "search=waiting; path=/";
}
}
});
}
};