fix bug ۲
This commit is contained in:
@@ -265,13 +265,17 @@ class Product extends Model
|
||||
$min = $this->min_order_cash;
|
||||
$max = $this->max_order_cash;
|
||||
|
||||
if ($min !== null && $totalPriceRial < (float) $min) {
|
||||
// یک ریال تلرانس — وقتی target_cash به گرم تبدیل و دوباره ضرب میشود ممکن است
|
||||
// total_price موقت چند ریال از حداقل کمتر شود (مثلاً دقیقاً ۲۰۰,۰۰۰,۰۰۰).
|
||||
$toleranceRial = 1.0;
|
||||
|
||||
if ($min !== null && $totalPriceRial + $toleranceRial < (float) $min) {
|
||||
throw new \Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException(
|
||||
'حداقل مبلغ این محصول ' . number_format((float) $min) . ' ریال میباشد'
|
||||
);
|
||||
}
|
||||
|
||||
if ($max !== null && $totalPriceRial > (float) $max) {
|
||||
if ($max !== null && $totalPriceRial > (float) $max + $toleranceRial) {
|
||||
throw new \Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException(
|
||||
'حداکثر مبلغ این محصول ' . number_format((float) $max) . ' ریال میباشد'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user