Fix 0,- prices in tables
This commit is contained in:
@@ -525,7 +525,8 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
|
|||||||
*/
|
*/
|
||||||
protected function parseRooms(\SimpleXMLElement $xmlHotel, $hotelUid, array &$date, array $services)
|
protected function parseRooms(\SimpleXMLElement $xmlHotel, $hotelUid, array &$date, array $services)
|
||||||
{
|
{
|
||||||
$minPrice = 0;
|
$minPriceOverall = 0;
|
||||||
|
$minPriceAvailable = 0;
|
||||||
$availableTotal = 0;
|
$availableTotal = 0;
|
||||||
$boardCode = '';
|
$boardCode = '';
|
||||||
$count = 0;
|
$count = 0;
|
||||||
@@ -561,8 +562,14 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
|
|||||||
$pax = (int) $roomXml->attributes()['MaxPax'];
|
$pax = (int) $roomXml->attributes()['MaxPax'];
|
||||||
$availableTotal += $available * $pax;
|
$availableTotal += $available * $pax;
|
||||||
|
|
||||||
if ($code !== static::CODE_BABYROOM && $available > 0 && ($minPrice === 0 || $price < $minPrice)) {
|
// Determine lowest price of available rooms
|
||||||
$minPrice = $price;
|
if ($code !== static::CODE_BABYROOM && $available > 0 && ($minPriceAvailable === 0 || $price < $minPriceAvailable)) {
|
||||||
|
$minPriceAvailable = $price;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine lowest overall price
|
||||||
|
if ($code !== static::CODE_BABYROOM && ($minPriceOverall === 0 || $price < $minPriceOverall)) {
|
||||||
|
$minPriceOverall = $price;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($roomXml->attributes()['status'] === static::STATUS_STOP && $price && !$available) {
|
if ($roomXml->attributes()['status'] === static::STATUS_STOP && $price && !$available) {
|
||||||
@@ -600,7 +607,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$date['board_code'] = $boardCode;
|
$date['board_code'] = $boardCode;
|
||||||
$date['min_price'] = $minPrice;
|
$date['min_price'] = $minPriceAvailable ?: $minPriceOverall;
|
||||||
$date['available'] = $availableTotal;
|
$date['available'] = $availableTotal;
|
||||||
$date['rooms'] = $count;
|
$date['rooms'] = $count;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user