Jump to content

the word FREE instead of €0.00


Recommended Posts

I think the easiest way to change the price from 0.00 to "Free" is to create override/classes/Tools.php and enter the following code:

<?php

class Tools extends ToolsCore
{
    public static function displayPrice($price, $currency = null, $no_utf8 = false, Context $context = null)
    {
        if ($price == 0)
        {
            if (!$context)
                $context = Context::getContext();

            if ($context->language->id == 1)
                return 'Free';
            elseif ($context->language->id == 2)
                return 'Gratuite';
        }
        else
            return parent::displayPrice($price, $currency, $no_utf8, $context);
    }
}

Add another elseif statement for each of your languages. This will replace all 0.00 throughout the website with "Free". Remember to delete cache/class_index.php after creating the override.

Link to comment
Share on other sites

I think the easiest way to change the price from 0.00 to "Free" is to create override/classes/Tools.php and enter the following code:

<?php

class Tools extends ToolsCore
{
    public static function displayPrice($price, $currency = null, $no_utf8 = false, Context $context = null)
    {
        if ($price == 0)
        {
            if (!$context)
                $context = Context::getContext();

            if ($context->language->id == 1)
                return 'Free';
            elseif ($context->language->id == 2)
                return 'Gratuite';
        }
        else
            return parent::displayPrice($price, $currency, $no_utf8, $context);
    }
}

Add another elseif statement for each of your languages. This will replace all 0.00 throughout the website with "Free". Remember to delete cache/class_index.php after creating the override.

Hello!

 

Thank you again! It's working great ;)

 

Rui

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