Jump to content

Call to undefined method Currency :: getPattern ()


Recommended Posts

Has anyone had the same error?

I went to update Prestashop 1.7.6 through 1-click to version 1.7.7 and I can't access the backoffice anymore because it presents this error in the debub:

CRITICAL
php Call to undefined method Currency :: getPattern ()
CRITICAL
request Uncaught PHP Exception Symfony \ Component \ Debug \ Exception \ UndefinedMethodException: "Attempted to call an undefined method named" getPattern "of class" Currency "." at /home/thenatur/public_html/src/Core/Localization/Currency/DataLayer/CurrencyDatabase.php line 120

 

On backoffice page shows this:

 

Oops... looks like an unexpected error occurred

Attempted to call an undefined method named "getPattern" of class "Currency".

[Symfony\Component\Debug\Exception\UndefinedMethodException 0]

Link to comment
Share on other sites

Hi,

most probably you have an old module which is calling the getPattern() function from Currency class, which was hardcoded in your old class.

to find the module you should activate debug mode and then on the Backoffice login page you will have the trace of this error.

Kind regards, Leo

Link to comment
Share on other sites

5 minutes ago, Leo @ Prestachamps said:

Hi,

most probably you have an old module which is calling the getPattern() function from Currency class, which was hardcoded in your old class.

to find the module you should activate debug mode and then on the Backoffice login page you will have the trace of this error.

Kind regards, Leo

Hi,

I have already entered the debug, as shown above. I went in the line of code and it appears this:

image.png.fa34fc8b3b53d4399b7a2927a4c8ca91.png

And I don't know how to fix this error because I don't know what the correct syntax would be.

 

Link to comment
Share on other sites

2 minutes ago, joseantgv said:

Enable DEBUG mode first :)

Sure...eheheheh

 

image.png.64ca0cbd1436ee42bc1112d2d535cff4.png

 

UndefinedMethodException

Symfony\Component\Debug\Exception\UndefinedMethodException: Attempted to call an undefined method named "getPattern" of class "Currency". at src/Core/Localization/Currency/DataLayer/CurrencyDatabase.php:120 at PrestaShop\PrestaShop\Core\Localization\Currency\DataLayer\CurrencyDatabase->doRead(object(LocalizedCurrencyId)) (src/Core/Data/Layer/AbstractDataLayer.php:90) at PrestaShop\PrestaShop\Core\Data\Layer\AbstractDataLayer->read(object(LocalizedCurrencyId)) (src/Core/Data/Layer/AbstractDataLayer.php:150) at PrestaShop\PrestaShop\Core\Data\Layer\AbstractDataLayer->propagateRead(object(LocalizedCurrencyId)) (src/Core/Data/Layer/AbstractDataLayer.php:94) at PrestaShop\PrestaShop\Core\Data\Layer\AbstractDataLayer->read(object(LocalizedCurrencyId)) (src/Core/Localization/Currency/CurrencyDataSource.php:67) at PrestaShop\PrestaShop\Core\Localization\Currency\CurrencyDataSource->getLocalizedCurrencyData(object(LocalizedCurrencyId)) (src/Core/Localization/Currency/CurrencyDataSource.php:110) at PrestaShop\PrestaShop\Core\Localization\Currency\CurrencyDataSource->formatCurrenciesData(array('EUR'), 'pt-PT') (src/Core/Localization/Currency/CurrencyDataSource.php:97) at PrestaShop\PrestaShop\Core\Localization\Currency\CurrencyDataSource->getAllInstalledCurrenciesData('pt-PT') (src/Core/Localization/Currency/Repository.php:87) at PrestaShop\PrestaShop\Core\Localization\Currency\Repository->getAllInstalledCurrencies('pt-PT') (src/Core/Localization/Locale/Repository.php:207) at PrestaShop\PrestaShop\Core\Localization\Locale\Repository->getPriceSpecifications('pt-PT') (src/Core/Localization/Locale/Repository.php:150) at PrestaShop\PrestaShop\Core\Localization\Locale\Repository->getLocale('pt-PT') (classes/controller/Controller.php:189) at ControllerCore->init() (classes/controller/AdminController.php:2782) at AdminControllerCore->init() (classes/controller/Controller.php:273) at ControllerCore->run() (classes/Dispatcher.php:515) at DispatcherCore->dispatch() (admin8943a56v4/index.php:97)

 

