Skip to content

Commit

Permalink
Fix : product price by quantity was removing default price (#29899)
Browse files Browse the repository at this point in the history
  • Loading branch information
atm-maxime authored Jun 8, 2024
1 parent 26e09f8 commit 956d1b0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions htdocs/product/price.php
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,9 @@
if ($action == 'activate_price_by_qty') {
// Activating product price by quantity add a new price line with price_by_qty set to 1
$level = GETPOST('level', 'int');
$ret = $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1);
$basePrice = ($object->price_base_type == 'HT') ? $object->price : $object->price_ttc;
$basePriceMin = ($object->price_base_type == 'HT') ? $object->price_min : $object->price_min_ttc;
$ret = $object->updatePrice($basePrice, $object->price_base_type, $user, $object->tva_tx, $basePriceMin, $level, $object->tva_npr, 1);

if ($ret < 0) {
setEventMessages($object->error, $object->errors, 'errors');
Expand All @@ -513,7 +515,9 @@
if ($action == 'disable_price_by_qty') {
// Disabling product price by quantity add a new price line with price_by_qty set to 0
$level = GETPOST('level', 'int');
$ret = $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 0);
$basePrice = ($object->price_base_type == 'HT') ? $object->price : $object->price_ttc;
$basePriceMin = ($object->price_base_type == 'HT') ? $object->price_min : $object->price_min_ttc;
$ret = $object->updatePrice($basePrice, $object->price_base_type, $user, $object->tva_tx, $basePriceMin, $level, $object->tva_npr, 0);

if ($ret < 0) {
setEventMessages($object->error, $object->errors, 'errors');
Expand Down

0 comments on commit 956d1b0

Please sign in to comment.