1

I have 1200 products and all have prices like 12.99, 69.65, 55.24 etc. I want to round the price in my complete site everywhere so that functionality will not break and it will display rounded price in frontend.

Tell me any possible and easy way to round prices of products.

closed as unclear what you're asking by Fabian Schmengler, Qaisar Satti, Amit Bera, Raphael at Digital Pianism, Keyul Shah Jan 25 '17 at 20:10

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • magento.stackexchange.com/questions/60353/… You can use round() function – user49777 Jan 25 '17 at 12:04
  • I need to override this function. So , on checkout page , default it will display round prices right ??? – MMMMMMM Jan 25 '17 at 12:09
  • Welcome to Magento SE. Please explain what you mean by "functionality will not break". Do you still want to sell the products for like 12.99 but show rounded prices everywhere? (that sounds like you might get into legal trouble, but I don't know where you are located) Or do you want to sell them for the rounded prices? Do you still need the original prices? – Fabian Schmengler Jan 25 '17 at 12:09
  • i want to sell them for rounded prices but i don't want to change my 1200 product prices. – MMMMMMM Jan 25 '17 at 12:09
  • 1
    Possible duplicate of Rounding products prices in magento? – chirag Jan 25 '17 at 12:20
0

Extends core model Mage_Directory_Model_Currency and paste the below code.

public function convert($price, $toCurrency = null) {
    if (is_null($toCurrency)) {
        return $price;
    } elseif ($rate = $this->getRate($toCurrency)) {
        $priceValue = $price * $rate;
        $priceValue = $this->_roundPrice($priceValue);
        return $priceValue;
    }
    throw new Exception(Mage::helper('directory')->__('Undefined rate from "%s-%s".', $this->getCode(), $toCurrency->getCode()));
}
protected function _roundPrice($price) {
    return $roundedPrice = round($price);
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.