From 68ba68af2397eebf8a3d1793110d539679d7ca4f Mon Sep 17 00:00:00 2001 From: Vitaly Artemev Date: Tue, 13 Dec 2016 17:12:28 +0400 Subject: [PATCH 1/2] add looping protection --- classes/modules/RetailCRM/classes/retailcrm/RCrmIcml.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/classes/modules/RetailCRM/classes/retailcrm/RCrmIcml.php b/classes/modules/RetailCRM/classes/retailcrm/RCrmIcml.php index a784184..78d1a94 100644 --- a/classes/modules/RetailCRM/classes/retailcrm/RCrmIcml.php +++ b/classes/modules/RetailCRM/classes/retailcrm/RCrmIcml.php @@ -92,12 +92,15 @@ class RCrmIcml { $url = '/' . $obj->getAltName(); + $ids = array($obj->getRel()); $parent = new umiHierarchyElement($obj->getRel()); + while (true) { $url = '/' . $parent->getAltName() . $url; - if ($parent->getRel() != 0) { + if ($parent->getRel() != 0 && !in_array($parent->getRel(), $ids)) { $parent = new umiHierarchyElement($parent->getRel()); + array_push($ids, $parent->getRel()); } else { break; } @@ -306,4 +309,4 @@ class RCrmIcml } } } -} \ No newline at end of file +} From 09bbf9bf5c7191df7bea8e36868e3cd274ccb538 Mon Sep 17 00:00:00 2001 From: Vitaly Artemev Date: Tue, 13 Dec 2016 17:25:05 +0400 Subject: [PATCH 2/2] fix server protocol --- .../modules/RetailCRM/classes/retailcrm/RCrmIcml.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/classes/modules/RetailCRM/classes/retailcrm/RCrmIcml.php b/classes/modules/RetailCRM/classes/retailcrm/RCrmIcml.php index 78d1a94..dceadb9 100644 --- a/classes/modules/RetailCRM/classes/retailcrm/RCrmIcml.php +++ b/classes/modules/RetailCRM/classes/retailcrm/RCrmIcml.php @@ -18,8 +18,14 @@ class RCrmIcml $domainsCollection = domainsCollection::getInstance(); $domainsCollectionList = $domainsCollection->getList(); $domainCollection = $domainsCollectionList[1]; - $serverProtocol = mainConfiguration::getInstance()->get('system', 'server-protocol') . '://'; - $this->shopUrl = $serverProtocol . $domainCollection->getHost(); + + if (mainConfiguration::getInstance()->get('system', 'server-protocol')) { + $serverProtocol = mainConfiguration::getInstance()->get('system', 'server-protocol'); + } else { + $serverProtocol = 'http'; + } + + $this->shopUrl = $serverProtocol . '://' . $domainCollection->getHost(); } public function generateICML()