Following #1558380: Add a price comparison condition, the amount entered in the price amount field gets truncated when the value is >= 1000.

In _commerce_price_rules_data_ui_element_validate() the amount is passed through number_format(). PHP docs state that

Note: PHP doesn't handle strings like "12,300.2" correctly by default.

Any value >= 1000 ends up being formatted to that which results in everything after the comma being dropped when rounding.

CommentFileSizeAuthor
#1 commerce-price_comparison-1828222-0.patch751 bytesmalberts
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

malberts’s picture

Added 2 missing parameters as used by number_format elsewhere in commerce_price.module.

malberts’s picture

Status: Active » Needs review

Changing status.

Status: Needs review » Needs work

The last submitted patch, commerce-price_comparison-1828222-0.patch, failed testing.

rszrama’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
Status: Needs work » Needs review

Bug confirmed; letting testbot take another stab at this.

rszrama’s picture

rszrama’s picture

Status: Needs review » Fixed

Committed. Thanks for the quick fix, malberts!

(And welcome to the committers log. : )

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.