Пример #1
0
 public static function run()
 {
     //TODO verificar se já existe
     $brand = VtexConnector::$ws->BrandInsertUpdate((new Brand(StoreConfigManager::getName()))->toVtex());
     //TODO definir no storeconfig
     BrandManager::setCurrentBrand($brand);
 }
Пример #2
0
 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;
 }
Пример #3
0
 public static function connect()
 {
     try {
         VtexConnector::$ws = new SoapClient('http://webservice-' . StoreConfigManager::getVtexAccountName() . '.vtexcommerce.com.br/service.svc?singleWsdl', array('login' => StoreConfigManager::getVtexUser(), 'password' => StoreConfigManager::getVtexPass(), 'trace' => 1, 'exception' => 0));
     } catch (SoapFault $e) {
         Logger::error('Falha ao connectar ao Webservice.', $e, VtexConnector::$ws->__getLastRequest());
     }
 }
Пример #4
0
 public static function getSKUsForProduct($id)
 {
     $sql = "SELECT s.child_id FROM `catalog_product_relation` as s\nWHERE s.parent_id = {$id}";
     $con = mysql_connect(StoreConfigManager::getDbHost(), StoreConfigManager::getDbUser(), StoreConfigManager::getDbPass()) or die("Could not connect: " . mysql_error());
     mysql_select_db(strtolower(StoreConfigManager::getDbName()));
     $result = mysql_query($sql);
     $skuList = array();
     while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
         $skuList[] = $row['child_id'];
     }
     mysql_free_result($result);
     return $skuList;
 }
Пример #5
0
 public static function setStoreConfig($config)
 {
     self::$storeConfig = $config;
 }
Пример #6
0
 public function getListStoreId()
 {
     return $this->ListStoreId ? $this->ListStoreId : StoreConfigManager::getListStoreId();
 }
Пример #7
0
 private static function getActiveVisibleProducts()
 {
     $complexFilter = array('complex_filter' => array(array('key' => 'visibility', 'value' => array('key' => 'eq', 'value' => '4')), array('key' => 'status', 'value' => array('key' => 'eq', 'value' => '1')), array('key' => 'type', 'value' => array('key' => 'eq', 'value' => StoreConfigManager::getProductType()))));
     try {
         return MagentoConnector::$ws->catalogProductList(MagentoConnector::getActiveSession(), $complexFilter);
     } catch (Exception $e) {
         Logger::alert('Falha ao recuperar lista de produtos.', $e, MagentoConnector::$ws->__getLastRequest());
     }
 }
Пример #8
0
 public static function info($message)
 {
     print_r(StoreConfigManager::getName() . ": " . $message . "\n");
 }
Пример #9
0
include 'Managers/StoreConfigManager.php';
include 'Helpers/Slug.php';
//Form
$storeConfig = StoreConfig::withPost($_POST);
//Manual run
//$storeConfigData = array(
//    'departmentId' => '',
//    'categoryId' => '',
//    'brandId' => '',
//    'name' => '',
//    'url' => '',
//    'dbHost' => '',
//    'dbName' => '',
//    'dbUser' => '',
//    'dbPass' => '',
//    'vtexUser' => '',
//    'vtexPass' => '',
//    'vtexAccountName' => '',
//    'magentoUser' => '',
//    'magentoPass' => '',
//    'productType' => ''
//);
//$storeConfig = StoreConfig::withData($storeConfigData);
StoreConfigManager::setStoreConfig($storeConfig);
foreach (CustomerManager::getList() as $customer) {
    CustomerManager::setCurrentCustomer($customer);
    CustomerManager::setStoreConfig($storeConfig);
    //BrandService::run();
    //CategoryService::run();
    ProductService::run();
}