Skip unavailable hotels in Google export
This commit is contained in:
@@ -23,15 +23,18 @@ class GoogleBusinessFeedCsvFormatter
|
||||
|
||||
foreach ($data['product'] as $product) {
|
||||
$minPrice = 0;
|
||||
$available = 0;
|
||||
|
||||
foreach ($product['hotels']['hotel'] as $hotel) {
|
||||
foreach ($hotel['dates']['date'] as $date) {
|
||||
if ($minPrice === 0 || $date['minprice'] < $minPrice) {
|
||||
$minPrice = $date['minprice'];
|
||||
}
|
||||
$available++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($available > 0) {
|
||||
$csv[] = [
|
||||
$product['@id'],
|
||||
$product['@id'],
|
||||
@@ -41,6 +44,7 @@ class GoogleBusinessFeedCsvFormatter
|
||||
$minPrice . '.00 EUR',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $csv;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user