1. PHP / Говнокод #9488

    +163

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    $textb = Db::getInstance()->ExecuteS("SELECT * FROM "._DB_PREFIX_."productotzyv WHERE `id_product` = ".$idProduct);
    		$count_otz = count($textb);
    		if ($p==0) $p = 1;
    		$limit = 99;
    		$texta = get("SELECT *, date_format(data, '%d.%m.%Y') as data_ FROM "._DB_PREFIX_."productotzyv WHERE `id_product` = ".$idProduct." LIMIT ".$limit);
    		$ed = count(Db::getInstance()->ExecuteS("SELECT * FROM "._DB_PREFIX_."productotzyv WHERE `id_product`=".intval($_GET['id_product'])." and `rating`=1"));
    		$dva = count(Db::getInstance()->ExecuteS("SELECT * FROM "._DB_PREFIX_."productotzyv WHERE `id_product`=".intval($_GET['id_product'])." and `rating`=2"));
    		$tri = count(Db::getInstance()->ExecuteS("SELECT * FROM "._DB_PREFIX_."productotzyv WHERE `id_product`=".intval($_GET['id_product'])." and `rating`=3"));
    		$four = count(Db::getInstance()->ExecuteS("SELECT * FROM "._DB_PREFIX_."productotzyv WHERE `id_product`=".intval($_GET['id_product'])." and `rating`=4"));
    		$five = count(Db::getInstance()->ExecuteS("SELECT * FROM "._DB_PREFIX_."productotzyv WHERE `id_product`=".intval($_GET['id_product'])." and `rating`=5"));
            $uri = $_SERVER['REQUEST_URI'];
            $i = strrpos($uri, "/");
            $uri1 = substr($uri, 0, $i);
            $i = strrpos($uri1, "/");
            $uri = substr($uri1, 0, $i);
            $uri = $uri."/";
            $monUrl = "http://".$_SERVER['HTTP_HOST'].$uri;
    		foreach ($textb as $s => $a){
    			$text += $a['rating'];
    		}
    
    		$smarty->assign('ed', $ed);
    		$smarty->assign('dva', $dva);
    		$smarty->assign('tri', $tri);
    		$smarty->assign('four', $four);
    		$smarty->assign('five', $five);
    		$smarty->assign('ed_proc', $ed/$count_otz*100);
    		$smarty->assign('dva_proc', $dva/$count_otz*100);
    		$smarty->assign('tri_proc', $tri/$count_otz*100);
    		$smarty->assign('four_proc', $four/$count_otz*100);
    		$smarty->assign('five_proc', $five/$count_otz*100);
    		$smarty->assign('rating2', round($text/$count_otz, 0));
    		$smarty->assign('countotz', $count_otz.' '.endingsForm($count_otz,"отзыв","отзыва","отзывов"));
    		$smarty->assign('monUrl',$monUrl);
    		$smarty->assign('text',$texta);

    Prestashop, реализация отображения отзывов и рейтига товара

    Запостил: uint, 19 Февраля 2012

    Комментарии (12) RSS

    Добавить комментарий