Recent Post

All Pages

Like Us On Facebook

About

Gallery

Thứ Sáu, 5 tháng 9, 2014

Currency - Bỏ 2 chữ số thập phân của giá sản phẩm trong Magento



Ban đầu: 22.000,00đ
Kết quả: 22.000đ
Cách thực hiện như sau:

Bước 1: 
Vào thư mục code/core/Mage/Directory/Model/Currency.php
Copy file Currency.php và chuyển vào thư mục
code/local/Mage/Directory/Model/Currency.php
( Làm việc này để tránh tác động vào lõi code core của Magento, thuận tiện cho việc nâng cấp Magento sau này.)

Bước 2:
Mở file Currency.php trong code/local/Mage/Directory/Model/Currency.php bằng chương trình chỉnh sửa file text, ví dụ như notepad. Tìm đến dòng code xung quanh dòng 194.

public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
{ return $this->formatPrecision($price, 2, $options, $includeContainer, $addBrackets);
}
Thay thế số 2 thành số 0. Lưu file.
 
public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
{ return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);
}

Sau đó clear Cache trong Magento, vào Admin truy cập menu System –> Cache Management => Refresh Cache ( Nhớ Select All )
- Nếu kết quả vẫn chưa như ý muốn, bạn vào thư mục var/cache xóa thư mục cache, sau đó refresh lại website.
Chúc bạn thành công !

Email Newsletter



Smiley :)
:D
:)
:[
;)
:D
:O
(6)
(A)
:'(
:|
:o)
8)
(K)
(M)

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

Đăng nhận xét

Biểu mẫu liên hệ

Tên

Email *

Thông báo *