Fix unit generation (#35)
This commit is contained in:
parent
d6de01094e
commit
e7ab50afee
@ -266,6 +266,7 @@ class MoySkladICMLParser
|
|||||||
|
|
||||||
foreach ($response['rows'] as $assortiment) {
|
foreach ($response['rows'] as $assortiment) {
|
||||||
|
|
||||||
|
//var_dump($assortiment['uom']['externlaCode']);
|
||||||
if (!empty($assortiment['modificationsCount']) ||
|
if (!empty($assortiment['modificationsCount']) ||
|
||||||
$assortiment['meta']['type'] == 'service' ||
|
$assortiment['meta']['type'] == 'service' ||
|
||||||
$assortiment['meta']['type'] == 'consignment') {
|
$assortiment['meta']['type'] == 'consignment') {
|
||||||
@ -360,18 +361,34 @@ class MoySkladICMLParser
|
|||||||
$products[$assortiment['id']]['price'] = ((float)0);
|
$products[$assortiment['id']]['price'] = ((float)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($assortiment['uom']) && isset($assortiment['uom']['code'])) {
|
if (isset($assortiment['uom'])){
|
||||||
|
if (isset($assortiment['uom']['code'])){
|
||||||
$products[$assortiment['id']]['unit'] = array (
|
$products[$assortiment['id']]['unit'] = array (
|
||||||
'code' => $assortiment['uom']['code'],
|
'code' => $assortiment['uom']['code'],
|
||||||
'name' => $assortiment['uom']['name'],
|
'name' => $assortiment['uom']['name'],
|
||||||
'description' => $assortiment['uom']['description'],
|
'description' => $assortiment['uom']['description'],
|
||||||
);
|
);
|
||||||
} elseif (isset($assortiment['product']['uom']) && isset($assortiment['product']['uom']['code'])) {
|
} elseif (isset($assortiment['uom']['externalCode'])) {
|
||||||
|
$products[$assortiment['id']]['unit'] = array (
|
||||||
|
'code' => $assortiment['uom']['externalCode'],
|
||||||
|
'name' => str_replace(' ', '',$assortiment['uom']['name']),
|
||||||
|
'description' => $assortiment['uom']['name'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} elseif (isset($assortiment['product']['uom'])) {
|
||||||
|
if (isset($assortiment['uom']['code'])){
|
||||||
$products[$assortiment['id']]['unit'] = array (
|
$products[$assortiment['id']]['unit'] = array (
|
||||||
'code' => $assortiment['product']['uom']['code'],
|
'code' => $assortiment['product']['uom']['code'],
|
||||||
'name' => $assortiment['product']['uom']['name'],
|
'name' => $assortiment['product']['uom']['name'],
|
||||||
'description' => $assortiment['product']['uom']['description'],
|
'description' => $assortiment['product']['uom']['description'],
|
||||||
);
|
);
|
||||||
|
} elseif (isset($assortiment['product']['uom']['externalCode'])) {
|
||||||
|
$products[$assortiment['id']]['unit'] = array (
|
||||||
|
'code' => $assortiment['product']['uom']['externalCode'],
|
||||||
|
'name' => str_replace(' ', '',$assortiment['product']['uom']['name']),
|
||||||
|
'description' => $assortiment['product']['uom']['name'],
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$products[$assortiment['id']]['unit'] = '';
|
$products[$assortiment['id']]['unit'] = '';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user