mirror of
https://github.com/retailcrm/legacy.git
synced 2025-02-21 09:13:16 +03:00
fix motice generate category
This commit is contained in:
parent
af8ec4657a
commit
f25a3937dc
@ -74,6 +74,10 @@ class IcmlHelper
|
|||||||
private function addCategories($categories)
|
private function addCategories($categories)
|
||||||
{
|
{
|
||||||
foreach($categories as $category) {
|
foreach($categories as $category) {
|
||||||
|
if (!array_key_exists('name', $category) || !array_key_exists('id', $category)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$e = $this->categories->appendChild(
|
$e = $this->categories->appendChild(
|
||||||
$this->document->createElement(
|
$this->document->createElement(
|
||||||
'category', $category['name']
|
'category', $category['name']
|
||||||
@ -82,7 +86,7 @@ class IcmlHelper
|
|||||||
|
|
||||||
$e->setAttribute('id', $category['id']);
|
$e->setAttribute('id', $category['id']);
|
||||||
|
|
||||||
if ($category['parentId'] > 0) {
|
if (array_key_exists('parentId', $category) && $category['parentId'] > 0) {
|
||||||
$e->setAttribute('parentId', $category['parentId']);
|
$e->setAttribute('parentId', $category['parentId']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user