public static function getList() { if (count(self::$customerList) < 1) { self::$customerList = array(new Customer(StoreConfigManager::getName(), StoreConfigManager::getUrl(), StoreConfigManager::getMagentoUser(), StoreConfigManager::getMagentoPass())); } return self::$customerList; }
public static function connect() { try { MagentoConnector::$ws = new SoapClient('http://' . StoreConfigManager::getUrl() . '/api/v2_soap/?wsdl', array('trace' => 1, 'exception' => 0)); } catch (SoapFault $e) { Logger::error('Falha ao recuperar WSDL do Webservice.', $e, null); } try { MagentoConnector::$sessions[StoreConfigManager::getName()] = MagentoConnector::$ws->login(StoreConfigManager::getMagentoUser(), StoreConfigManager::getMagentoPass()); } catch (SoapFault $e) { Logger::error('Falha ao autenticar no Webservice.', $e, MagentoConnector::$ws->__getLastRequest()); } }
private static function createImageforSku($sku, $imageList) { foreach ($imageList as $image) { $clientUrl = StoreConfigManager::getUrl(); $imageUrl = "http://{$clientUrl}/media/catalog/product{$image}"; $data = array('urlImage' => $imageUrl, 'imageName' => $sku->StockKeepingUnitInsertUpdateResult->Name, 'stockKeepingUnitId' => $sku->StockKeepingUnitInsertUpdateResult->Id); try { VtexConnector::$ws->ImageServiceInsertUpdate($data); } catch (Exception $e) { Logger::alert('Falha ao inserir imagem a sku.', $e, VtexConnector::$ws->__getLastRequest()); } } }