Commit 9a960b2b authored by Artem Malichev's avatar Artem Malichev

Minor fix.

parent 0585977c
......@@ -121,17 +121,16 @@ class iaProduct extends abstractModuleFront
return $row ? $row[0] : false;
}
public function getByMemberId($id, $start, $limit, $order, $hidden = true)
public function getByMemberId($id, $start, $limit, $order)
{
return $this->_get('p.`member_id` = ' . (int)$id, $start, $limit, $order, $hidden);
return $this->_get('p.`member_id` = ' . (int)$id, $start, $limit, $order);
}
protected function _get($where = null, $start, $limit, $order = null, $hidden = true)
protected function _get($where = null, $start, $limit, $order = null)
{
$where || $where = iaDb::EMPTY_CONDITION;
$where .= $hidden ? ' AND p.`status` != :hidden' : ' AND ' . iaDb::EMPTY_CONDITION;
$this->iaDb->bind($where, ['hidden' => self::STATUS_HIDDEN, 'member_id' => isset($userId) ? $userId : 0]);
$this->iaDb->bind($where, ['hidden' => self::STATUS_HIDDEN]);
if (!$order) {
$order = 'p.`date_modified` DESC';
......@@ -184,7 +183,10 @@ class iaProduct extends abstractModuleFront
$currency = $iaCurrency->get();
foreach ($rows as &$row) {
foreach ($rows as $key => &$row) {
if (iaUsers::hasIdentity() && $row['status'] == iaProduct::STATUS_HIDDEN && iaUsers::getIdentity()->id !== $row['member_id']) {
unset($rows[$key]); continue;
}
$row['price_formatted'] = $iaCurrency->format($row['price']);
$row['currency'] = $currency;
}
......
......@@ -20,9 +20,9 @@ if ($iaView->url && 'commerce' == $iaCore->get('default_package')) {
case '.html':
// product
$stmt = '`slug` = :slug AND `status` != :status';
$stmt = '`slug` = :slug';
$iaDb->bind($stmt, ['slug' => end($iaView->url), 'status' => 'hidden', 'member_id' => isset($userId) ? $userId : 0]);
$iaDb->bind($stmt, ['slug' => end($iaView->url)]);
if ($iaDb->exists($stmt, null, 'products')) {
$pageSlug = $iaDb->one_bind('alias', '`name` = :page AND `status` = :status',
......
......@@ -91,7 +91,7 @@ if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
return iaView::accessDenied();
}
$items = $iaProduct->getByMemberId(iaUsers::getIdentity()->id, $pagination['start'], $pagination['limit'], $sorting, false);
$items = $iaProduct->getByMemberId(iaUsers::getIdentity()->id, $pagination['start'], $pagination['limit'], $sorting);
}
$pagination['total'] = $iaProduct->getFoundRows();
......
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