diff --git a/app/code/Mageplaza/AutoRelated/Helper/Data.php b/app/code/Mageplaza/AutoRelated/Helper/Data.php index 19fb39a5..c82cc0a1 100644 --- a/app/code/Mageplaza/AutoRelated/Helper/Data.php +++ b/app/code/Mageplaza/AutoRelated/Helper/Data.php @@ -122,7 +122,7 @@ function getRelatedProduct($layout, $params, $isAjax = true) { if (!$this->isEnabled()) { return false; } - $result = []; + $r = []; $autoRelatedModelRule = $this->objectManager->create('Mageplaza\AutoRelated\Model\RuleFactory'); $ruleIds = []; $id = ''; @@ -171,7 +171,7 @@ function getRelatedProduct($layout, $params, $isAjax = true) { $i = 0; foreach ($data as $location => $infos) { $html = ''; - $result['data'][$i]['id'] = $location; + $r['data'][$i]['id'] = $location; foreach ($infos as $info) { $productIds = $info['product_ids']; $rule = $info['rule']; @@ -190,20 +190,20 @@ function getRelatedProduct($layout, $params, $isAjax = true) { } } } - $result['data'][$i]['content'] = $html; + $r['data'][$i]['content'] = $html; $i++; } } - if (!empty($result)) { - $result['status'] = true; + if (!empty($r)) { + $r['status'] = true; $this->catalogSession->create()->unsAutoRelated(); } } catch (\Exception $e) { - $result['status'] = false; + $r['status'] = false; $this->_logger->critical($e); } - return self::jsonEncode($result); + return self::jsonEncode($r); } function versionCompare($version, $operator = '>='){