Link to comment
Share on other sites

  • 4 weeks later...
  • 3 weeks later...
hace 3 horas, notsureabout dijo:

After a 1-click upgrade from 1.7.6.4 to 1.7.7.1 I have the same exact error as @Rita Ramos
Replacing src folder didn't work for me.
Couldn't find any working solution on the net.
Maybe someone faced the same problem and solved can share his/her solution?
Thanks
 

Could you please upload a screenshot from your error?

Link to comment
Share on other sites

On 1/12/2021 at 5:45 PM, Rita Ramos said:

image.png.64ca0cbd1436ee42bc1112d2d535cff4.png

 

UndefinedMethodException

Symfony\Component\Debug\Exception\UndefinedMethodException: Attempted to call an undefined method named "getPattern" of class "Currency". at src/Core/Localization/Currency/DataLayer/CurrencyDatabase.php:120 at PrestaShop\PrestaShop\Core\Localization\Currency\DataLayer\CurrencyDatabase->doRead(object(LocalizedCurrencyId)) (src/Core/Data/Layer/AbstractDataLayer.php:90) at PrestaShop\PrestaShop\Core\Data\Layer\AbstractDataLayer->read(object(LocalizedCurrencyId)) (src/Core/Data/Layer/AbstractDataLayer.php:150) at PrestaShop\PrestaShop\Core\Data\Layer\AbstractDataLayer->propagateRead(object(LocalizedCurrencyId)) (src/Core/Data/Layer/AbstractDataLayer.php:94) at PrestaShop\PrestaShop\Core\Data\Layer\AbstractDataLayer->read(object(LocalizedCurrencyId)) (src/Core/Localization/Currency/CurrencyDataSource.php:67) at PrestaShop\PrestaShop\Core\Localization\Currency\CurrencyDataSource->getLocalizedCurrencyData(object(LocalizedCurrencyId)) (src/Core/Localization/Currency/CurrencyDataSource.php:110) at PrestaShop\PrestaShop\Core\Localization\Currency\CurrencyDataSource->formatCurrenciesData(array('EUR'), 'pt-PT') (src/Core/Localization/Currency/CurrencyDataSource.php:97) at PrestaShop\PrestaShop\Core\Localization\Currency\CurrencyDataSource->getAllInstalledCurrenciesData('pt-PT') (src/Core/Localization/Currency/Repository.php:87) at PrestaShop\PrestaShop\Core\Localization\Currency\Repository->getAllInstalledCurrencies('pt-PT') (src/Core/Localization/Locale/Repository.php:207) at PrestaShop\PrestaShop\Core\Localization\Locale\Repository->getPriceSpecifications('pt-PT') (src/Core/Localization/Locale/Repository.php:150) at PrestaShop\PrestaShop\Core\Localization\Locale\Repository->getLocale('pt-PT') (classes/controller/Controller.php:189) at ControllerCore->init() (classes/controller/AdminController.php:2782) at AdminControllerCore->init() (classes/controller/Controller.php:273) at ControllerCore->run() (classes/Dispatcher.php:515) at DispatcherCore->dispatch() (admin8943a56v4/index.php:97)

 

Hi joseantgv,
thanks for your interest.
Right now I deleted all my experiments in localhost but my error is identical to Rita Ramos I quoted here.

I tried several approaches: using different php versions, disabling custom theme before upgrading, checking currencies before upgrading and several other.
I didn't get any error messages in BO after 1 click upgrade but the message I get after this operation is the one I enclose here.
Website I'm trying to update is a 1.7.6.2 correctly upgraded to 1.7.6.4 several months ago.

