8000 Search for variants by EAN · Issue #34567 · Dolibarr/dolibarr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Search for variants by EAN #34567
@developmentOYR

Description

@developmentOYR

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.

Image

We obtain the EAN13 of a product with a variant:

Image

We place an order and search for the variant by EAN13:

Image

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";
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis is a bug (something does not work as expected)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0