l just updated Magento to version 2.4.6. Everything works fine but i have problem with one extension, it is very important to me and there is no substitute for it. Problem is that zendframework is replaced with laminas.
There are two files that have old clases of zend. Can you guys help me with that please.
Conversion.php – at the end of file was “Zend_Locale_Data”
<?php
declare(strict_types=1);
namespace InchooDualPricesHelper;
use MagentoFrameworkAppConfigScopeConfigInterface;
class Conversion
{
const HRK_EUR_CONVERSION_RATE = 7.53450;
const XML_PATH_CATALOG_DUAL_PRICES_SIDE_CURRENCY = 'currency/dual_prices/side_currency';
const XML_PATH_CATALOG_DUAL_PRICES_SEPARATOR = 'currency/dual_prices/separator';
/**
* @var ScopeConfigInterface
*/
protected $scopeConfig;
/**
* Conversion constructor.
* @param ScopeConfigInterface $scopeConfig
*/
public function __construct(
ScopeConfigInterface $scopeConfig
) {
$this->scopeConfig = $scopeConfig;
}
/**
* @param float $amount
* @return string
*/
public function formatSidePrice(float $amount): string
{
$sideCurrencyInfo = $this->getSideCurrencyInfo();
return sprintf(
'<span class="side-price">%s%s%s</span>',
$sideCurrencyInfo['separator'] ?
"<span class="side-price-separator">{$sideCurrencyInfo['separator']}</span>" :
' ',
number_format(
round($amount * $sideCurrencyInfo['rate'], 2),
2,
',',
'.'
),
$sideCurrencyInfo['symbol']
);
}
/**
* @return array
*/
public function getSideCurrencyInfo(): array
{
$currency = $this->scopeConfig->getValue(self::XML_PATH_CATALOG_DUAL_PRICES_SIDE_CURRENCY);
return [
'rate' => $currency == 'HRK' ? self::HRK_EUR_CONVERSION_RATE : 1/self::HRK_EUR_CONVERSION_RATE,
'symbol' => Zend_Locale_Data::getContent('hr_HR', 'currencysymbol', $currency),
'separator' => trim((string)$this->scopeConfig->getValue(self::XML_PATH_CATALOG_DUAL_PRICES_SEPARATOR))
];
}
}
Invoice.php – in the midle of the file there is “Zend_Pdf_Font::fontWithPath(“
<?php
declare(strict_types=1);
namespace InchooDualPricesModelSalesOrderPdf;
use MagentoSalesModelOrderPdfInvoice as Original;
use MagentoSalesModelAbstractModel;
class Invoice extends Original
{
/**
* Insert totals to pdf page
*
* @param Zend_Pdf_Page $page
* @param AbstractModel $source
* @return Zend_Pdf_Page
*/
protected function insertTotals($page, $source) //phpcs:ignore
{
$order = $source->getOrder();
$totals = $this->_getTotalsList();
$lineBlock = ['lines' => [], 'height' => 15];
foreach ($totals as $total) {
$total->setOrder($order)->setSource($source);
if ($total->canDisplay()) {
$total->setFontSize(10);
foreach ($total->getTotalsForDisplay() as $totalData) {
$euroAmount = sprintf(' / %0.2f€', round((float)$total->getAmount() / 7.5345, 2));
$lineBlock['lines'][] = [
[
'text' => $totalData['label'],
'feed' => 475,
'align' => 'right',
'font_size' => $totalData['font_size'],
'font' => 'bold',
],
[
'text' => $totalData['amount'],
'feed' => 565 - $this->widthForStringUsingFontSize(
$euroAmount,
Zend_Pdf_Font::fontWithPath(
$this->_rootDirectory->getAbsolutePath('lib/internal/GnuFreeFont/FreeSerif.ttf')
),
9
),
'align' => 'right',
'font_size' => $totalData['font_size'],
'font' => 'bold'
],
[
'text' => $euroAmount,
'feed' => 565,
'align' => 'right',
'font_size' => 9,
]
];
}
}
}
$this->y -= 20;
$page = $this->drawLineBlocks($page, [$lineBlock]);
return $page;
}
}