HI Guys,
I have noticed in the new version that the was products are assigned to categories are done in different tables what i am aiming to do is to grab the cheapest list_price of the cheapest product within a category - any idea on how the SQL query would go for this? the function i have written quickly is…
function fn_get_category_price($category_id){
if (!empty($category_id)) {
$category_price = db_get_field("SELECT product_id FROM ?:products_categories WHERE category_id = ?i", $category_id);
$category_price = db_get_field("SELECT MIN(list_price) FROM ?:products", $category_id);
if (!empty($category_price)) {
return $category_price;
} else {
return "";
}
}
return false;
}
I have not tested this yet, but wanted to make sure ive got the right concept in getting that info