Thanks
 

Edited by notsureabout (see edit history)
Link to comment
Share on other sites

Hello,

indeed, replacing the folder worked for a couple of minutes, then it's down again.

The only solution I foud, is to install a fresh prestashop, move my images, my order/cutomers/cart tables et start on a fresh prestashop.

The updates are so broken it's insane ...

Link to comment
Share on other sites

hace 14 minutos, notsureabout dijo:

Hi joseantgv,
thanks for your interest.
Right now I deleted all my experiments in localhost but my error is identical to Rita Ramos I quoted here.

I tried several approaches: using different php versions, disabling custom theme before upgrading, checking currencies before upgrading and several other.
I didn't get any error messages in BO after 1 click upgrade but the message I get after this operation is the one I enclose here.
Website I'm trying to update is a 1.7.6.2 correctly upgraded to 1.7.6.4 several months ago.

Thanks
 

Please upload your error with the main error visible because in this screenshot it isn't.

Link to comment
Share on other sites

Ok, upgraded from 1.7.6.4 to 1.7.7.2
1-Click Upgrade
php 7.3.9

Received these errors on admin login

1531929725_Screenshot_2021-02-23AttemptedtocallanundefinedmethodnamedgetPatternofclassCurrency(500InternalServerError).thumb.png.45babca6242f28df461b3b1d72219ed6.png

 

 

2052389861_Screenshot_2021-02-23AttemptedtocallanundefinedmethodnamedgetPatternofclassCurrency(500InternalServerError)(1).thumb.png.74a1428ec9bbbfbad120e28d547dc97c.png

 

740446670_Screenshot_2021-02-23AttemptedtocallanundefinedmethodnamedgetPatternofclassCurrency(500InternalServerError)(2).thumb.png.bffbb206a0204f2a1e534c8792f62e9b.png

 

 

Received these errors in frontoffice
Fatal error: Uncaught Error: Call to undefined method Currency::getPattern() in E:\laragon\www\spuzzapaolo2020_02_20\src\Core\Localization\Currency\DataLayer\CurrencyDatabase.php:120

Stack trace:

#0 E:\laragon\www\spuzzapaolo2020_02_20\src\Core\Data\Layer\AbstractDataLayer.php(90): PrestaShop\PrestaShop\Core\Localization\Currency\DataLayer\CurrencyDatabase->doRead(Object(PrestaShop\PrestaShop\Core\Localization\Currency\LocalizedCurrencyId))

#1 E:\laragon\www\spuzzapaolo2020_02_20\src\Core\Data\Layer\AbstractDataLayer.php(150): PrestaShop\PrestaShop\Core\Data\Layer\AbstractDataLayer->read(Object(PrestaShop\PrestaShop\Core\Localization\Currency\LocalizedCurrencyId))

#2 E:\laragon\www\spuzzapaolo2020_02_20\src\Core\Data\Layer\AbstractDataLayer.php(94): PrestaShop\PrestaShop\Core\Data\Layer\AbstractDataLayer->propagateRead(Object(PrestaShop\PrestaShop\Core\Localization\Currency\LocalizedCurrencyId))

#3 E:\laragon\www\spuzzapaolo2020_02_20\src\Core\Localization\Currency\CurrencyDataSource.php(67): PrestaShop\PrestaShop\Core\Da in E:\laragon\www\spuzzapaolo2020_02_20\src\Core\Localization\Currency\DataLayer\CurrencyDatabase.php on line 120

 

 

Edited by notsureabout (see edit history)
Link to comment
Share on other sites

Strange. There is a function getPattern() both in /classes/Currency.php and /src/Core/Localization/Currency.php.

My guess would be that it has something to do with the table ps_currency_lang that was introduced in PS version 1.7.6. That table contains a field with the name pattern with usually the value NULL.

Edited by musicmaster (see edit history)
Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...