Closed groomain closed 10 years ago
It depends on what do you want to achieve, but there's no specific function for that, you could create a SQL query that retrieve said information. Which will be the best (and fastest) solution.
You could also use "osc_query_item" for example
$items = osc_query_item(array(
'category_name' => 'cars',
'region' => 'Madrid',
'results_per_page' => 1
))
osc_query_item return item data, results_per_page is there to limit the number to 1, if it's not set, it will return 10 (default, or whatever you have configured in your admin as default number of items per search).
Later, you should check if $items is empty (no results) or it has some results in it
Thanks. It's a shame that this function doesn't use Search parameters (sCategory, sCity, sRegion...) :)
For other users : osc_query_item don't return anything but export an array to the view named customItem.
To use it, you need to do this.
$items = osc_query_item(array(
'category_name' => 'cars',
'city_name' => 'New York',
'results_per_page' => 1
));
$result = View::newInstance()->_get('customItems');
if (empty($result)) {
// DO SOMETHING
}
Hi,
I haven't find any function to do this.
Actually I'm using listCities and listRegions to find a city or region with item but I can't test easily if my region or city have at least one item in a specific category.
Maybe somebody have an hack.
Thanks