Fix incorrect calculation of availability in csv export

This commit is contained in:
Björn Fromme
2019-02-12 11:13:01 +01:00
parent d905a6baf8
commit cf2aacad8f
2 changed files with 45 additions and 43 deletions
@@ -147,6 +147,7 @@ class ResellerController extends ActionController
foreach ($data['product'] as $product)
{
$minPrice = 0;
$available = 0;
foreach ($product['hotels']['hotel'] as $hotel)
{
@@ -155,6 +156,7 @@ class ResellerController extends ActionController
if ($minPrice === 0 || $date['minprice'] < $minPrice) {
$minPrice = $date['minprice'];
}
$available++;
}
}
@@ -164,7 +166,7 @@ class ResellerController extends ActionController
fputcsv($fileHandle, [
$product['@id'],
count($hotel['dates']['date']) > 0 ? 'in stock' : 'out of stock',
$available > 0 ? 'in stock' : 'out of stock',
'new',
$description,
$product['images']['image'][0],