Example #1
0
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;
	$resources->out_of_stock=2;
	$resources->depends_on_stock = 0;
Example #2
0
                        $resources->id=$prdID;
                        $opt['putXml'] = $xml->asXML();
                        $opt['id'] = $prdID ;
                        var_dump($opt);
                        $xml = $webService->edit($opt);
                        ProductCore::deleteAllCustomField($xml->product->id);
                        ProductCore::addCustomField($xml->product->id,1,0,'decoCount');
                        ProductCore::addCustomField($xml->product->id,1,0,'checkbox');
                        foreach ($decoration1 as $deco){
                            ProductCore::addCustomField($xml->product->id,1,0,$deco->TecnicaFull);
                            ProductCore::addCustomField($xml->product->id,1,0,'Price - '.$deco->TecnicaFull);
                        }
                     }
                    //Configuration::updateValue('PRODUCTUPDATE_STATUS', '50');
                     set_price_rule($xml->product->id, $product_xml->ItemNumber, $list);
                     save_product_combination($xml->product->id, $product_xml->ItemNumber,$list, $decoration,$product_xml->Color);
                     array_push($product_added, $xml->product->id);
                     Configuration::updateValue('PRODUCTUPDATE_STATUS', $count/40);
                    echo "Successfully added.";
		}
        }
	catch (PrestaShopWebserviceException $ex)
	{
		// Here we are dealing with errors
		$trace = $ex->getTrace();
		if ($trace[0]['args'][0] == 404) echo 'Bad ID';
		else if ($trace[0]['args'][0] == 401) echo 'Bad auth key';
		else echo 'Other error<br />'.$ex->getMessage();
	}
}
catch (PrestaShopWebserviceException $e)