/***/
$select = $db->select()->from('goods');
$select->join('pages', 'pages.idPage = goods.idPage');
if ($route) {
$select->join('routing', 'pages.idRoute = routing.idRoute');
}
if ($content) {
$select->join('content', 'content.idContentPack = pages.idContentPack');
$select->where('content.idLang = ?', Kernel_Locale::getCurrent()->getId());
if ($search) {
$select->where('content.contentName = ?', $search);
}
}
if (!$expired) {
$select->where('goods.goodExpirationDate > ?', time());
}
if ($photo) {
$select->join('photos', 'goods.idPhoto = photos.idPhoto');
}
$select->where('pages.pageType = ?', self::TYPE_GOOD);
if ($idCatalog) {
$select->where('goods.idCatalog = ?',$idCatalog);
}
if ($idCategory) {
$select->where('goods.idCategory = ?',$idCategory);
}
if ($idCity) {
$select->where('goods.idCity = ?',$idCity);
}
/***/