Skip to content

Commit

Permalink
Check attribute images array before accessing
Browse files Browse the repository at this point in the history
  • Loading branch information
firstred committed May 9, 2018
1 parent 9a1f19d commit 672f75d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,6 @@ public static function getApiKey()
Configuration::updateValue(static::UUID, static::$uuid, false, 0, 0);
}
} catch (TransferException $e) {

}
}
}
Expand Down Expand Up @@ -2667,7 +2666,10 @@ protected function exportProducts($offset, $idShops = null, $remaining = false)
// Add artificial stock when stock mgmt is disabled and/or oos and oos ordering allowed
'inventory_quantity' => (int) (!$stockmgmt ? 999 : ($combination['quantity'] ?: ($allowOosp ? 999 : 0))),
];
if (isset($allCombinationImages[$combination['id_product_attribute']])) {
if (isset($allCombinationImages[$combination['id_product_attribute']])
&& is_array($allCombinationImages[$combination['id_product_attribute']])
&& count($allCombinationImages[$combination['id_product_attribute']]) > 0
) {
$variant['image_url'] = $link->getImageLink('default', "{$product['id_product']}-{$allCombinationImages[$combination['id_product_attribute']][0]['id_image']}");
foreach ($allCombinationImages[$combination['id_product_attribute']] as $image) {
if (!isset($images[$image['id_image']])) {
Expand Down Expand Up @@ -2930,7 +2932,10 @@ protected function exportProductRange($range, $idShops = null, $orderDetail = fa
// Add artificial stock when stock mgmt is disabled and/or oos and oos ordering allowed
'inventory_quantity' => (int) (!$stockmgmt ? 999 : ($combination['quantity'] ?: ($allowOosp ? 999 : 0))),
];
if (isset($allCombinationImages[$combination['id_product_attribute']])) {
if (isset($allCombinationImages[$combination['id_product_attribute']])
&& is_array($allCombinationImages[$combination['id_product_attribute']])
&& count($allCombinationImages[$combination['id_product_attribute']]) > 0
) {
$variant['image_url'] = $link->getImageLink('default', "{$product['id_product']}-{$allCombinationImages[$combination['id_product_attribute']][0]['id_image']}");
foreach ($allCombinationImages[$combination['id_product_attribute']] as $image) {
if (!isset($images[$image['id_image']])) {
Expand Down

0 comments on commit 672f75d

Please sign in to comment.