Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6223277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:27:40+00:00 2026-05-24T08:27:40+00:00

I guys i try to make something link this with an override on a

  • 0

I guys i try to make something link this with an override on a prestashop function ConvertPrice (in Tools class) :

<span>750</span>,00€

With this code in my override :

/**
* Return price converted
*
* @param float $price Product price
* @param object $currency Current currency object
* @param boolean $to_currency convert to currency or from currency to default currency
*/
public static function convertPrice($price, $currency = NULL, $to_currency = true)
{
    if ($currency === NULL)
        $currency = Currency::getCurrent();
    elseif (is_numeric($currency))
        $currency = Currency::getCurrencyInstance($currency);

    $c_id = (is_array($currency) ? $currency['id_currency'] : $currency->id);
    $c_rate = (is_array($currency) ? $currency['conversion_rate'] : $currency->conversion_rate);

    if ($c_id != (int)(Configuration::get('PS_CURRENCY_DEFAULT')))
    {
        if ($to_currency)
            $price *= $c_rate;
        else
            $price /= $c_rate;
    }
    $price = explode(".", strval($price));
    $temp = '<span>'.$price[0]."</span>";
    $price[0] = $temp;
    return implode(".", $price);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T08:27:41+00:00Added an answer on May 24, 2026 at 8:27 am

    I founded a solution by myself, i didn’t edit the right function so there is the correct way :

    public static function displayPrice($price, $currency = NULL, $no_utf8 = false){
        if ($currency === NULL)
        $currency = Currency::getCurrent();
        if (is_int($currency))
            $currency = Currency::getCurrencyInstance((int)($currency));
        $c_char = (is_array($currency) ? $currency['sign'] : $currency->sign);
        $c_format = (is_array($currency) ? $currency['format'] : $currency->format);
        $c_decimals = (is_array($currency) ? (int)($currency['decimals']) : (int)($currency->decimals)) * _PS_PRICE_DISPLAY_PRECISION_;
        $c_blank = (is_array($currency) ? $currency['blank'] : $currency->blank);
        $blank = ($c_blank ? ' ' : '');
        $ret = 0;
        if (($isNegative = ($price < 0)))
            $price *= -1;
        $price = self::ps_round($price, $c_decimals);
        switch ($c_format){
            /* X 0,000.00 */
        case 1:
            $ret = $c_char.$blank.number_format($price, $c_decimals, '.', ',');
            break;
        /* 0000,00 X*/
        case 2:
            $ret = number_format($price, $c_decimals, ',', '').$blank.$c_char;
            $price = explode(",", strval($ret));
            $price[0] = '<span>'.$price[0]."</span>";
            $ret = implode(",", $price);
            break;
            /* X 0.000,00 */
            case 3:
            $ret = $c_char.$blank.number_format($price, $c_decimals, ',', '.');
            break;
        /* 0,000.00 X */
        case 4:
            $ret = number_format($price, $c_decimals, '.', ',').$blank.$c_char;
            break;
        }
        if ($isNegative)
            $ret = '-'.$ret;
        if ($no_utf8)
            return str_replace('€', chr(128), $ret);
        return $ret;
    }
    

    In override/classes/Tools.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello guys i try to get an object global/persistent over more than one php
hello guys i am try to print the output of two element data simultaneously
hello guys i am try to eliminate all the duplicate strings from a string
hello guys i am try to use the StringUtils.remove Method but the below exception
What I try to do Hello Guys, I'm creating an app, and I want
Hi guys I keep getting an error no image selected when I try and
Guys, I’ve been writing code for 15+ years, but managed to avoid Web Development
Would be great if you guys could shed some light on this, has baffled
I'll try to make myself clear with an example: Imagine an admin page to
Here's my code: @interface Game : Layer // this is from cocos2d { int

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.