Commit 600adae4 authored by Batyr Mackenov's avatar Batyr Mackenov

#31

parent e27a3411
......@@ -76,7 +76,7 @@ class iaProduct extends abstractModuleFront
$where = 'p.`category_id` IN (' . $subQuery . ')';
}
return $this->get($where, $start, $limit, $order);
return $this->_get($where, $start, $limit, $order);
}
public function getBySlug($slug)
......@@ -84,12 +84,12 @@ class iaProduct extends abstractModuleFront
$where = 'p.`slug` = :slug';
$this->iaDb->bind($where, ['slug' => $slug]);
$rows = $this->get($where, 0, 1);
$rows = $this->_get($where, 0, 1);
return $rows ? $rows[0] : false;
}
public function get($where = null, $start, $limit, $order = null)
protected function _get($where = null, $start, $limit, $order = null)
{
$where || $where = iaDb::EMPTY_CONDITION;
$where .= ' AND p.`status` != :hidden';
......@@ -168,4 +168,12 @@ class iaProduct extends abstractModuleFront
'key' => array_search($params, $this->_sortingOptions)
];
}
public function getBlockFeatured()
{
$where = 'p.`featured` = 1';
return $this->_get($where, 0, $this->iaCore->get('commerce_featured_products_limit'));
}
}
\ No newline at end of file
......@@ -11,5 +11,9 @@ if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
$blocksData['priorityCategories'] = $iaCategory->getBlockPriority();
}
if ($iaView->blockExists('featured_products')) {
$blocksData['featuredProducts'] = $iaProduct->getBlockFeatured();
}
$iaView->assign('commerce', $blocksData);
}
\ No newline at end of file
......@@ -52,6 +52,7 @@
<configgroup name="commerce">Commerce</configgroup>
<config group="commerce" type="divider">Limits</config>
<config group="commerce" name="commerce_products_per_page" type="text" description="Products per page">20</config>
<config group="commerce" name="commerce_featured_products_limit" type="text" description="Products in 'Featured Products' block" private="1">10</config>
<config group="commerce" name="commerce_priority_categories_limit" type="text" description="Categories in 'Priority Categories' block">10</config>
<fields_groups>
......@@ -104,6 +105,7 @@
<blocks>
<block name="subcategories" title="Subcategories" position="top" type="smarty" header="0" sticky="0" pages="storefront" filename="block.subcategories"><![CDATA[]]></block>
<block name="priority_categories" title="Priority Categories" position="right" type="smarty" header="1" filename="block.priority-categories"><![CDATA[]]></block>
<block name="featured_products" title="Featured Products" position="verytop" type="smarty" sticky="1" filename="block.featured-products"><![CDATA[]]></block>
</blocks>
<hooks>
......
{if $commerce.featuredProducts}
<div class="cards featured-products">
<div class="row">
{foreach $commerce.featuredProducts as $item}
<div class="col-md-3">
{include 'extra:commerce/list' itemName=$commerce.itemName}
</div>
{if $item@iteration % 4 == 0 && !$item@last}
</div>
<div class="row">
{/if}
{/foreach}
</div>
</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