Jump to content

Edit History

Poncy

Poncy

Hi, i'm trying to add a specific price with webservice, but return me an erorr: "ERROR: This call to PrestaShop Web Services failed and returned an HTTP status of 500. That means: Internal Server Error." Why?

 

This is my code:

try{

		    $webService = $this->connPS();
		    $opt = array('resource' => 'specific_prices');
		    $xml = $webService->get(array('url' => PS_SHOP_PATH . '/api/specific_prices?schema=blank'));
		    $product = $xml->children()->children();
		
                        
            unset($product->id);
            //unset($product->id_shop_group);
			
			$product->id_shop = 1;
			$product->id_cart = 0;
			$product->id_product = 553;
			$product->id_currency = 0;
			$product->id_country = 0;
			$product->id_group = 0;
			$product->id_customer = 0;
			
			$product->id_shop_group = 0;
			$product->id_product_attribute = 0;
			$product->id_specific_price_rule = 0;
			$product->reduction = 1;
			$product->reduction_tax = 1;
			$product->reduction_type = 'amount';
			$product->price = -1;
			$product->from_quantity = 1;
			$product->from = "0000-00-00 00:00:00";
			$product->to = "0000-00-00 00:00:00";
		    
		    $opt = array('resource' => 'specific_prices');
			$opt['postXml'] = $xml->asXML();
			$xml = $webService->add($opt); 
			$product_price = $xml->specific_prices;			
			
			
		} catch (PrestaShopWebserviceException $e){
			// Here we are dealing with errors
		    $trace = $e->getTrace();
		    if ($trace[0]['args'][0] == 404) return 'Bad ID';
		    else if ($trace[0]['args'][0] == 401) return 'Bad auth key';
		    else return '<b>ERROR:</b> ' . $e->getMessage();
		}

 

Poncy

Poncy

Hi, i'm trying to add a specific price with webservice, but return me an erorr: "ERROR: This call to PrestaShop Web Services failed and returned an HTTP status of 500. That means: Internal Server Error." Why?

 

This is my code:

try{

		    $webService = $this->connPS();
		    $opt = array('resource' => 'specific_prices');
		    $xml = $webService->get(array('url' => PS_SHOP_PATH . '/api/specific_prices?schema=blank'));
		    $product = $xml->children()->children();
		
                        
            unset($product->id);
            //unset($product->id_shop_group);
			
			$product->id_shop = 1;
			$product->id_cart = 0;
			$product->id_product = 553;
			$product->id_currency = 0;
			$product->id_country = 0;
			$product->id_group = 0;
			$product->id_customer = 0;
			
			$product->id_shop_group = 0;
			$product->id_product_attribute = 0;
			$product->id_specific_price_rule = 0;
			$product->reduction = 1;
			$product->reduction_tax = 1;
			$product->reduction_type = 'amount';
			$product->price = -1;
			$product->from_quantity = 1;
			$product->from = "0000-00-00 00:00:00";
			$product->to = "0000-00-00 00:00:00";
		    
		    $opt = array('resource' => 'specific_prices');
			$opt['postXml'] = $xml->asXML();
			$xml = $webService->add($opt); 
			$product_price = $xml->specific_prices;			
			
			
		} catch (PrestaShopWebserviceException $e){
			// Here we are dealing with errors
		    $trace = $e->getTrace();
		    if ($trace[0]['args'][0] == 404) return 'Bad ID';
		    else if ($trace[0]['args'][0] == 401) return 'Bad auth key';
		    else return '<b>ERROR:</b> ' . $e->getMessage();
		}

 

Poncy

Poncy

Hi, i'm trying to add a specific price with webservice, but retunr me an erorr: "ERROR: This call to PrestaShop Web Services failed and returned an HTTP status of 500. That means: Internal Server Error." Whu?

 

This is my code:

try{

		    $webService = $this->connPS();
		    $opt = array('resource' => 'specific_prices');
		    $xml = $webService->get(array('url' => PS_SHOP_PATH . '/api/specific_prices?schema=blank'));
		    $product = $xml->children()->children();
		
                        
            unset($product->id);
            //unset($product->id_shop_group);
			
			$product->id_shop = 1;
			$product->id_cart = 0;
			$product->id_product = 553;
			$product->id_currency = 0;
			$product->id_country = 0;
			$product->id_group = 0;
			$product->id_customer = 0;
			
			$product->id_shop_group = 0;
			$product->id_product_attribute = 0;
			$product->id_specific_price_rule = 0;
			$product->reduction = 1;
			$product->reduction_tax = 1;
			$product->reduction_type = 'amount';
			$product->price = -1;
			$product->from_quantity = 1;
			$product->from = "0000-00-00 00:00:00";
			$product->to = "0000-00-00 00:00:00";
		    
		    $opt = array('resource' => 'specific_prices');
			$opt['postXml'] = $xml->asXML();
			$xml = $webService->add($opt); 
			$product_price = $xml->specific_prices;			
			
			
		} catch (PrestaShopWebserviceException $e){
			// Here we are dealing with errors
		    $trace = $e->getTrace();
		    if ($trace[0]['args'][0] == 404) return 'Bad ID';
		    else if ($trace[0]['args'][0] == 401) return 'Bad auth key';
		    else return '<b>ERROR:</b> ' . $e->getMessage();
		}

 

Poncy

Poncy

Hi, i'm trying to add a specific price with webservice, but retunr me an erorr: "ERROR: This call to PrestaShop Web Services failed and returned an HTTP status of 500. That means: Internal Server Error." Whu?

 

This is my code:

try{

		    $webService = $this->connPS();
		    $opt = array('resource' => 'specific_prices');
		    $xml = $webService->get(array('url' => PS_SHOP_PATH . '/api/specific_prices?schema=blank'));
		    $product = $xml->children()->children();
		
                        
            unset($product->id);
            //unset($product->id_shop_group);
			
			$product->id_shop 											  		  = 1;
			$product->id_cart 											  		  = 0;
			$product->id_product 											  	  = 553;
			$product->id_currency 											  	  = 0;
			$product->id_country 											  	  = 0;
			$product->id_group 											  		  = 0;
			$product->id_customer 											  	  = 0;
			
			$product->id_shop_group 											  = 0;
			$product->id_product_attribute 										  = 0;
			$product->id_specific_price_rule									  = 0;
			$product->reduction 											  	  = 1;
			$product->reduction_tax 											  = 1;
			$product->reduction_type 											  = 'amount';
			$product->price 											  		  = -1;
			$product->from_quantity 											  = 1;
			$product->from 											  		  	  = "0000-00-00 00:00:00";
			$product->to 														  = "0000-00-00 00:00:00";
		    
		    $opt                                                                  = array('resource' => 'specific_prices');
			$opt['postXml']                                                       = $xml->asXML();
			$xml                                                                  = $webService->add($opt); 
			$product_price                                                        = $xml->specific_prices;			
			
			
		} catch (PrestaShopWebserviceException $e){
			// Here we are dealing with errors
		    $trace = $e->getTrace();
		    if ($trace[0]['args'][0] == 404) return 'Bad ID';
		    else if ($trace[0]['args'][0] == 401) return 'Bad auth key';
		    else return '<b>ERROR:</b> ' . $e->getMessage();
		}

 

×
×
  • Create New...