VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Studio 42 on December 08, 2016, 22:03:26 PM

Title: VirtueMart 3.0.18.5 Blue Corvus 9390, sold in grams
Post by: Studio 42 on December 08, 2016, 22:03:26 PM
Hi, the team ,
I have another unit now to use that is not in the list : Grams !
Product Packaging > list of unit You have only Kg and 100g, but in my case Gram is the unit, all products are sold using 2g, 5g, 10g packaging ..
For now, i have to hack the code to add it in the list, but i think that this is really a missing and is not a big deal to add

Grams is an iso unit, why i cannot find this in the list ? Some reason ?
THis are Parapharmaceutical products and gram is the official unit used.

Regards,
Patrick



VirtueMart 3.0.18.5 Blue Corvus 9390
Title: Re: VirtueMart 3.0.18.5 Blue Corvus 9390, sold in grams
Post by: lindapowers on December 09, 2016, 14:25:23 PM
Hi, yes we noticed that too since we added herbs and spices of weights like 9 grams, 1 gram etc

Title: Re: VirtueMart 3.0.18.5 Blue Corvus 9390, sold in grams
Post by: Studio 42 on December 09, 2016, 17:04:46 PM
I changed the list

static function renderUnitIsoList($name, $selected){

$weight_unit_default = array(
'KG' => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_KG')
, '100G' => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_100G')
, 'G' => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_G')
, 'M'   => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_M')
, 'SM'   => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_SM')
, 'CUBM'   => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_CUBM')
, 'L'   => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_L')
, '100ML'   => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_100ML')
);
foreach ($weight_unit_default as  $key => $value) {
$wu_list[] = JHtml::_ ('select.option', $key, $value, $name);
}
$listHTML = JHtml::_ ('Select.genericlist', $wu_list, $name, '', $name, 'text', $selected);
return $listHTML;
}


But i had already a problem about this list to display price / per UNIT, so an editable list is the solution, because if you update VM and forget your change. Then the symbol get removed if you add a custom symbol and save the product because this symbol is not in the ISO list.