Skip to content

Commit 5fe4d52

Browse files
authored
MDEE-485: Regular price attribute is missing in prices feed
1 parent 8a48276 commit 5fe4d52

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ProductPriceDataExporter/Model/Provider/ProductPrice.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,14 @@ public function get(array $values): array
140140
$priceAttributeCode = $this->resolvePriceCode($row);
141141
if ($priceAttributeCode === self::REGULAR_PRICE) {
142142
$output[$key]['regular'] = $row['price'];
143-
} else {
143+
} elseif ($priceAttributeCode !== self::UNKNOWN_PRICE_CODE) {
144144
$this->addDiscountPrice($output[$key], $priceAttributeCode, (float)$row['price']);
145145
}
146+
147+
// cover case when _this_ product type doesn't have regular price, but this field is required in schema
148+
if (!isset($output[$key]['regular'])) {
149+
$output[$key]['regular'] = 0;
150+
}
146151
}
147152
$filteredIds = array_unique(array_column($output, 'productId'));
148153
$this->addCustomerGroupPrices($output, $filteredIds);
@@ -184,6 +189,7 @@ private function resolvePriceCode(array $row)
184189
{
185190
return $this->getPriceAttributes()[$row['attributeId']] ?? self::UNKNOWN_PRICE_CODE;
186191
}
192+
187193
/**
188194
* Add Customer Group Prices
189195
*

0 commit comments

Comments
 (0)