Jump to content

Prestashop 1.7.1.1 web services stop working with 1.6.1.13


hardyahir

Recommended Posts

hello there, i created web service to signup,login,change password etc and get categories, products, cart all this works fine with latest 1.7.1.1 but m unable to create order so i switched to 1.6.1.13 and test my web services, but any services which use 
 
webservice->edit() method are start giving errors :(

here is simple change password of customer web service which stop working now , kindly help me and also explain how to create order and which are required things to pass when creating order , i show my code for both creating order and change password both not working :( earlier only create order had issue now all the service which use edit() method are stop working :(

Note:- only edit() method services stop working, add(), get() , delete() works fine with both latest 1.6 and 1.7
 
 
 

// Call to retrieve specific customer                $xml = $this->webService->get(array('resource' => 'customers','display' => 'full','filter[email]' => '['.$this->input->post("email").']'));
                
// Retriving custom id                
$id = (int) $xml->customers->customer->id;
                
if ($id > 1) {
                    
// Retrieve resource elements in a variable (table)
$resource = $xml->children()->children();
$resource->passwd = $this->input->post("password");
$opt_update['resource'] = 'customers';
$opt_update['id'] = (int) $id;
$opt_update['putXml'] = $resource->asXML(); 
$update = $this->webService->edit($opt_update); // here it failed
echo (int)$update->customers->customer->id."is updated successfully";
} else {
echo "no customer found";
}

 


and here are the error i got on debugger :(

 

 

Array
(
    [status_code] => 400
    [response] =>
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <errors>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): namespace error : Namespace prefix xlink for href on id_default_group is not defined (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): lt_group xlink:href="localhost/prestashop/api/groups/3" (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct():                                                                                ^ (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): namespace error : Namespace prefix xlink for href on id_lang is not defined (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): _lang xlink:href="localhost/prestashop/api/languages/1" (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct():                                                                                ^ (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): namespace error : Namespace prefix xlink for href on group is not defined (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct():  <group xlink:href="localhost/prestashop/api/groups/1"> (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct():                                                                                ^ (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[90]]>
            </code>
            <message>
                <![CDATA[id is required when modifying a resource]]>
            </message>
        </error>
    </errors>
</prestashop>




    [header] => HTTP/1.1 400 Bad Request
Date: Mon, 29 May 2017 04:19:53 GMT
Server: Apache/2.4.17 (Unix) OpenSSL/1.0.1q PHP/5.6.15 mod_perl/2.0.8-dev Perl/v5.16.3
Vary: Authorization
X-Powered-By: PrestaShop Webservice
Access-Time: 1496031593
PSWS-Version: 1.6.1.13
Execution-Time: 0.006
Set-Cookie: PrestaShop-34fc132eb07fcac1f8df1b6451ffd56c=A2u1uV1bPapPwjDhn52LPDjFsAr0k7nIjkHo%2B6QOM4GHc0J3oiWyg4S7m60ksLakLLcoEGP73qra3m3VcgTKkypn5CuJxJva9X0Ok54yBZA%3D000080; expires=Sun, 18-Jun-2017 04:19:53 GMT; Max-Age=1728000; path=/php_actionware_ecommerce/; httponly
Content-Length: 2964
Connection: close
Content-Type: text/xml;charset=utf-8
)
<br />
<b>Fatal error</b>:  Uncaught exception 'PrestaShopWebserviceException' with message 'This call to PrestaShop Web Services failed and returned an HTTP status of 400. That means: Bad Request.' in /opt/lampp/htdocs/prestashop/web_services/application/third_party/PrestaShopWebservice.php:91
Stack trace:
#0 /opt/lampp/htdocs/prestashop/web_services/application/third_party/PrestaShopWebservice.php(364): PrestaShopWebservice->checkStatusCode(400)
#1 /opt/lampp/htdocs/prestashop/web_services/application/modules/ws/controllers/ws.php(291): PrestaShopWebservice->edit(Array)
#2 [internal function]: Ws->changePassword()
#3 /opt/lampp/htdocs/prestashop/web_services/system/core/CodeIgniter.php(359): call_user_func_array(Array, Array)
#4 /opt/lampp/htdocs/prestashop/web_services/index.php(202): require_once('/opt/lampp/htdo...')
#5 {main}
  thrown in
<b>/opt/lampp/htdocs/prestashop/web_services/application/third_party/PrestaShopWebservice.php</b> on line
<b>91</b>
<br />


 

 


 
 
Now here is create order code
 
 

// Get customer details
                $customer = $this->webService->get(array('url' => $this->config->item("PS_SHOP_PATH").'api/customers?display=full&filter[id]='.$this->input->post("id_customer")));
                $customer = $customer->customers->customer;


                // Updating cart details first (update address for both delivery and invoice)
                $res = NULL;
                if($this->input->post("id_cart") && (int)$customer->id) {
                    // Get cart
                    $cart_opt['resource'] = 'carts';
                    $cart_opt['display'] = 'full';
                    if($this->input->post("id_cart"))
                        $cart_opt['filter[id]'] = $this->input->post("id_cart");
                    if($this->input->post("id_customer"))
                        $cart_opt['filter[id_customer]'] = $this->input->post("id_cart");
                    if($this->input->post("id_customer") && $this->input->post("id_cart"))
                        $cart_opt['filter[id]'] = $this->input->post("id_cart");
                        $cart_opt['filter[id_customer]'] = $this->input->post("id_customer");
                    $get_cart = $this->webService->get($cart_opt);
                    $carts = $get_cart->carts;
                    
                    if (isset($get_cart->carts->cart->id) && (int)$get_cart->carts->cart->id) {
                        // Update the cart details
                        $carts->cart->secure_key = $customer->secure_key;
                        $carts->cart->id_address_delivery = $this->input->post("id_address_delivery");
                        $carts->cart->id_address_invoice = $this->input->post("id_address_invoice");
                        $carts->cart->id_customer = $customer->id;
                        $carts->cart->id_carrier = $this->input->post("id_carrier");


                        // Counting cart rows
                        $row_count = count($get_cart->carts->cart->associations->cart_rows->cart_row);


                        // Cart row data
                        $cart_rows = ($row_count > 0)? (array) $get_cart->carts->cart->associations->cart_rows : '';
                        $cart_rows = ($row_count > 0)? json_encode($cart_rows['cart_row']) : '';
                        $cart_rows = ($row_count > 0)? json_decode($cart_rows,TRUE) : '';
                        //$carts = $carts->carts;
                        $flag = '';
                        
                        if($row_count > 1){
                            foreach($cart_rows as $key => $value) {
                                
                                $carts->cart->associations->cart_rows->cart_row[$key]->id_address_delivery = $this->input->post("id_address_delivery");
                            }  
                        } else if($row_count == 1) {
                            $carts->cart->associations->cart_rows->cart_row->id_address_delivery = $this->input->post("id_address_delivery");
                        }
                        $carts->cart->id_carrier = $this->input->post("id_carrier");
$carts->cart->secure_key = $customer->secure_key;
                        $update_cart_opt['resource'] = 'carts';
                        $update_cart_opt['id'] = $this->input->post("id_cart");
                        $update_cart_opt['putXml'] = $carts->asXML(); 
                        $update_cart = $this->webService->edit($update_cart_opt);
                        // Details of updated cart
                        $id['cart'] = (int) $update_cart->cart->id;
                        $id['delivery'] = (int) $update_cart->cart->id_address_delivery;
                        $id['carrier'] = (int) $update_cart->cart->id_carrier;
                        $id['customer'] = (int) $update_cart->cart->id_customer;


                        // Switching to main Database
                        mysql_select_db('xxxxxxxxx');
                        $sql = "UPDATE `ps_cart`
                                SET `delivery_option`='a:1:{i:".$id['delivery'].";s:".$id['customer'].":\"".$id['carrier'].",\";}' WHERE id_cart='" . $id['cart'] . "'";
                        $res = $this->db->query($sql);  
                    }else {
                        $result['status'] = 'error';
                        $result['msg'] = 'No cart details found for the given id';
                    }
                } 


                // if cart data updated then creating order
                if ($res){
                    try{
                        // Get empty schema of order
                        $order_xml = $this->webService->get(array('url' => $this->config->item("PS_SHOP_PATH").'api/orders?schema=blank'));


                        // Generating order data                    
                        $order_xml->orders->order;
                        $order_xml->order->id_customer = (int)$customer->id;
                        $order_xml->order->id_address_delivery = (int) $id['delivery'];
                        $order_xml->order->id_address_invoice = $this->input->post("id_address_invoice");
                        $order_xml->order->id_cart = $id["cart"];
                        $order_xml->order->id_currency = (int)$customer->id_currency;
                        $order_xml->order->id_lang = (int)$customer->id_lang;
                        $order_xml->order->id_shop = (int)$customer->id_shop;
                        $order_xml->order->id_shop_group = (int)$customer->id_shop_group;
                        $order_xml->order->id_carrier = $id["carrier"];
                        //$order_xml->order->current_state = 3;
                        $order_xml->order->secure_key = $customer->secure_key;
                        $order_xml->order->valid = 0;
                        $order_xml->order->payment = $this->input->post("payment");
                        $order_xml->order->module = $this->input->post("module");
                        $order_xml->order->total_paid = (float) $this->input->post("total_paid");
                        $order_xml->order->total_paid_real = (float) $this->input->post("total_paid");
                        $order_xml->order->total_products = (float) $this->input->post("total_paid");
                        $order_xml->order->total_products_wt = (float) $this->input->post("total_paid");
                        $order_xml->order->total_discounts = (float) 0;
                        $order_xml->order->total_discounts_tax_incl = (float) 0;
                        $order_xml->order->total_discounts_tax_excl = (float) 0;
                        $order_xml->order->total_shipping = (float) 0;
                        $order_xml->order->total_shipping_tax_incl = (float) 0;
                        $order_xml->order->total_shipping_tax_excl = (float) 0;
                        $order_xml->order->conversion_rate = (float) 1;
                    $order_xml->order->associations->order_rows->order_row->product_id 
                            = $this->input->post("product_id");
                        $order_xml->order->associations->order_rows->order_row->product_attribute_id = $this->input->post("product_attribute_id");
                        $order_xml->order->associations->order_rows->order_row->product_quantity = $this->input->post("product_quantity");
                        $order_xml->order->associations->order_rows->order_row->product_name = "Amazing Funky Jeans for men";
                        $order_xml->order->associations->order_rows->order_row->product_price = "494.38";
                        $order_xml->order->date_add = curdate();
                        unset($order_xml->children()->children()->id);
                        
                        // Creating order                    
                        $create_order_opt = array('resource' => 'orders');
                        $create_order_opt['postXml'] = $order_xml->asXML();
$order_insert = $this->webService->add(array(
                            'resource' => 'orders?sendmail=1',
                            'postXml' => $order_xml->asXML()
                        ));
                        print_r($order_insert);
                        exit;

// here it failed to create order with latest ps 1.7.x.x
                        
                        // Details of created order     
                        $id['order'] = (int) $order_insert->order->id;
                        $id['secure_key'] = $order_insert->order->secure_key;
                        
                        // Create Order History
                        $order_history_xml = $this->webService->get(array('url' => $this->config->item("PS_SHOP_PATH").'api/order_histories?schema=synopsis'));
                        $order_history_xml = $order_history_xml->children()->children();
                        $order_history_xml->id_order = $id['order'];
                        $order_history_xml->id_order_state = '3';
                        $order_history_opt = array('resource' => 'order_histories');
                        $order_history_opt['postXml'] = $order_history_xml->asXML();
                        $order_history = $this->webService->add($order_history_opt);
                        
                        // Details of created order history     
                        $id['order_history'] = (int) $xml->order_history->id;

 

 

 
here are the errors i got while creating order and updating carts
 
 
 

 

 

Array
(
    [status_code] => 500
    [response] =>
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <errors>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): namespace error : Namespace prefix xlink for href on id_address_delivery is not defined (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): ivery xlink:href="localhost/prestashop/api/addresses/4" (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct():                                                                                ^ (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): namespace error : Namespace prefix xlink for href on id_address_invoice is not defined (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): voice xlink:href="localhost/prestashop/api/addresses/4" (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct():                                                                                ^ (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): namespace error : Namespace prefix xlink for href on id_currency is not defined (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): ency xlink:href="localhost/prestashop/api/currencies/1" (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct():                                                                                ^ (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): namespace error : Namespace prefix xlink for href on id_customer is not defined (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): tomer xlink:href="localhost/prestashop/api/customers/1" (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct():                                                                                ^ (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): namespace error : Namespace prefix xlink for href on id_guest is not defined (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): id_guest xlink:href="localhost/prestashop/api/guests/1" (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct():                                                                                ^ (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): namespace error : Namespace prefix xlink for href on id_lang is not defined (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): _lang xlink:href="localhost/prestashop/api/languages/1" (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct():                                                                                ^ (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): namespace error : Namespace prefix xlink for href on id_product is not defined (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): roduct xlink:href="localhost/prestashop/api/products/2" (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct():                                                                                ^ (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): namespace error : Namespace prefix xlink for href on id_product_attribute is not defined (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): e xlink:href="localhost/prestashop/api/combinations/10" (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct():                                                                                ^ (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): namespace error : Namespace prefix xlink for href on id_address_delivery is not defined (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): ivery xlink:href="localhost/prestashop/api/addresses/3" (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct():                                                                                ^ (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): namespace error : Namespace prefix xlink for href on id_product is not defined (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): roduct xlink:href="localhost/prestashop/api/products/3" (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct():                                                                                ^ (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): namespace error : Namespace prefix xlink for href on id_product_attribute is not defined (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): e xlink:href="localhost/prestashop/api/combinations/13" (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct():                                                                                ^ (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): namespace error : Namespace prefix xlink for href on id_address_delivery is not defined (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct(): ivery xlink:href="localhost/prestashop/api/addresses/3" (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
        <error>
            <code>
                <![CDATA[3]]>
            </code>
            <message>
                <![CDATA[[PHP Warning #2] SimpleXMLElement::__construct():                                                                                ^ (/opt/lampp/htdocs/prestashop/classes/webservice/WebserviceRequest.php, line 1374)]]>
            </message>
        </error>
    </errors>
</prestashop>

 


 


any help is really appreciate please team prestashop guide me :)

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

I manage to resolve this issue.

The solution is to add the namespace to the outest element of the XML you send on edit() call.

So instead of:

<customers>
  <customer>
    ...
  </customer>
</customers>      

You need to send:

<customers xmlns:xlink="http://www.w3.org/1999/xlink">
  <customer>
    ...
   </customer>
</customers>

If you activate the debug, you will see this namespace added to the <prestashop> XML node, but when you do: 

$resource = $xml->children()->children();
...
$opt_update['putXml'] = $resource->asXML(); 

you are loosing this external node with the namespace reference.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...