Merge pull request #23839 from marcusdeangabriel/SELECT_PRODUITS_LIST
Add hooks to select_produits_list
This commit is contained in:
commit
386a91c666
@ -2614,7 +2614,15 @@ class Form
|
||||
}
|
||||
|
||||
$sql = "SELECT ";
|
||||
$sql .= $selectFields . $selectFieldsGrouped;
|
||||
|
||||
// Add select from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('selectProductsListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
$sql .= $selectFields.$selectFieldsGrouped.$hookmanager->resPrint;
|
||||
} else {
|
||||
$sql .= $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PRODUCT_SORT_BY_CATEGORY)) {
|
||||
//Product category
|
||||
@ -2660,7 +2668,13 @@ class Form
|
||||
$sql .= " DESC LIMIT 1) as price_by_qty";
|
||||
$selectFields .= ", price_rowid, price_by_qty";
|
||||
}
|
||||
$sql .= " FROM " . $this->db->prefix() . "product as p";
|
||||
|
||||
$sql .= " FROM ".$this->db->prefix()."product as p";
|
||||
// Add from (left join) from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('selectProductsListFrom', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
if (count($warehouseStatusArray)) {
|
||||
$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";
|
||||
$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")";
|
||||
@ -2932,6 +2946,7 @@ class Form
|
||||
protected function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel = 0, $filterkey = '', $novirtualstock = 0)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $hookmanager;
|
||||
|
||||
$outkey = '';
|
||||
$outval = '';
|
||||
@ -3217,6 +3232,14 @@ class Form
|
||||
}
|
||||
}
|
||||
|
||||
$parameters = array('objp'=>$objp);
|
||||
$reshook = $hookmanager->executeHooks('constructProductListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
$opt .= $hookmanager->resPrint;
|
||||
} else {
|
||||
$opt = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
$opt .= "</option>\n";
|
||||
$optJson = array(
|
||||
'key' => $outkey,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user