Jump to content

Recommended Posts

Hello,

I’m encountering an error in the PrestaShop 9 backend after installing via cPanel (Softaculous). The backend doesn’t work, and I get the following error:

**Error**: An exception has been thrown during the rendering of a template ("PrestaShop\PrestaShop\Core\Context\CurrencyContext::__construct(): Argument #2 ($name) must be of type string, int given, called in /home3/carpetfa/staging.carpetfashion.gr/src/Core/Context/CurrencyContextBuilder.php on line 62").

Link to comment
Share on other sites

Edit src/Core/Context/CurrencyContextBuilder.php around line 62, and cast integer fields to string explicitly.

 

// Update to:
$currencyContext = new CurrencyContext(
    (int) $currencyId,
    (string) $isoCode,
    (int) $precision,
    // ...
);

Clear PrestaShop cache, then reload the backend.
or install it manually by uploading the Zip file directly.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Hello,

Thank you for the solution. This code can be found at:

 https://github.com/PrestaShop/PrestaShop/blob/develop/src/Core/Context/CurrencyContextBuilder.php

        return new CurrencyContext(
            (int) $legacyCurrency->id,
            $localizedNames[$languageId] ?? reset($localizedNames),
            $legacyCurrency->getLocalizedNames(),
            $legacyCurrency->iso_code,
            $legacyCurrency->numeric_iso_code,
            (string) $legacyCurrency->getConversionRate(),
            $localizedSymbols[$languageId] ?? reset($localizedSymbols),
            $legacyCurrency->getLocalizedSymbols(),
            (int) $legacyCurrency->precision,
            $localizedPatterns[$languageId] ?? reset($localizedPatterns),
            $legacyCurrency->getLocalizedPatterns()
        );

 

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

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...