Jump to content

[Solved] error : change currency position for eg. 1$ to $1


Recommended Posts

to make it short,
I have just installed a new module for my "home featured".
my currency in this case is Rp.x ( already set x.0.000,00 in Back Office > Payment > Currencies )

everything currency position is correct, except the one in home featured, it shows x.Rp instead of Rp.x
what should I do to change the position?

here is the php file :
(if the tpl file is needed, let me know)


class HomeFeatured extends Module
   private $_html = '';
   private $_postErrors = array();

   function __construct()
       $this->name = 'homefeatured';
       $this->tab = 'Tools';
       $this->version = '0.9';


       $this->displayName = $this->l('Featured Products on the homepage');
       $this->description = $this->l('Displays Featured Products in the middle of your homepage');

   function install()
       if (!Configuration::updateValue('HOME_FEATURED_NBR', 8) OR !parent::install() OR !$this->registerHook('home'))
           return false;
       return true;

   public function getContent()
       $output = ''.$this->displayName.'';
       if (Tools::isSubmit('submitHomeFeatured'))
           $nbr = intval(Tools::getValue('nbr'));
           if (!$nbr OR $nbr <= 0 OR !Validate::isInt($nbr))
               $errors[] = $this->l('Invalid number of product');
               Configuration::updateValue('HOME_FEATURED_NBR', $nbr);
           if (isset($errors) AND sizeof($errors))
               $output .= $this->displayError(implode('
', $errors));
               $output .= $this->displayConfirmation($this->l('Settings updated'));
       return $output.$this->displayForm();

   public function displayForm()
       $output = '
       <form action="'.$_SERVER['REQUEST_URI'].'" method="post">
_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'

'.$this->l('In order to add products to your homepage, just add them to the "home" category.').'

'.$this->l('Number of product displayed').'

                   <input type="text" size="5" name="nbr" value="'.Tools::getValue('nbr', Configuration::get('HOME_FEATURED_NBR')).'" />

'.$this->l('The number of products displayed on homepage (default: 10)').'

<input type="submit" name="submitHomeFeatured" value="'.$this->l('Save').'" class="button" />

       return $output;

   function hookHome($params)
       global $smarty;
       $category = new Category(1);
       $nb = intval(Configuration::get('HOME_FEATURED_NBR'));
       $products = $category->getProducts(intval($params['cookie']->id_lang), 1, ($nb ? $nb : 10));
           'allow_buy_when_out_of_stock' => Configuration::get('PS_ORDER_OUT_OF_STOCK', false),
           'max_quantity_to_allow_display' => Configuration::get('PS_LAST_QTIES'),
           'category' => $category,
           'products' => $products,
           'currency' => new Currency(intval($params['cart']->id_currency)),
           'lang' => Language::getIsoById(intval($params['cookie']->id_lang)),
           'productNumber' => sizeof($products),
           'homeSize' => Image::getSize('home')
       return $this->display(__FILE__, 'homefeatured.tpl');


Share this post

Link to post
Share on other sites

  • 4 years later...
  • 6 months later...

If u want to change the currency position 1$ to $1 then follows steps:


1) GOTO - Back-end -> Localization

2) Edit The Currency -> Currency format

3) 0 000,00X (Such as with Euros) TO Change X0.000,00


And Your currency position change

Share this post

Link to post
Share on other sites

This topic is now closed to further replies.

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More