<?php
/* ====================
[BEGIN_COT_EXT]
Hooks=market.list.query
Order=10
[END_COT_EXT]
==================== */

defined('COT_CODE') or die('Wrong URL');

$sview = cot_import('sview', 'G', 'INT');
$list_url_path['sview'] = $sview;

if(in_array($sview, array(2, 3))) {
  $vizitedmarket = $usr['vizitedmarket'];
  if(!is_array($vizitedmarket)) {
    if($usr['id'] > 0) {
      $vizitedmarket = $usr['profile']['user_vizitedmarket'];
    } else {
      $vizitedmarket = cot_import('vizitedmarket', 'C', 'TXT');
    }
    $vizitedmarket = explode(',', $vizitedmarket);
  }

  if(count($vizitedmarket) > 0) {
    $where['sview'] = "item_id".($sview == 3 ? ' NOT' : '')." IN ('".implode("','", $vizitedmarket)."')";
  } elseif($sview) {
    $where['sview'] = "item_id=0";
  }
}