Not possible to view suppliers.



  • Not possible to view suppliers, when they have some products. Version 1.0.3
    0_1516135451197_Schermafbeelding 2018-01-16 om 21.20.38.png

    0_1516135466932_Schermafbeelding 2018-01-16 om 21.40.54.png



  • What was the currency? Apparently is crashes because of the unknown currency code.



  • I have only the € as currency, the others are disabled. The prices on the products are all in €.



  • and the currency code?



  • ID
    Valuta
    ISO-code
    Numerieke ISO-code
    Symbool
    Wisselkoers
    Ingeschakeld
    Wisselkoers provider
    1 Euro EUR 978 € 1 –
    Wijzig



  • I have checked in the PS 1.6 version, it’s the same.



  • Strange, somewhere in the database there is a currency with an unknown code.

    Anyhow, you can probably make it format if you replace the function Tools::displayPrice with the following snippet:

    public static function displayPrice($price, $tbCurrency = null, $noUtf8 = false, Context $context = null, $auto = null)
    {
        if (!is_numeric($price)) {
            return $price;
        }
        if (!$context) {
            $context = Context::getContext();
        }
        if (!$tbCurrency) {
            $tbCurrency = $context->currency;
        } elseif (is_int($tbCurrency)) {
            $tbCurrency = Currency::getCurrencyInstance((int) $tbCurrency);
        }
    
        if (is_array($tbCurrency)) {
            $currencyIso = $tbCurrency['iso_code'];
            $currencyDecimals = (int) $tbCurrency['decimals'] * _PS_PRICE_DISPLAY_PRECISION_;
            $currencyArray = $tbCurrency;
            $tbCurrency = new Currency();
            $tbCurrency->hydrate($currencyArray);
        } elseif (is_object($tbCurrency)) {
            $currencyIso = $tbCurrency->iso_code;
            $currencyDecimals = (int) $tbCurrency->decimals * _PS_PRICE_DISPLAY_PRECISION_;
        } else {
            return '';
        }
    
        if ($auto === null) {
            try {
                $auto = $tbCurrency->getMode();
            } catch (PrestaShopException $e) {
                $auto = false;
            }
        }
    
        if (!$auto) {
            $cChar = $tbCurrency->sign;
            $cFormat = $tbCurrency->format;
            $cDecimals = (int) $tbCurrency->decimals * _PS_PRICE_DISPLAY_PRECISION_;
            $cBlank = $tbCurrency->blank;
            $blank = ($cBlank ? ' ' : '');
            $ret = 0;
            if (($isNegative = ($price < 0))) {
                $price *= -1;
            }
            $price = Tools::ps_round($price, $cDecimals);
    
            /*
            * If the language is RTL and the selected currency format contains spaces as thousands separator
            * then the number will be printed in reverse since the space is interpreted as separating words.
            * To avoid this we replace the currency format containing a space with the one containing a comma (,) as thousand
            * separator when the language is RTL.
            */
            if (($cFormat == 2) && ($context->language->is_rtl == 1)) {
                $cFormat = 4;
            }
            switch ($cFormat) {
                /* X 0,000.00 */
                case 1:
                    $ret = $cChar.$blank.number_format($price, $cDecimals, '.', ',');
                    break;
                /* 0 000,00 X*/
                case 2:
                    $ret = number_format($price, $cDecimals, ',', ' ').$blank.$cChar;
                    break;
                /* X 0.000,00 */
                case 3:
                    $ret = $cChar.$blank.number_format($price, $cDecimals, ',', '.');
                    break;
                /* 0,000.00 X */
                case 4:
                    $ret = number_format($price, $cDecimals, '.', ',').$blank.$cChar;
                    break;
                /* X 0'000.00  Added for the switzerland currency */
                case 5:
                    $ret = number_format($price, $cDecimals, '.', "'").$blank.$cChar;
                    break;
            }
            if ($isNegative) {
                $ret = '-'.$ret;
            }
            if ($noUtf8) {
                return str_replace('€', chr(128), $ret);
            }
    
            return $ret;
        }
    
        $price = Tools::ps_round($price, $currencyDecimals);
        $languageIso = $context->language->language_code;
    
        $currencyRepository = new CurrencyRepository();
        $numberFormatRepository = new NumberFormatRepository();
    
        try {
            $currency = $currencyRepository->get(mb_strtoupper($currencyIso));
        } catch (\CommerceGuys\Intl\Exception\UnknownCurrencyException $e) {
            $numberFormat = $numberFormatRepository->get($languageIso);
            $decimalFormatter = new NumberFormatter($numberFormat, NumberFormatter::DECIMAL);
    
            return $decimalFormatter->format($price);
        }
    
        if ($tbCurrency->sign) {
            $currency->setSymbol($tbCurrency->sign);
        }
        $numberFormat = $numberFormatRepository->get($languageIso);
    
        $currencyFormatter = new NumberFormatter($numberFormat, NumberFormatter::CURRENCY);
    
        return $currencyFormatter->formatCurrency($price, $currency);
    }
    


  • you cut off the first word in that code snippet…
    edit: there ya go. 😉



  • Sorry, but I can’t find them in /home/erolust/public_html/vendor/commerceguys/intl/scripts/currency/generate.php



  • double entry



  • @Generaal
    have on performance debug mode "on"
    if it is activated appears with me in some cases such message
    debug mod “off” and its ok



  • thnx 4 the advice, I have replace it, and all works fine!
    Up to the next prob! “Send to a friend” don’t send the email, when I click on the Send button, there happens nothing…

    Best Regards,
    Roger



  • @Generaal you might wanna start a new thread for that one, and mark this one solved.



  • I will do, SliCK_303, first search “how to do” the placement [SOLVED]



  • I can’t find the option to place the first message on “SOLVED” I haven’t the required menu.



  • you click on the 3 little vertical dots on the right of one of your posts, the option to mark it solved is there.



  • Hello SLiCK-303,
    I have found the 3 dots early, but there are no option to go…
    0_1516191705128_Solved.png



  • Did you look on one of YOUR posts, but not the first one?


 

Looks like your connection to thirty bees forum was lost, please wait while we try to reconnect.