function _amazon_component_fetch_reviews in Amazon Product Advertisement API 7.2
1 call to _amazon_component_fetch_reviews()
- template_preprocess_amazon_component_reviews in amazon_component/
amazon_component.preprocess.inc
File
- amazon_component/
amazon_component.preprocess.inc, line 97
Code
function _amazon_component_fetch_reviews($asin) {
// Query :: Select Amazon Product Nodes referencing Amazon Product ASIN number.
$query = 'SELECT * FROM {field_data_field_product_asin} WHERE field_product_asin_asin IN (:asins) AND bundle IN (:bundle)';
$args = array(
':asins' => $asin,
':bundle' => 'review',
);
$options = array(
'fetch' => PDO::FETCH_ASSOC,
);
// Result :: Amazon Product Community Review(s) Query Result
$result = db_query($query, $args, $options);
// Foreach :: Retrieve Node via Entity ID
// TODO :: Create a more optimized Entity Query.
foreach ($result as $review) {
$item[$review['bundle'] . "-" . $review['entity_id']] = node_load($review['entity_id']);
}
return $item;
}