Thứ Năm, 14 tháng 8, 2014

Thay đổi tiền tệ viêt nam trong magento

root/lib/Zend/Locale/Data/vi.xml 
Tìm:
 1.Trong <symbols>
                                     <symbols>
                                    <decimal>.</decimal> 
                                    <group>.</group>
                                    <list>;</list>
………….</symbols>
<!—từ dấu , sửa thành dấu .à định vị tiền 1,000 đ thành 1.000 đ
2.Bạn tìm function roundPrice() trong

app/code/core/Mage/Core/Model/Store.php 

public function roundPrice($price)
    {
        return round($price, 2);
    }
 Sửa lại thành=>
public function roundPrice($price,$roundTo=3)
    {
        return round($price, $roundTo);
    }
3.Tim /lib/zend/Currency.php 

protected $_options = array(
        'position'  => self::STANDARD,
        'script'    => null,
        'format'    => null,
        'display'   => self::NO_SYMBOL,
        'precision' => 2,
        'name'      => null,
        'currency'  => null,
        'symbol'    => null
    );
Thay bằng:
protected $_options = array(
        'position'  => self::STANDARD,
        'script'    => null,
        'format'    => null,
        'display'   => self::NO_SYMBOL,
        'precision' => 3,
        'name'      => null,
        'currency'  => null,
        'symbol'    => null
    );

4.Mở file Currency.php trong app\code\core\Mage\Directory\Mode
Tìm:

public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
    {
        return $this->formatPrecision($price, 2, $options, $includeContainer, $addBrackets);
    }
ð  Sửa lại thành số 3
public function format($price, $options = array(), $includeContainer = true, $addBrackets = false)
    {
        return $this->formatPrecision($price, 3, $options, $includeContainer, $addBrackets);
    }
5.Sửa định vị tiền hiển thị danh sách sản phẩm trong admin. Tìm

/js\varien\js.js: dòng 254:
    var r = (j ? i.substr(0, j) + groupSymbol : "") + i.substr(j).replace(re, "$1" + groupSymbol) + (precision ? decimalSymbol + Math.abs(price - i).toFixed(precision).replace(/-/, 0).slice(2) : "")
Thêm +'0' vào cuối dòng:
    var r = (j ? i.substr(0, j) + groupSymbol : "") + i.substr(j).replace(re, "$1" + groupSymbol) + (precision ? decimalSymbol + Math.abs(price - i).toFixed(precision).replace(/-/, 0).slice(2) : "")+'0'

vào trang admin xóa cache và xem kết quả

Không có nhận xét nào:

Đăng nhận xét