function cw_review_get_attribute_vote_values($review) { global $tables; $rating_cond = $review['product_id'] > 0 ? "type='rating'" : "type='global_rating'"; list($attributes, $nav) = cw_func_call('cw_attributes_search', array('data' => array('active' => 1, 'is_show' => 1, 'sort_field' => 'orderby')), array('where' => array($rating_cond))); $votes = array(); if (!empty($attributes)) { $where = cw_review_get_where_query_by_settings($review['customer_id']); $rates = cw_query_hash("SELECT vote_value as vote, attribute_id FROM {$tables['products_votes']}\n WHERE {$where} AND review_id='{$review['review_id']}' AND attribute_id IN ('" . join("','", array_column($attributes, 'attribute_id')) . "')", 'attribute_id', false, true); foreach ($attributes as $v) { $votes[$v['attribute_id']]['name'] = $v['name']; $votes[$v['attribute_id']]['vote'] = $rates[$v['attribute_id']]; } } return $votes; }
} // review by link if ($action == 'review_product') { if (!empty($review_object) && !empty($review_key)) { $result = cw_user_get_info($review_object); $test_key = md5('rps' . $review_object); // if user exist and keys equal if (!empty($result) && $review_key === $test_key) { $extended_review_customer_id = $review_object; } } } if (!empty($extended_review_customer_id)) { $_customer_id = $extended_review_customer_id; } $where = cw_review_get_where_query_by_settings($_customer_id); $avail_by_settings = cw_review_avail_by_settings($product_id, $_customer_id, $extended_review_customer_id); $return_url = cw_call('cw_core_get_html_page_url', array(array('var' => 'product', 'product_id' => $product_id, 'js_tab' => 4, 'delimiter ' => '&'))); // Place review and rates if ($action == 'review' && $product_id && ($config['estore_products_review']['customer_reviews'] == 'Y' || $config['estore_products_review']['customer_voting'] == 'Y') && $avail_by_settings) { // Check captcha antibot code $antibot_err =& cw_session_register("antibot_err"); $page = "on_reviews"; if (!empty($addons['image_verification']) && $show_antibot_arr[$page] == 'Y') { if (isset($antibot_input_str) && !empty($antibot_input_str)) { $antibot_err = cw_validate_image($antibot_validation_val[$page], $antibot_input_str); } else { $antibot_err = true; } } // validate form