Commit 9ba56fe4 authored by Batyr Mackenov's avatar Batyr Mackenov

Core search support by products

parent 7f7fbc6b
......@@ -25,6 +25,11 @@ class iaCategory extends iaAbstractFrontHelperCategoryFlat
protected $_moduleName = 'commerce';
public $coreSearchEnabled = true;
public $coreSearchOptions = [
'regularSearchFields' => ['title', 'description']
];
public function getUrl(array $item)
{
......@@ -39,6 +44,15 @@ class iaCategory extends iaAbstractFrontHelperCategoryFlat
return $this->getUrl($data);
}
// TODO: make it work
public function coreSearch($stmt, $start, $limit, $order)
{
$rows = $this->getAll($stmt, null, $start, $limit);
$count = $this->getFoundRows();
return [$count, $rows];
}
public function getBySlug($slug)
{
$where = '`status` = :status AND `slug` = :slug';
......
......@@ -30,6 +30,12 @@ class iaProduct extends abstractModuleFront
protected $_moduleName = 'commerce';
public $coreSearchEnabled = true;
public $coreSearchOptions = [
'tableAlias' => 'p',
'regularSearchFields' => ['title', 'snippet', 'description']
];
protected $_foundRows = 0;
private $_sortingOptions = [
......@@ -65,6 +71,14 @@ class iaProduct extends abstractModuleFront
return $this->getUrl($data);
}
public function coreSearch($stmt, $start, $limit, $order)
{
$rows = $this->_get($stmt, $start, $limit, $order);
$count = $this->getFoundRows();
return [$count, $rows];
}
public function getByCategory($categoryId, $start, $limit, $order)
{
$where = '';
......
{if !empty($listings)}
<div class="ia-items ia-items--cards">
{foreach $listings as $item}
{include 'extra:commerce/list'}
{/foreach}
</div>
{/if}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment