Is it possible to get the "product description" to show up either in the product search or in the hover menu?

We have a lot of products with similiar properties. We write these properties in the description of the product, so we know which is what.

However, when we perform a search of one of the properties and get a list of matching products, we cannot immediately see which one is which, unless we go into the Product card and read.

Is there anyway to make the full product description show in the popup window, so we don’t have to go into the Product card for all the products? Or make description show up in the table? (That column is not selectable for some reason)

See screendump. It shows label, ref and price, we want “description” here too.

Yes,
you have to modify 2 files.

1.) search in ~/htdocs/product/list.php for the following

$sql = 'SELECT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type, p.entity,';

and add “p.description” to the query. Now it looks like the following

$sql = 'SELECT p.rowid, p.ref, p.description, p.label, p.fk_product_type, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type, p.entity,';

Next search for (same file)

	if (empty($reshook)) {
		$product_static->id = $obj->rowid;
		$product_static->ref = $obj->ref;
		$product_static->ref_fourn = empty($obj->ref_supplier) ? '' : $obj->ref_supplier; // deprecated

and add “$product_static->description = $obj->description;”. Now it looks like the following

	if (empty($reshook)) {
		$product_static->id = $obj->rowid;
		$product_static->ref = $obj->ref;
		$product_static->description = $obj->description;
		$product_static->ref_fourn = empty($obj->ref_supplier) ? '' : $obj->ref_supplier; // deprecated

2.) add in ~/htdocs/product/class/product.class.php
in public function getNomUrl(…)

		if (!empty($this->description)) {
			$label .= '<br><b>'.$langs->trans('ProductDescription').':</b> '.$this->description;
		}

after the line

		if (!empty($this->label)) {
			$label .= '<br><b>'.$langs->trans('ProductLabel').':</b> '.$this->label;
		}

This shows the description of the product when you hover the ref of the product in the list view.

1 Like

HI @DG-Rilling
Could you please make a pr for that, it is very useful!

1 Like

In version 18 the second change must be modified as follows:
2.) add in ~/htdocs/product/class/product.class.php
in

public function getTooltipContentArray($params)

		if (!empty($this->description)) {
			$datas['description']= '<br><b>'.$langs->trans('ProductDescription').':</b> '.$this->description;
		}

after the line

		if (!empty($this->label)) {
			$datas['label']= '<br><b>'.$langs->trans('ProductLabel').':</b> '.$this->label;
		}

@sonikf
I hope that I have created the pr correctly. Is my first pr :wink:

1 Like

Hi,
changing the code of Dolibarr modules is never a good idea, at the next update you will lose the changes.
Try to see if you can do the same thing with a hook.

Hi @ksar,
Please mark @DG-Rilling answer as the solution.
His related commit was merged Show product description by tgsw · Pull Request #26193 · Dolibarr/dolibarr · GitHub

1 Like

I made a quick-hack by patching the code to show the Description field as well, and I must say it should definately be implemented (for real, and not using my quick-hack which will be gone in next upgrade). It’s very useful and looks like this in our setup:

The suggestion is in ticket #26142 on github: Make product description available as a column · Issue #26142 · Dolibarr/dolibarr · GitHub and I hope someone can implement it.

1 Like

Hello,

Why do you not push to a Pull Request in GitHub ?

Even if it’s your first one, it’s quite easy to do, and you seem familiar with GitHub !

1 Like

@ksar I use git and github for my own project, but it’s over my head how to make PR for projects I’m not a collaborator on. So I guess I simply will have to read up on how to do something like that.

1 Like

I think, this feature has just been merged into develop, as also @sonikf mentioned in an earlier message:

Yes, the “hover to show description” is being merged but I’m talking about “Enabling the Description column in Product list”. Github issue #26142.

Hello, it seems to be already don on the develop branch (line 227 here https://github.com/Dolibarr/dolibarr/blob/develop/htdocs/product/list.php).
With that the description column is available in the columns list choice.

@altatof It exists because I created it two days ago, after @ksar suggested me to make a PR myself.

See Update list.php by bos4711 · Pull Request #26287 · Dolibarr/dolibarr · GitHub

3 Likes