I want to change the numbers format in magento1.9 with call the function like and call it in different directories like app\design\frontend\ves_arcana\default\template\catalog\product\price.phtml anywhere that the numbers is in use.

Where should I define it?

function farsidigit($text) {
    $text = str_replace('0' , '٠' , $text);
    $text = str_replace('1' , '١' , $text);
    $text = str_replace('2' , '٢' , $text);
    $text = str_replace('3' , '٣' , $text);
    $text = str_replace('4' , '۴' , $text);
    $text = str_replace('5' , '۵' , $text);
    $text = str_replace('6' , '۶' , $text);
    $text = str_replace('7' , '٧' , $text);
    $text = str_replace('8' , '٨' , $text);
    $text = str_replace('9' , '٩' , $text);
    return $text;
}
有帮助吗?

解决方案

Call method helper class, then call any where like that

Mage::helper('module/something')->doSomething();
许可以下: CC-BY-SA归因
scroll top