how to get units
snabi opened this issue · comments
snabi commented
I cannot see units in the api from PIM
timonburkard commented
What exactly are you trying to do? Are you trying to get a list of all available units? Or are you trying to get the unit for a specific product value?
Getting all the units could be done as follows:
// Get metric units
$aMetricUnits = [];
foreach($api->getMeasureFamilyApi()->all() as $aMeasureFamily)
{
foreach($aMeasureFamily['units'] as $unit)
{
$aMetricUnits[$aMeasureFamily['code']][] = $unit;
}
}
LevFlavien commented
No detail provided, old thread, no answer, closing.