Пример #1
0
 public static function getProductPQVQ($productId = 0, $year = 0, $make = '', $model = '')
 {
     if (isset($_REQUEST['productId'])) {
         $productId = (int) $_REQUEST['productId'];
     }
     if (empty($make) && isset($_REQUEST['make']) && !empty($_REQUEST['make'])) {
         $make = $_REQUEST['make'];
     }
     if (empty($model) && isset($_REQUEST['model']) && !empty($_REQUEST['model'])) {
         $model = $_REQUEST['model'];
     }
     if (!$year && isset($_REQUEST['year']) && !empty($_REQUEST['year'])) {
         $year = (int) $_REQUEST['year'];
     }
     if ($productId) {
         $where = array();
         if ($make) {
             $where[] = sprintf("UPPER(prodmake)='%s'", strtoupper($make));
         }
         if ($model) {
             $where[] = sprintf("UPPER(prodmodel)='%s'", strtoupper($model));
         }
         if ($year) {
             $where[] = sprintf("(prodstartyear <= %d AND prodendyear >= %d)", $year, $year);
         }
         if (count($where) > 2) {
             return ISC_PRODUCT::GetProductPQVQHtml($productId, !empty($where) ? ' AND ' . implode(' AND ', $where) : '');
         }
     }
 }