├── docs └── images │ └── price-precision-admin.png ├── app ├── locale │ ├── en_US │ │ └── Aurmil_SetPricePrecision.csv │ ├── de_DE │ │ └── Aurmil_SetPricePrecision.csv │ └── fr_FR │ │ └── Aurmil_SetPricePrecision.csv ├── code │ └── community │ │ └── Aurmil │ │ └── SetPricePrecision │ │ ├── Model │ │ ├── Core │ │ │ ├── Store.php │ │ │ └── Locale.php │ │ ├── Sales │ │ │ └── Order.php │ │ └── Directory │ │ │ └── Currency.php │ │ ├── Block │ │ ├── Downloadable │ │ │ └── Adminhtml │ │ │ │ └── Catalog │ │ │ │ └── Product │ │ │ │ └── Edit │ │ │ │ └── Tab │ │ │ │ └── Downloadable │ │ │ │ └── Links.php │ │ └── Adminhtml │ │ │ ├── Catalog │ │ │ └── Product │ │ │ │ ├── Helper │ │ │ │ └── Form │ │ │ │ │ └── Price.php │ │ │ │ └── Edit │ │ │ │ └── Tab │ │ │ │ └── Options │ │ │ │ └── Option.php │ │ │ └── Tax │ │ │ └── Rate │ │ │ └── Grid │ │ │ └── Renderer │ │ │ └── Data.php │ │ ├── Helper │ │ └── Data.php │ │ └── etc │ │ ├── system.xml │ │ └── config.xml └── etc │ └── modules │ └── Aurmil_SetPricePrecision.xml ├── composer.json ├── .gitattributes ├── modman ├── README.md └── .gitignore /docs/images/price-precision-admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurmil/magento-set-price-precision/HEAD/docs/images/price-precision-admin.png -------------------------------------------------------------------------------- /app/locale/en_US/Aurmil_SetPricePrecision.csv: -------------------------------------------------------------------------------- 1 | "Price Precision","Price Precision" 2 | "Number of price decimals: 0 to remove, default is 2, maximum is 4.","Number of price decimals: 0 to remove, default is 2, maximum is 4." -------------------------------------------------------------------------------- /app/locale/de_DE/Aurmil_SetPricePrecision.csv: -------------------------------------------------------------------------------- 1 | "Price Precision","Preis Nachkommastellen" 2 | "Number of price decimals: 0 to remove, default is 2, maximum is 4.","Anzahl Nachkommastellen: 0 um zu deaktivieren, Standard ist 2, Maximum ist 4." 3 | -------------------------------------------------------------------------------- /app/locale/fr_FR/Aurmil_SetPricePrecision.csv: -------------------------------------------------------------------------------- 1 | "Price Precision","Précision des prix" 2 | "Number of price decimals: 0 to remove, default is 2, maximum is 4.","Nombre de décimales des prix : 0 pour supprimer, la valeur par défaut est 2, le maximum est 4." -------------------------------------------------------------------------------- /app/code/community/Aurmil/SetPricePrecision/Model/Core/Store.php: -------------------------------------------------------------------------------- 1 | getCalculablePrecision()); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /app/etc/modules/Aurmil_SetPricePrecision.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | community 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/code/community/Aurmil/SetPricePrecision/Block/Downloadable/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php: -------------------------------------------------------------------------------- 1 | getCalculablePrecision(), null, ''); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /app/code/community/Aurmil/SetPricePrecision/Helper/Data.php: -------------------------------------------------------------------------------- 1 | getCalculablePrecision(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/code/community/Aurmil/SetPricePrecision/Model/Sales/Order.php: -------------------------------------------------------------------------------- 1 | formatPricePrecision( 12 | $price, 13 | Mage::helper('aurmil_setpriceprecision')->getCalculablePrecision(), 14 | $addBrackets 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aurmil/magento-set-price-precision", 3 | "description": "Magento - Set Price Precision extension", 4 | "type": "magento-module", 5 | "keywords": ["price"], 6 | "homepage": "https://github.com/aurmil/magento-set-price-precision", 7 | "authors": [ 8 | { 9 | "name": "Aurélien Millet", 10 | "homepage": "http://www.aurelien-millet.fr/", 11 | "role": "Developer" 12 | } 13 | ], 14 | "require": { 15 | "magento-hackathon/magento-composer-installer": "*" 16 | } 17 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /app/code/community/Aurmil/SetPricePrecision/Block/Adminhtml/Catalog/Product/Helper/Form/Price.php: -------------------------------------------------------------------------------- 1 | getValue(); 8 | 9 | if (!is_numeric($value)) { 10 | return null; 11 | } 12 | 13 | return number_format($value, Mage::helper('aurmil_setpriceprecision')->getCalculablePrecision(), null, ''); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /modman: -------------------------------------------------------------------------------- 1 | # code 2 | app/code/community/Aurmil/SetPricePrecision app/code/community/Aurmil/SetPricePrecision 3 | 4 | # module declaration 5 | app/etc/modules/Aurmil_SetPricePrecision.xml app/etc/modules/Aurmil_SetPricePrecision.xml 6 | 7 | # German localization 8 | app/locale/de_DE/Aurmil_SetPricePrecision.csv app/locale/de_DE/Aurmil_SetPricePrecision.csv 9 | 10 | # English localization 11 | app/locale/en_US/Aurmil_SetPricePrecision.csv app/locale/en_US/Aurmil_SetPricePrecision.csv 12 | 13 | # French localization 14 | app/locale/fr_FR/Aurmil_SetPricePrecision.csv app/locale/fr_FR/Aurmil_SetPricePrecision.csv -------------------------------------------------------------------------------- /app/code/community/Aurmil/SetPricePrecision/Model/Directory/Currency.php: -------------------------------------------------------------------------------- 1 | formatPrecision( 12 | $price, 13 | Mage::helper('aurmil_setpriceprecision')->getCalculablePrecision(), 14 | $options, 15 | $includeContainer, 16 | $addBrackets 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/code/community/Aurmil/SetPricePrecision/Block/Adminhtml/Catalog/Product/Edit/Tab/Options/Option.php: -------------------------------------------------------------------------------- 1 | getCalculablePrecision(); 8 | if ($type == 'percent') { 9 | return number_format($value, $precision, null, ''); 10 | } elseif ($type == 'fixed') { 11 | return number_format($value, $precision, null, ''); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/code/community/Aurmil/SetPricePrecision/Block/Adminhtml/Tax/Rate/Grid/Renderer/Data.php: -------------------------------------------------------------------------------- 1 | getDisplayablePrecision()); 10 | } 11 | if (!is_null($data)) { 12 | return $data * 1; 13 | } 14 | return $this->getColumn()->getDefault(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/code/community/Aurmil/SetPricePrecision/Model/Core/Locale.php: -------------------------------------------------------------------------------- 1 | getCalculablePrecision(); 15 | $diff = $result['precision'] - $precision; 16 | 17 | $result['precision'] -= $diff; 18 | 19 | if (isset($result['requiredPrecision'])) { 20 | $result['requiredPrecision'] -= $diff; 21 | } 22 | } 23 | 24 | return $result; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/code/community/Aurmil/SetPricePrecision/etc/system.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 1 8 | 1 9 | 10 | 11 | 12 | 13 | text 14 | validate-digits validate-digits-range digits-range-0-4 validate-not-negative-number required-entry 15 | 5 16 | 1 17 | 1 18 | 1 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/code/community/Aurmil/SetPricePrecision/etc/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 2.1.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | Aurmil_SetPricePrecision_Block_Adminhtml_Catalog_Product_Helper_Form_Price 13 | Aurmil_SetPricePrecision_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Option 14 | Aurmil_SetPricePrecision_Block_Adminhtml_Tax_Rate_Grid_Renderer_Data 15 | 16 | 17 | 18 | 19 | Aurmil_SetPricePrecision_Block_Downloadable_Adminhtml_Catalog_Product_Edit_Tab_Downloadable_Links 20 | 21 | 22 | 23 | 24 | 25 | 26 | Aurmil_SetPricePrecision_Model_Core_Store 27 | Aurmil_SetPricePrecision_Model_Core_Locale 28 | 29 | 30 | 31 | 32 | Aurmil_SetPricePrecision_Model_Directory_Currency 33 | 34 | 35 | 36 | 37 | Aurmil_SetPricePrecision_Model_Sales_Order 38 | 39 | 40 | 41 | 42 | 43 | Aurmil_SetPricePrecision_Helper 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | Aurmil_SetPricePrecision.csv 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 2 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | :warning: work in progress :construction: 2 | 3 | 4 | # Magento - Set Price Precision extension 5 | 6 | ## Overview 7 | 8 | For some reason, you may need to change the number of decimals (precision) used when displaying prices in front office of your store. 9 | 10 | This extension allows you to set the precision you want. 11 | 12 | ## Compatibility 13 | 14 | Tested on Magento CE 1.6 - 1.9 15 | 16 | ## Notes 17 | 18 | * Free and open source 19 | * Fully configurable 20 | * Bundled with English, French and German (thanks to Thomas Klosinsky) translations 21 | 22 | ## Installation 23 | 24 | No Magento files will be modified but following classes will be extended and some of their methods overridden: 25 | 26 | * Mage\_Adminhtml\_Block\_Catalog\_Product\_Helper\_Form\_Price 27 | * Mage\_Adminhtml\_Block\_Catalog\_Product\_Edit\_Tab\_Options\_Option 28 | * Mage\_Adminhtml\_Block\_Tax\_Rate\_Grid\_Renderer\_Data 29 | * Mage\_Core\_Model\_Locale 30 | * Mage\_Core\_Model\_Store 31 | * Mage\_Directory\_Model\_Currency 32 | * Mage\_Downloadable\_Block\_Adminhtml\_Catalog\_Product\_Edit\_Tab\_Downloadable\_Links 33 | * Mage\_Sales\_Model\_Order 34 | 35 | ### Manually 36 | 37 | * Download the latest version of this module [here](https://github.com/aurmil/magento-set-price-precision/archive/master.zip) 38 | * Unzip it 39 | * Move the "app" folder into the root directory of your Magento application, it will be merged with the existing "app" folder 40 | 41 | ### With modman 42 | 43 | * ```$ modman clone git@github.com:aurmil/magento-set-price-precision.git``` 44 | 45 | ### With composer 46 | 47 | * Adapt the following "composer.json" file into yours: 48 | 49 | ``` 50 | { 51 | "require": { 52 | "aurmil/magento-set-price-precision": "dev-master" 53 | }, 54 | "repositories": [ 55 | { 56 | "type": "composer", 57 | "url": "http://packages.firegento.com" 58 | }, 59 | { 60 | "type": "vcs", 61 | "url": "git://github.com/aurmil/magento-set-price-precision" 62 | } 63 | ], 64 | "extra": { 65 | "magento-root-dir": "./" 66 | } 67 | } 68 | ``` 69 | 70 | * Install or update your composer project dependencies 71 | 72 | ## Usage 73 | 74 | In __System > Configuration > Catalog > Catalog > Price__, this extension adds a new option: __Price Precision__ 75 | 76 | ![](docs/images/price-precision-admin.png) 77 | 78 | * Set "2" (default value) to stay with the Magento basic behavior 79 | * Set a different value between 0 and 4 to change the price precision. 0 means no decimals will be displayed. 80 | 81 | __Avoiding side effect:__ 82 | 83 | If __Price Precision__ is changed in __default scope__, it will affect __admininstration area__ in some ways. For instance, in __Sales > Orders__ management, __Order Totals section__ will be affected. 84 | 85 | To avoid this behavior, let __Price Precision__ unchanged (value = "2") in __default scope __and change its value in __website scope__, for each website you have (or in __"store view" scope__ if needed). 86 | 87 | __Incomplete case:__ 88 | 89 | On product detail page of a configurable product, there are drop-down lists (one per attribute), to choose product options. Some options may vary the final price. In this case, the price difference is written into the option label (e.g.: +€50.00 or -$20.00). For these prices, the number of decimals is hard-coded in configurable.js and product.js files. This case is not managed by this extension. 90 | 91 | ## Changelog 92 | 93 | ### 2.1 94 | 95 | * ensure prices can be set with given precision 96 | 97 | ### 2.0 98 | 99 | * handle every product type 100 | * handle orders 101 | * fix admin display in "website" or "store view" mode 102 | 103 | ### 1.0 104 | 105 | * initial release 106 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .modgit/ 2 | app/code/community/Phoenix/ 3 | app/code/community/Cm/ 4 | app/code/core/ 5 | app/design/adminhtml/default/default/ 6 | app/design/frontend/base/ 7 | app/design/frontend/default/blank/ 8 | app/design/frontend/default/default/ 9 | app/design/frontend/default/iphone/ 10 | app/design/frontend/default/modern/ 11 | app/design/frontend/enterprise/default 12 | app/design/install/ 13 | app/etc/modules/Enterprise_* 14 | app/etc/modules/Mage_All.xml 15 | app/etc/modules/Mage_Api.xml 16 | app/etc/modules/Mage_Api2.xml 17 | app/etc/modules/Mage_Authorizenet.xml 18 | app/etc/modules/Mage_Bundle.xml 19 | app/etc/modules/Mage_Captcha.xml 20 | app/etc/modules/Mage_Centinel.xml 21 | app/etc/modules/Mage_Compiler.xml 22 | app/etc/modules/Mage_Connect.xml 23 | app/etc/modules/Mage_CurrencySymbol.xml 24 | app/etc/modules/Mage_Downloadable.xml 25 | app/etc/modules/Mage_ImportExport.xml 26 | app/etc/modules/Mage_LoadTest.xml 27 | app/etc/modules/Mage_Oauth.xml 28 | app/etc/modules/Mage_PageCache.xml 29 | app/etc/modules/Mage_Persistent.xml 30 | app/etc/modules/Mage_Weee.xml 31 | app/etc/modules/Mage_Widget.xml 32 | app/etc/modules/Mage_XmlConnect.xml 33 | app/etc/modules/Phoenix_Moneybookers.xml 34 | app/etc/modules/Cm_RedisSession.xml 35 | app/etc/applied.patches.list 36 | app/etc/config.xml 37 | app/etc/enterprise.xml 38 | app/etc/local.xml.additional 39 | app/etc/local.xml.template 40 | app/etc/local.xml 41 | app/.htaccess 42 | app/locale/**/Mage_*.csv 43 | app/locale/**/Phoenix_*.csv 44 | app/Mage.php 45 | /cron.php 46 | cron.sh 47 | downloader/ 48 | errors/ 49 | favicon.ico 50 | /get.php 51 | includes/ 52 | /index.php 53 | /index.php.sample 54 | /install.php 55 | js/blank.html 56 | js/calendar/ 57 | js/enterprise/ 58 | js/extjs/ 59 | js/firebug/ 60 | js/flash/ 61 | js/index.php 62 | js/jscolor/ 63 | js/lib/ 64 | js/mage/ 65 | js/prototype/ 66 | js/scriptaculous/ 67 | js/spacer.gif 68 | js/tiny_mce/ 69 | js/varien/ 70 | lib/3Dsecure/ 71 | lib/Apache/ 72 | lib/flex/ 73 | lib/googlecheckout/ 74 | lib/.htaccess 75 | lib/LinLibertineFont/ 76 | lib/Mage/ 77 | lib/PEAR/ 78 | lib/phpseclib/ 79 | lib/Varien/ 80 | lib/Zend/ 81 | lib/Cm/ 82 | lib/Credis/ 83 | lib/Magento/ 84 | LICENSE_AFL.txt 85 | LICENSE.html 86 | LICENSE.txt 87 | LICENSE_EE* 88 | mage 89 | media/customer/ 90 | media/dhl/ 91 | media/downloadable/ 92 | media/.htaccess 93 | media/import/ 94 | media/xmlconnect/ 95 | media/catalog/product/cache/ 96 | /api.php 97 | nbproject/ 98 | pear 99 | pear/ 100 | php.ini.sample 101 | pkginfo/ 102 | RELEASE_NOTES.txt 103 | shell/abstract.php 104 | shell/compiler.php 105 | shell/indexer.php 106 | shell/log.php 107 | skin/adminhtml/default/default/ 108 | skin/adminhtml/default/enterprise 109 | skin/frontend/base/ 110 | skin/frontend/default/blank/ 111 | skin/frontend/default/blue/ 112 | skin/frontend/default/default/ 113 | skin/frontend/default/french/ 114 | skin/frontend/default/german/ 115 | skin/frontend/default/iphone/ 116 | skin/frontend/default/modern/ 117 | skin/frontend/enterprise 118 | skin/install/ 119 | var/ 120 | 121 | # ========================= 122 | # Operating System Files 123 | # ========================= 124 | 125 | # OSX 126 | # ========================= 127 | 128 | .DS_Store 129 | .AppleDouble 130 | .LSOverride 131 | 132 | # Icon must end with two \r 133 | Icon 134 | 135 | 136 | # Thumbnails 137 | ._* 138 | 139 | # Files that might appear on external disk 140 | .Spotlight-V100 141 | .Trashes 142 | 143 | # Directories potentially created on remote AFP share 144 | .AppleDB 145 | .AppleDesktop 146 | Network Trash Folder 147 | Temporary Items 148 | .apdisk 149 | 150 | # Windows 151 | # ========================= 152 | 153 | # Windows image file caches 154 | Thumbs.db 155 | ehthumbs.db 156 | 157 | # Folder config file 158 | Desktop.ini 159 | 160 | # Recycle Bin used on file shares 161 | $RECYCLE.BIN/ 162 | 163 | # Windows Installer files 164 | *.cab 165 | *.msi 166 | *.msm 167 | *.msp 168 | --------------------------------------------------------------------------------