mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-24 06:06:06 +03:00
Merge pull request #161 from KMityai/v2.2
fix empty categories and empty options
This commit is contained in:
commit
417edc99be
@ -69,19 +69,20 @@ class ModelRetailcrmIcml extends Model
|
|||||||
foreach($categories as $category) {
|
foreach($categories as $category) {
|
||||||
$category = $this->model_catalog_category->getCategory($category['category_id']);
|
$category = $this->model_catalog_category->getCategory($category['category_id']);
|
||||||
|
|
||||||
$e = $this->eCategories->appendChild(
|
if (!empty($category)) {
|
||||||
$this->dd->createElement(
|
$e = $this->eCategories->appendChild(
|
||||||
'category', $category['name']
|
$this->dd->createElement(
|
||||||
)
|
'category', $category['name']
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$e->setAttribute('id', $category['category_id']);
|
$e->setAttribute('id', $category['category_id']);
|
||||||
|
|
||||||
if ($category['parent_id'] > 0) {
|
if ($category['parent_id'] > 0) {
|
||||||
$e->setAttribute('parentId', $category['parent_id']);
|
$e->setAttribute('parentId', $category['parent_id']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addOffers()
|
private function addOffers()
|
||||||
@ -174,11 +175,14 @@ class ModelRetailcrmIcml extends Model
|
|||||||
$optionIds = explode(':', $option[0]);
|
$optionIds = explode(':', $option[0]);
|
||||||
if($optionString != '0:0-0') {
|
if($optionString != '0:0-0') {
|
||||||
$optionData = $this->getOptionData($optionIds[1], $option[1]);
|
$optionData = $this->getOptionData($optionIds[1], $option[1]);
|
||||||
$options[$optionIds[0]] = array(
|
|
||||||
'name' => $optionData['optionName'],
|
if (!empty($optionData)) {
|
||||||
'value' => $optionData['optionValue'],
|
$options[$optionIds[0]] = array(
|
||||||
'value_id' => $option[1]
|
'name' => $optionData['optionName'],
|
||||||
);
|
'value' => $optionData['optionValue'],
|
||||||
|
'value_id' => $option[1]
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ksort($options);
|
ksort($options);
|
||||||
@ -348,9 +352,14 @@ class ModelRetailcrmIcml extends Model
|
|||||||
$optionValue = $this->model_catalog_option->getOptionValue($optionValueId);
|
$optionValue = $this->model_catalog_option->getOptionValue($optionValueId);
|
||||||
$this->optionValues[$optionValueId] = $optionValue;
|
$this->optionValues[$optionValueId] = $optionValue;
|
||||||
}
|
}
|
||||||
return array(
|
|
||||||
'optionName' => $option['name'],
|
if (!empty($option['name']) && !empty($optionValue['name'])) {
|
||||||
'optionValue' => $optionValue['name']
|
return array(
|
||||||
);
|
'optionName' => $option['name'],
|
||||||
|
'optionValue' => $optionValue['name']
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user