{"action":"created","issue":{"url":"https://api.github.com/repos/bezumkin/miniShop2/issues/204","repository_url":"https://api.github.com/repos/bezumkin/miniShop2","labels_url":"https://api.github.com/repos/bezumkin/miniShop2/issues/204/labels{/name}","comments_url":"https://api.github.com/repos/bezumkin/miniShop2/issues/204/comments","events_url":"https://api.github.com/repos/bezumkin/miniShop2/issues/204/events","html_url":"https://github.com/bezumkin/miniShop2/issues/204","id":143024142,"number":204,"title":"Некорректная работа опции \"Убирать лишние нули\" при формате цен [0, \".\", \" \"]","user":{"login":"inogo","id":1255458,"avatar_url":"https://avatars.githubusercontent.com/u/1255458?v=3","gravatar_id":"","url":"https://api.github.com/users/inogo","html_url":"https://github.com/inogo","followers_url":"https://api.github.com/users/inogo/followers","following_url":"https://api.github.com/users/inogo/following{/other_user}","gists_url":"https://api.github.com/users/inogo/gists{/gist_id}","starred_url":"https://api.github.com/users/inogo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inogo/subscriptions","organizations_url":"https://api.github.com/users/inogo/orgs","repos_url":"https://api.github.com/users/inogo/repos","events_url":"https://api.github.com/users/inogo/events{/privacy}","received_events_url":"https://api.github.com/users/inogo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-03-23T17:17:38Z","updated_at":"2016-09-28T05:35:48Z","closed_at":null,"body":"Не совсем баг, скорее недочет. Если в качестве формата цены указать \\[0, \".\", \" \"\\] (т. е. округлять до рубля) при активной опции \"Убирать лишние нули в ценах\", то в корзине нули отсекаются от целой части числа. Например, сумма 4900 форматируется в \"4 9\", вместо ожидаемого \"4 900\".\r\n\r\nПричина ошибки в файле /assets/components/minishop2/js/web/default.js, а именно в функции [miniShop2.Utils.formatPrice](https://github.com/bezumkin/miniShop2/blob/master/assets/components/minishop2/js/web/default.js#L486-L495).\r\n\r\nНа этом участке кода:\r\n```javascript\r\nif (miniShop2Config.price_format_no_zeros) {\r\n\tprice = price.replace(/(0+)$/, '');\r\n\tprice = price.replace(/[^0-9]$/, '');\r\n}\r\n```\r\n\r\nМожно добавить проверку:\r\n```javascript\r\nif (pf[0] > 0 && miniShop2Config.price_format_no_zeros) {\r\n\tprice = price.replace(/(0+)$/, '');\r\n\tprice = price.replace(/[^0-9]$/, '');\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/bezumkin/miniShop2/issues/comments/250076113","html_url":"https://github.com/bezumkin/miniShop2/issues/204#issuecomment-250076113","issue_url":"https://api.github.com/repos/bezumkin/miniShop2/issues/204","id":250076113,"user":{"login":"bezumkin","id":1257284,"avatar_url":"https://avatars.githubusercontent.com/u/1257284?v=3","gravatar_id":"","url":"https://api.github.com/users/bezumkin","html_url":"https://github.com/bezumkin","followers_url":"https://api.github.com/users/bezumkin/followers","following_url":"https://api.github.com/users/bezumkin/following{/other_user}","gists_url":"https://api.github.com/users/bezumkin/gists{/gist_id}","starred_url":"https://api.github.com/users/bezumkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bezumkin/subscriptions","organizations_url":"https://api.github.com/users/bezumkin/orgs","repos_url":"https://api.github.com/users/bezumkin/repos","events_url":"https://api.github.com/users/bezumkin/events{/privacy}","received_events_url":"https://api.github.com/users/bezumkin/received_events","type":"User","site_admin":false},"created_at":"2016-09-28T05:35:48Z","updated_at":"2016-09-28T05:35:48Z","body":"Просьба проверить наличие бага в версии 2.4+"}}
{"actor":{"display_login":"bezumkin"}}