get('\Magento\Framework\App\Config\ScopeConfigInterface');
$this->_apiUrl = $config->getValue('retailcrm/general/api_url');
$this->_apiKey = $config->getValue('retailcrm/general/api_key');
$this->_apiVersion = $config->getValue('retailcrm/general/api_version');
$this->_systemStore = $systemStore;
$this->_formFactory = $formFactory;
$this->_objectManager = $objectManager;
}
public function render(AbstractElement $element)
{
$html = '';
$htmlError = '
Please check your API Url & API Key
';
if (!empty($this->_apiUrl) && !empty($this->_apiKey)) {
$shipConfig = $this->_objectManager->get('Magento\Shipping\Model\Config');
$deliveryMethods = $shipConfig->getActiveCarriers();
$client = new ApiClient($this->_apiUrl, $this->_apiKey, $this->_apiVersion);
$response = $client->deliveryTypesList();
if ($response === false) {
return $htmlError;
}
if ($response->isSuccessful()) {
$deliveryTypes = $response['deliveryTypes'];
} else {
return $htmlError;
}
$config = \Magento\Framework\App\ObjectManager::getInstance()->get(
'Magento\Framework\App\Config\ScopeConfigInterface'
);
foreach (array_keys($deliveryMethods) as $k => $delivery) {
$html .='';
$html .='';
$html .=''.$delivery.' | ';
$html .='';
$html .='';
$html .=' | ';
$html .='
';
$html .='
';
}
return $html;
} else {
return $htmlError;
}
}
}