Author Topic: Round to nearest 5 / 10  (Read 1723 times)

Za42

  • Beginner
  • *
  • Posts: 15
Round to nearest 5 / 10
« on: November 23, 2015, 14:37:53 pm »
Hello there,

I was wondering if there is a way to round the discounted final sales price to the nearest 5 THB or nearest 10 THB.

Using the discount calculation is great, but I would prefer the final sales price to be in multiples of 5 THB.

Site is www.divegearthailand.com

Using Joomla 3.4.3, VM 3.0.9.4

All help much appreciated!

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10298
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Round to nearest 5 / 10
« Reply #1 on: November 23, 2015, 14:47:06 pm »
never tried but heard a rumour that the VM config setting -> Use the Rappenrundung for Swiss CHF  -- rounds to 5/10..
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10144
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Round to nearest 5 / 10
« Reply #2 on: November 27, 2015, 14:26:34 pm »
to .00 or .05, yes
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10298
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Round to nearest 5 / 10
« Reply #3 on: November 28, 2015, 02:00:09 am »
Did a bit of work on this...   Use the Rappenrundung for Swiss CHF  only affects the display

to get it to work on the actual amounts being used in calc (tax, the stored amounts etc) it needed a hack to the the administrator\components\com_virtuemart\helpers\calculationh.php

only use if $this->vendorCurrency_numeric==756 if Swiss francs

function roundInternal($value,$name = 0) {
if(!$this->_roundindig and $name!==0){
if($this->vendorCurrency_numeric==756 and VmConfig::get('rappenrundung',FALSE)=="1"){
//vmdebug('roundInternal rounding using rappenrundung');
return round((float)$value * 2,1) * 0.5;
}elseif(isset($this->_currencyDisplay->_priceConfig[$name][1])){
vmdebug('roundInternal rounding use '.$this->_currencyDisplay->_priceConfig[$name][1].' digits');
return round($value,$this->_currencyDisplay->_priceConfig[$name][1]);
} else {
vmdebug('roundInternal rounding not found for '.$name,$this->_currencyDisplay->_priceConfig[$name]);
return round($value, $this->_internalDigits);
}
} else {
return round($value, $this->_internalDigits);
}
}
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation