I am working hard to configure, translate and prepare Dolibarr for my company. I saw that there are no quantity types for products. This means that if we want to sell some kind of pipe or liquid, we can’t sell it by meters (pipe) or litres (liquids).
This will make our work a little bit harder, because we will need to calculate all prices per piece.
Ex.
1m. pipe A costs 5 Euro, but 1 pipe (3 meters long) will cost 15 Euro.
If there is some solution to add different quantity types, it will save hours of price recalculations to us and many others.
If there is other solution which is present in the current version, I will be happy to hear about it, but I didn’t find one.
Hello
here is a theoretical, and probably practible solution: you can add with the module custom_fields an additional field for the quantity type (Kg, liter, m2 and so on) and here is the link how to generate a PDF template containing it.
I have tried to use the suggestion by Romer. It was unsuccessful, because I am using version 3.3.2 and there is no CustomFields module in it.
I found that it is implemented by the developers and all additional fields are “tagged” as Extra fields. I couldn’t find a way to retrieve information for these fields during PDF document generation. I’m not saying there is no way. I just don’t have enough time to find out how to do it.
I am using print_r just to observe the results and see where the method is storing the information. I didn’t find any value. The “array_options” property of the Object is empty array. When I saw this I opened the declaration of the method “fetch_optionals” just to see what it does. I added the following line:
echo'<pre>';print_r($optionsArray);die();
so the php code of the method looks like:
function fetch_optionals($rowid,$optionsArray='')
{
if (! is_array($optionsArray))
{
// optionsArray not already loaded, so we load it
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$optionsArray = $extrafields->fetch_name_optionals_label();
}
echo'<pre>';print_r($optionsArray);die();
....
$optionsArray is an empty array. By my opinion this array should contain all of the extrafields that are defined. I have defined only one extrafield for the products. I was expecting to see in this array the defined extra field, but I found nothing.
As I am not familiar with Dolibarr code, I think that I’m doing something wrong. Could someone more familiar with Dolibarr code help me a little bit more with this problem?