get('\Psr\Log\LoggerInterface'); $this->_logger = $logger; $base = new Base; $this->_apiUrl = $base->_apiUrl; $this->_apiKey = $base->_apiKey; $this->_systemStore = $systemStore; $this->_formFactory = $formFactory; } public function render(AbstractElement $element) { $values = $element->getValues(); $html = ''; if(!empty($this->_apiUrl) && !empty($this->_apiKey)) { $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $shipConfig = $objectManager->get('Magento\Shipping\Model\Config'); $deliveryMethods = $shipConfig->getActiveCarriers(); $client = new \Retailcrm\Retailcrm\Model\ApiClient\ApiClient($this->_apiUrl,$this->_apiKey); try { $response = $client->deliveryTypesList(); if ($response->isSuccessful()&&200 === $response->getStatusCode()) { $deliveryTypes = $response['deliveryTypes']; } } catch (Retailcrm\Retailcrm\Model\ApiClient\Exception\CurlException $e) { $this->_logger->addDebug($e->getMessage()); } $config = \Magento\Framework\App\ObjectManager::getInstance()->get( 'Magento\Framework\App\Config\ScopeConfigInterface' ); foreach (array_keys($deliveryMethods) as $k=>$delivery){ $html .=''; $html .=''; $html .=''; $html .=''; $html .=''; $html .='
'.$delivery.''; $html .=''; $html .='
'; } return $html; } else { $html .= '
Please check your API Url & API Key
'; } $html = ''; return $html; } }