2

I need to rounds up the including vat sell price to closest £0.99 ie. if sell price for an item including vat is £10.52 it rounds up the sell price inc vat to £10.99 . In other words, so sell price always ends with £.99 at the end.

And the website automatically will need to change the excluding vat price to exactly 20% less that the rounded up price.

I believe there is some event where I can hook a function to apply this round up logic?

migrated from stackoverflow.com Dec 29 '13 at 8:08

This question came from our site for professional and enthusiast programmers.

1

This is similar to the "5 Rappen Rounding" in Switzerland, where the total always is a multiple of 0.05.

There is an extension for it that you should be able to build upon: https://github.com/openstream/Magento5CentRounding - it rewrites the subtotal and grandtotal models and hooks into their collect() methods.

0

This is not an answer to the question, but as a comment it would be unreadable :-/

Why do you want to do this?

Just configure magento to use price including tax, then set the prices where you want them. Magento handles the tax stuff for you.

If you then need to upround the prices, you can implement an observer which corrects the price to $product->setPrice(round($product->getPrice())-0.01) in the catalog_product_save_before event

  • Thanks for your thoughtful opinion. Problem is, the tax rate might vary based on region, so I can't save the rounded price. – Nahid Dec 29 '13 at 16:10
  • Magento applies the taxes depending on the shipping or invoice country - you can configure this in the backend too! – Fabian Blechschmidt Dec 29 '13 at 19:18
  • Yes, but problem is, whatever the final price after applying the tax is, I need that price to the closest £0.99 – Nahid Dec 30 '13 at 8:12
  • As I answered: implement an observer, round the price up and magento will handle the tax stuff – Fabian Blechschmidt Dec 30 '13 at 15:00
  • catalog_product_save_before will set my original product price. – Nahid Dec 31 '13 at 6:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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