function GetProductInfo($id,$line=null,$paramfunc = null) { global $par; if ($line == null){ $sql = "SELECT * FROM $par->objectstable WHERE id=$id AND hide=0"; $res = mysql_query($sql); $line = mysql_fetch_array($res,MYSQL_ASSOC); } $url = GetSeoUrl('tovar',$line['id'],$line); $instr = '(-1'; $tmp = explode(":",$line["colors"]); foreach ($tmp as $value) { if($value!="") $instr.=",".$value; } $instr.= ")"; $sql3 = "SELECT * FROM $par->fotorobjtable WHERE `title` IN $instr AND hide=0 GROUP BY `title` ORDER BY prior"; $res3 = mysql_query($sql3); while ($line3 = mysql_fetch_array($res3,MYSQL_ASSOC)){ $color = (int)$line3['title']; $sql4 = "SELECT * FROM $par->colorstable WHERE `id`=$color AND hide=0"; $res4 = mysql_query($sql4); $line4 = mysql_fetch_array($res4, MYSQL_ASSOC); $colors[] = array('id' => $line4['id'], 'color' => $line4['color']); } if (isset($colors) && !empty($colors)) $active_color = strval($colors[0]['id']); $parent = $line['id']; $sql2 = "SELECT * FROM $par->fotorobjtable WHERE `reportid`=$parent"; if (isset($active_color)) $sql2 .= " AND `title`='$active_color'"; $sql2 .= " ORDER by prior"; $res2 = mysql_query($sql2); while ($line2 = mysql_fetch_array($res2,MYSQL_ASSOC)){ $img[] = img_check("products/product_",$line2['id']); } $size = size_explode($line['id']); if (isset($colors) && !empty($colors)) $productitem = array('id' => $line['id'], 'artikul' => $line['artikul'], 'url' => $url, 'title' => $line['title'], 'text' => $line['text'], 'price' => $line['price'], 'colors' => $colors, 'size' => $size); else $productitem = array('id' => $line['id'], 'artikul' => $line['artikul'], 'url' => $url, 'title' => $line['title'], 'text' => $line['text'], 'price' => $line['price'], 'size' => $size); $productitem['img'] = $img; return $productitem; }
// Формируем массив просмотренных товаров if (!empty($_SESSION['reviewed'])){ foreach ($_SESSION['reviewed'] as $key => $reviewed_id) { $sql = "SELECT * FROM $par->objectstable WHERE id=$reviewed_id AND hide=0"; $res = mysql_query($sql); $line = mysql_fetch_array($res,MYSQL_ASSOC); $parent = $line['id']; $sql2 = "SELECT * FROM $par->fotorobjtable WHERE `reportid`=$parent ORDER by prior"; $res2 = mysql_query($sql2); $line2 = mysql_fetch_array($res2,MYSQL_ASSOC); $img = img_check("products/product_",$line2['id']); $url = GetSeoUrl('tovar',$line['id'],$line); $line = LangProcess($line); $size = size_explode($line['id']); if ($id != $line['id']) $reviewed[] = Array('title'=>$line['title'],'img'=>$img,'url'=>$url,'price'=>$line['price'],'size'=>$size); } if (isset($reviewed) && !empty($reviewed)) $reviewed = array_reverse($reviewed); } // Коментарии $sql = "SELECT * FROM $par->commentstable WHERE `product_id`=$id AND `ip` LIKE '%::$_SERVER[REMOTE_ADDR]::%'"; $res = mysql_query($sql); if (mysql_fetch_array($res)){ $comm_alr = true;