<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=market.list.query
 * [END_COT_EXT]
 */

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

if($id_sub_attr > 0) {
  require_once cot_incfile('catextratypes', 'plug');

  $epArr = array();
  if($subid > 0) {
    $epArr = $db->query("SELECT * FROM $db_catextratypes WHERE e_area='market' AND e_catid=".$subid." ORDER BY e_title ASC")->fetchAll();
  }
  if(count($epArr) == 0 && $catdata['id'] > 0) {
    $epArr = $db->query("SELECT * FROM $db_catextratypes WHERE e_area='market' AND e_catid=".$catdata['id']." ORDER BY e_title ASC")->fetchAll();
  }
  if(count($epArr) > 0) {
    foreach($epArr as $val) {
      if($val['e_id'] == $id_sub_attr) {
         $where['catextratypes'] = 'FIND_IN_SET("'.$val['e_id'].'", item_catextratypes)';
      }
    }
  }
}
