Fix incorrect calculation of availability in csv export
This commit is contained in:
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user