Skip to content

Commit 080eb10

Browse files
authored
make extension code compatible with Magento v2.4.3 and PHP 7 (#240)
1 parent 807b3cf commit 080eb10

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

app/code/Meta/Catalog/Model/Product/Feed/Builder/MultiSourceInventory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private function isInStock(Product $product, int $stockId): bool
104104
* @param int $stockId
105105
* @return int|float
106106
*/
107-
private function getStockQty(Product $product, int $stockId): int|float
107+
private function getStockQty(Product $product, int $stockId)
108108
{
109109
try {
110110
return $this->getProductSalableQtyInterface->execute(

app/code/Meta/Catalog/Model/Product/Feed/Builder/Tools.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,18 @@ public function htmlDecode($value)
105105
public function formatPrice($price, $storeId = null)
106106
{
107107
$currencyModel = $this->priceCurrency->getCurrency($storeId);
108+
$currencySymbol = $currencyModel->getCurrencySymbol();
109+
108110
$amount = $this->priceCurrency->convert($price, $storeId, $currencyModel);
109111
try {
110-
return sprintf(
112+
$price = sprintf(
111113
'%s %s',
112114
$currencyModel->formatTxt($amount, ['display' => Currency::NO_SYMBOL]),
113115
$currencyModel->getCode()
114116
);
117+
// workaround for 2.4.3
118+
$price = trim($price, $currencySymbol);
119+
return $price;
115120
} catch (Exception $e) {
116121
return '';
117122
}
@@ -133,14 +138,18 @@ public function getUnitPrice(Product $product)
133138
}
134139

135140
$currencyModel = $this->priceCurrency->getCurrency($product->getStoreId());
141+
$currencySymbol = $currencyModel->getCurrencySymbol();
136142

137143
try {
138-
return sprintf(
144+
$price = sprintf(
139145
"{'value':'%s','currency':'%s','unit':'%s'}",
140146
$currencyModel->formatTxt($value, ['display' => Currency::NO_SYMBOL]),
141147
$currencyModel->getCode(),
142148
$unit
143149
);
150+
// workaround for 2.4.3
151+
$price = trim($price, $currencySymbol);
152+
return $price;
144153
} catch (Exception $e) {
145154
return '';
146155
}

app/code/Meta/Catalog/Observer/Product/DeleteAfter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function __construct(
6767
GraphApiAdapter $graphApiAdapter,
6868
FBEHelper $fbeHelper,
6969
Identifier $identifier,
70-
ManagerInterface $messageManager,
70+
ManagerInterface $messageManager
7171
) {
7272
$this->systemConfig = $systemConfig;
7373
$this->graphApiAdapter = $graphApiAdapter;

app/code/Meta/Conversion/Helper/ServerSideHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ServerSideHelper
6060
public function __construct(
6161
FBEHelper $fbeHelper,
6262
AAMFieldsExtractorHelper $aamFieldsExtractorHelper,
63-
SystemConfig $systemConfig,
63+
SystemConfig $systemConfig
6464
) {
6565
$this->fbeHelper = $fbeHelper;
6666
$this->aamFieldsExtractorHelper = $aamFieldsExtractorHelper;

0 commit comments

Comments
 (0)