View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006348 | OXID eShop (all versions) | 2.2. Shop settings | public | 2016-03-11 15:18 | 2024-03-13 15:11 |
Reporter | sebastian.bauer | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | acknowledged | Resolution | open | ||
Product Version | 4.9.7 / 5.2.7 | ||||
Summary | 0006348: After fixing 0006319 the 'smarty_function_oxprice' got an undefined input case and responds a rounded price | ||||
Description | The price calculation rounds on special cases (brutto/netto). After fixing the bug 0006319, the smarty_function_oxprice i saw, that there is a case (we don't give in a currency and the settings currencies array (this could be the case, if the user doesn't fills the admin input field)) where the smarty function rounds, but shouldn't round. | ||||
Steps To Reproduce | Add the following test into the file /tests/unit/maintenance/pluginsmartyoxpriceTest.php, to have a running prove for this bug: /** * Test, that the oxprice smarty plugin will only print the price as a number (with german ".," notation), * if there is no value set in the currencies admin input and no currency given into the smarty plugin function. */ public function testNoCurrencyObjectAsParameterAndNotInConfig() { $oConfig = oxRegistry::getConfig(); $oConfig->setConfigParam('aCurrencies', array()); $aParams = array( 'price' => new oxPrice(1992.45), ); $oSmarty = new Smarty(); // we utf8 decode here to make the test more robust against shop settings $this->assertEquals(utf8_decode('1.992,45'), utf8_decode(smarty_function_oxprice($aParams, $oSmarty))); } | ||||
Tags | Internationalization Rework, Product domain and basket rewrite | ||||
Theme | Not defined | ||||
Browser | Not defined | ||||
PHP Version | Not defined | ||||
Database Version | Not defined | ||||
|
Add the following test into the file /tests/unit/maintenance/pluginsmartyoxpriceTest.php, to have a running prove for this bug: /** * Test, that the oxprice smarty plugin will only print the price as a number (with german ".," notation), * if there is no value set in the currencies admin input and no currency given into the smarty plugin function. */ public function testNoCurrencyObjectAsParameterAndNotInConfig() { $oConfig = oxRegistry::getConfig(); $oConfig->setConfigParam('aCurrencies', array()); $aParams = array( 'price' => new oxPrice(1992.45), ); $oSmarty = new Smarty(); // we utf8 decode here to make the test more robust against shop settings $this->assertEquals(utf8_decode('1.992,45'), utf8_decode(smarty_function_oxprice($aParams, $oSmarty))); } |
|
The following behavior is because no currency/precision information is given. When the below code in the steps to Reproduce- $oConfig->setConfigParam('aCurrencies', array()); is replaced with- $oConfig->setConfigParam('aCurrencies', array('EUR@ 1.00@ ,@ .@ @ 2')); then the test case passes without any error. When no precision for currency is provided then the default precision value in PHP(namely 0) is used. |
|
A new variable with default currency settings could be used, when no values are set in "Admin->Master Settings->Core Settings->Settings->Other Settings->Add or remove currencies" |