-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Bug
If you have the variants module activated and you search for one of the variants using EAN13, It Doesn't Find It.
In the case where the configuration is:
Module setup Product Variants:
Hide products variant in the products selector yes
Products and Services modules setup:
Wait until you press a key before loading content of product combo list (This may increase performance if you have a large number of products, but it is less convenient):
No
Dolibarr Version
21.01
Environment PHP
php 8.2
Environment Database
mysqlnd 8.3.21
Steps to reproduce the behavior and expected behavior
We check and if necessary we configure.
We obtain the EAN13 of a product with a variant:
We place an order and search for the variant by EAN13:
As we can see the product does not load.
To solve this I think we could create a global variable SEARCH_VARIANTS_OF_EAN13:
In file htdocs-> core -> class->html.form.class.php
In the method select_produits_list:
We replace this:
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD') ) {
$sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";
}
$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')';
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD') ) {
$sql .= " AND pac.rowid IS NULL";
}
With this :
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD') ) {
if (getDolGlobalString('SEARCH_VARIANTS_OF_EAN13') ) {
if(strlen($filterkey)!=13){
$sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";
}
}else{
$sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";
}
}
$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')';
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD') ) {
if (getDolGlobalString('SEARCH_VARIANTS_OF_EAN13') ) {
if(strlen($filterkey)!=13){
$sql .= " AND pac.rowid IS NULL";
}
}else{
$sql .= " AND pac.rowid IS NULL";
}
}