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 Inchoo\DualPrices\Helper; use Magento\Framework\App\Config\ScopeConfigInterface; 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 Inchoo\DualPrices\Model\Sales\Order\Pdf; use Magento\Sales\Model\Order\Pdf\Invoice as Original; use Magento\Sales\Model\AbstractModel; 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; } }
Hello @raul_baricevic
To resolve the issue of missing Zend_Locale_Format or Zend_Locale_Data after upgrading to Magento 2.4.6:
Replace Zend references with Laminas in your code.
Update your composer.json to include Laminas dependencies.
Adjust any custom or third-party code to use Laminas equivalents.
Use Magento migration tools to ensure complete transition from Zend to Laminas.
By following these steps, you should be able to successfully transition from Zend Framework to Laminas and resolve the errors you are encountering in Magento 2.4.6.
Hope it helps !
If you find our reply helpful, please give us kudos.
A Leading Magento Development Agency That Delivers Powerful Results, Innovation, and Secure Digital Transformation.
WebDesk Solution Support Team
Get a Free Quote | | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789
Thank You,
WebDesk Solution Support Team
Get a Free Quote | Email | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789
Location: 150 King St. W. Toronto, ON M5H 1J9
Hey,
Please refer,
https://meetanshi.com/blog/solved-class-zend-not-found-in-magento-2/
Thank You!