Skip to content

Commit 2be6669

Browse files
committed
MAGETWO-39705: It's possible to specify discount more than 100% in Catalog Price Rule
1 parent 6198d3f commit 2be6669

File tree

1 file changed

+3
-7
lines changed
  • app/code/Magento/CatalogRule/Model

1 file changed

+3
-7
lines changed

app/code/Magento/CatalogRule/Model/Rule.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@
4242
*/
4343
class Rule extends \Magento\Rule\Model\AbstractModel
4444
{
45-
const PERCENTAGE_VALIDATION_ERR_MSG = 'Percentage discount should be between 0 and 100.';
46-
const NOT_NEGATIVE_VALIDATION_ERR_MSG = 'Discount value should be 0 or greater.';
47-
const INCORRECT_ACTION_ERR_MSG = 'Unknown action.';
48-
4945
/**
5046
* Prefix of model events names
5147
*
@@ -388,17 +384,17 @@ protected function validateDiscount($action, $discount)
388384
case 'by_percent':
389385
case 'to_percent':
390386
if ($discount < 0 || $discount > 100) {
391-
$result[] = __(self::PERCENTAGE_VALIDATION_ERR_MSG);
387+
$result[] = __('Percentage discount should be between 0 and 100.');
392388
};
393389
break;
394390
case 'by_fixed':
395391
case 'to_fixed':
396392
if ($discount < 0) {
397-
$result[] = __(self::NOT_NEGATIVE_VALIDATION_ERR_MSG);
393+
$result[] = __('Discount value should be 0 or greater.');
398394
};
399395
break;
400396
default:
401-
$result[] = __(self::INCORRECT_ACTION_ERR_MSG);
397+
$result[] = __('Unknown action.');
402398
}
403399
return $result;
404400
}

0 commit comments

Comments
 (0)