Skip to content

Commit ad5102e

Browse files
authored
FIX: products with a single price by qty may have empty price when adding it in a commercial piece (#33509)
* FIX: products with a single price by qty may have empty price when adding it in a commercial piece * FIX: products with a single price by qty may have empty price when adding it in a commercial piece
1 parent a522442 commit ad5102e

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

htdocs/core/lib/ajax.lib.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,18 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
130130
console.log("Received answer from ajax GET, we populate array to return to the jquery autocomplete");
131131
if (autoselect == 1 && data.length == 1) {
132132
$("#search_'.$htmlnamejquery.'").val(item.value);
133+
';
134+
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
135+
$script .= '
136+
// When product has only one price by qty and 1 result, must set data attributes before triggering change
137+
$("#'.$htmlname.'").attr("data-pbq", item.pbq);
138+
$("#'.$htmlname.'").attr("data-pbqup", item.price_ht);
139+
$("#'.$htmlname.'").attr("data-pbqbase", item.pricebasetype);
140+
$("#'.$htmlname.'").attr("data-pbqqty", item.qty);
141+
$("#'.$htmlname.'").attr("data-pbqpercent", item.discount);
142+
';
143+
}
144+
$script .= '
133145
$("#'.$htmlnamejquery.'").val(item.key).trigger("change");
134146
}
135147
var label = "";

0 commit comments

Comments
 (0)