Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions htdocs/core/lib/ajax.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
console.log("Received answer from ajax GET, we populate array to return to the jquery autocomplete");
if (autoselect == 1 && data.length == 1) {
$("#search_'.$htmlnamejquery.'").val(item.value);
if (item.pbq) {
Comment thread
jyhere marked this conversation as resolved.
Outdated
// When product has only one price by qty and 1 result, must set data attributes before triggering change
$("#'.$htmlname.'").attr("data-pbq", item.pbq);
$("#'.$htmlname.'").attr("data-pbqup", item.price_ht);
$("#'.$htmlname.'").attr("data-pbqbase", item.pricebasetype);
$("#'.$htmlname.'").attr("data-pbqqty", item.qty);
$("#'.$htmlname.'").attr("data-pbqpercent", item.discount);
}
$("#'.$htmlnamejquery.'").val(item.key).trigger("change");
}
var label = "";
Expand Down