Example #1
0
// Here we define constants /!\ You need to replace this parameters
require_once('../config/config.inc.php');
require_once('../PSWebServiceLibrary.php');
$count = 1;
$product_added=array();
$webservice_exi = new SoapClient('http://www2.promoshop.com.mx/ws_store/service.asmx?WSDL') ;
$list = Configuration::get('PRODUCTUPDATE_LIST');
// Here we use the WebService to get the schema of "customers" resource
Configuration::updateValue('PRODUCTUPDATE_STATUS', '0');
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
        $count=1;
$allproducts=  ProductCore::getAllProductsInfoAddedByWebservice();
foreach($allproducts as $product){
    $parameter = array("ItemNumber"=>$product['reference'],
                    "key"=>EXIMAGEN_KEY);
    $decoration = $webservice_exi->GetDecoration($parameter);
    $decoration = $decoration->GetDecorationResult;
    save_product_combination($product['id_product'], $product['reference'],$list, $decoration);
    $count++;
    Configuration::updateValue('PRODUCTUPDATE_STATUS', $count/4);
}
    Configuration::updateValue('PRODUCTUPDATE_STATUS', 100);

function set_product_quantity($ProductId, $StokId, $AttributeId, $quantity, $intransit, $intransit_avail_date, $color_id){
	global $webService;
	$xml = $webService -> get(array('url' => PS_SHOP_PATH . '/api/stock_availables?schema=blank'));
	$resources = $xml -> children() -> children();
	$resources->id = $StokId;
	$resources->id_product  = $ProductId;
	$resources->quantity = $quantity;
	$resources->id_shop = 1;