akeneo / api-php-client

PHP client of Akeneo PIM API

Home Page:https://packagist.org/packages/akeneo/api-php-client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to get units

snabi opened this issue · comments

commented

I cannot see units in the api from PIM

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

No detail provided, old thread, no answer, closing.