<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=markettags.main
 * [END_COT_EXT]
 */

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

if(is_array($item_data)){
  require_once cot_incfile('reviews', 'plug');
  global $db_reviews;

	$temp_array['RSTAR'] = number_format(round($item_data['item_rstar']*5, 1), 1, '.', '');
  $temp_array['RSTAR_CNT'] = $db->query("SELECT COUNT(*) FROM $db_reviews WHERE item_area='market' AND item_type='review' AND item_mcode=".$item_data['item_id'])->fetchColumn();
  if(!$temp_array['RSTAR_CNT']) $temp_array['RSTAR_CNT'] = 0;
  $temp_array['RSTAR_CNT_TEXT'] = cot_declension($temp_array['RSTAR_CNT'], 'оценка,оценки,оценок');
}