amelie13 Posted February 8, 2013 Share Posted February 8, 2013 I got this error : LibXMLError::__set_state(array( 'level' => 3, 'code' => 9, 'column' => 68, 'message' => 'PCDATA invalid Char value 3 ', 'file' => '', 'line' => 732, )), I followed the tutorial and clash for the orders !!! if i go to line 732 of the response i got this : [_cipherTool:protected] => Rijndael Object ( [_key:protected] => D4Xfh48v483kHyIjm005HLwNrGyfGZqx [_iv:protected] => ã÷·m=pV�U0<4� ) [_key:protected] => f1DO8D8kcFYGzF9Q1cJompPx5mQ4EmfMtg5wzdopAvUGf0khVCuUM0Qj What is this stupid Rijndael Object ? Why don't I have only my XML response ??? Why it is not UTF-8 ??? Why is it here ??? PLease help me it makes 10 days that i'm blocked ! Link to comment Share on other sites More sharing options...
amelie13 Posted February 8, 2013 Author Share Posted February 8, 2013 Here is my code : $webService = new PrestaShopWebservice(self::URL_PRESTA, self::KEY_PRESTA, true); $opt[ 'resource' ] = 'orders'; $xml = $webService->get($opt); $resources = $xml->orders->children(); $commandes = array(); foreach($resources as $k=>$resource){ $opt[ 'id' ] = $resource->attributes(); $xml = $webService->get($opt); $resources = $xml->order; $orderPrestashop = new OrderPrestashop(); $orderPrestashop->XMLtoClass($resources); $commandes[] = $orderPrestashop; } if ($this->request->isPost()) { $commande = new OrderPrestashop(); // order test $commande->id_address_delivery = '2'; $commande->id_address_invoice = '2'; $commande->id_cart = '3'; $commande->id_currency = '1'; $commande->id_lang = '5'; $commande->id_customer = '1'; $commande->id_carrier = '2'; $commande->current_state = '1'; $commande->module = 'cheque'; $commande->invoice_number = '0'; $commande->invoice_date = '0000-00-00 00:00:00'; $commande->delivery_number = '0'; $commande->delivery_date = '0000-00-00 00:00:00'; $commande->valid = '0'; $commande->id_shop_group = '1'; $commande->id_shop = '1'; $commande->secure_key = '47ce86627c1f3c792a80773c5d2deaf8'; $commande->payment = 'Chèque'; $commande->recyclable = '0'; $commande->gift = '0'; $commande->gift_message = ''; $commande->total_discounts = '0.00'; $commande->total_discounts_tax_incl = '0.00'; $commande->total_discounts_tax_excl = '0.00'; $commande->total_paid = '626.37'; $commande->total_paid_tax_incl = '626.37'; $commande->total_paid_tax_excl = '523.72'; $commande->total_paid_real = '626.37'; $commande->total_products = '516.72'; $commande->total_products_wt = '618.00'; $commande->total_shipping = '7.98'; $commande->total_shipping_tax_incl = '8.37'; $commande->total_shipping_tax_excl = '7.00'; $commande->carrier_tax_rate = '19.600'; $commande->total_wrapping = '0.00'; $commande->total_wrapping_tax_incl = '0.00'; $commande->total_wrapping_tax_excl = '0.00'; $commande->conversion_rate = '1.000000'; $commande->reference = 'XKBKNABJY'; $xml_ = $webService->get(array('url' => self::URL_PRESTA.'/api/orders?schema=blank')); $resources_ = $xml_->children()->children(); foreach ($resources_ as $nodeKey => $node) { $node = dom_import_simplexml($resources_->$nodeKey); $no = $node->ownerDocument; $node->appendChild($no->createCDATASection($commande->$nodeKey)); } $opt = array('resource' => 'orders'); if ($_GET['create'] == 'creating') { $opt['postXml'] = $xml_->asXML(); $xml_ = $webService->add($opt); echo "Successfully added."; } } // var_dump($commandes); $form = new OrderForm(); return array('form' => $form,'response'=> $commandes); Link to comment Share on other sites More sharing options...
eightghax Posted February 11, 2013 Share Posted February 11, 2013 what's OrderPrestashop class look like? Link to comment Share on other sites More sharing options...
eightghax Posted February 11, 2013 Share Posted February 11, 2013 and how about the associations that includes products? Link to comment Share on other sites More sharing options...
amelie13 Posted February 11, 2013 Author Share Posted February 11, 2013 what's OrderPrestashop class look like? class OrderPrestashop { public $id; public $id_address_delivery; public $id_address_invoice; public $id_cart; public $id_currency; public $id_lang; public $id_customer; public $id_carrier; public $current_state; public $module; public $invoice_number; public $invoice_date; public $delivery_number; public $delivery_date; public $valid; public $date_add; public $date_upd; public $id_shop_group; public $id_shop; public $secure_key; public $payment; public $recyclable; public $gift; public $gift_message; public $total_discounts; public $total_discounts_tax_incl; public $total_discounts_tax_excl; public $total_paid; public $total_paid_tax_incl; public $total_paid_tax_excl; public $total_paid_real; public $total_products; public $total_products_wt; public $total_shipping; public $total_shipping_tax_incl; public $total_shipping_tax_excl; public $carrier_tax_rate; public $total_wrapping; public $total_wrapping_tax_incl; public $total_wrapping_tax_excl; public $shipping_number; public $conversion_rate; public $reference; public $associations; protected $inputFilter; public function __construct($orderPresta = null){ isset($orderPresta->id) ? $this->id = $orderPresta->id : $this->id = null; isset($orderPresta->id_address_delivery) ? $this->id_address_delivery = $orderPresta->id_address_delivery : $this->id_address_delivery = null; isset($orderPresta->id_address_invoice) ? $this->id_address_invoice = $orderPresta->id_address_invoice : $this->id_address_invoice = null; isset($orderPresta->id_cart) ? $this->id_cart = $orderPresta->id_cart : $this->id_cart = null; isset($orderPresta->id_currency) ? $this->id_currency = $orderPresta->id_currency : $this->id_currency = null; isset($orderPresta->id_lang) ? $this->id_lang = $orderPresta->id_lang : $this->id_lang = null; isset($orderPresta->id_customer) ? $this->id_customer = $orderPresta->id_customer : $this->id_customer = null; isset($orderPresta->id_carrier) ? $this->id_carrier = $orderPresta->id_carrier : $this->id_carrier = null; isset($orderPresta->current_state) ? $this->current_state = $orderPresta->current_state : $this->current_state = null; isset($orderPresta->module) ? $this->module = $orderPresta->module : $this->module = null; isset($orderPresta->invoice_number) ? $this->invoice_number = $orderPresta->invoice_number : $this->invoice_number = null; isset($orderPresta->invoice_date) ? $this->invoice_date = $orderPresta->invoice_date : $this->invoice_date = null; isset($orderPresta->delivery_number) ? $this->delivery_number = $orderPresta->delivery_number : $this->delivery_number = null; isset($orderPresta->delivery_date) ? $this->delivery_date = $orderPresta->delivery_date : $this->delivery_date = null; isset($orderPresta->valid) ? $this->valid = $orderPresta->valid : $this->valid = null; isset($orderPresta->date_add) ? $this->date_add = $orderPresta->date_add : $this->date_add = null; isset($orderPresta->date_upd) ? $this->date_upd = $orderPresta->date_upd : $this->date_upd = null; isset($orderPresta->id_shop_group) ? $this->id_shop_group = $orderPresta->id_shop_group : $this->id_shop_group = null; isset($orderPresta->id_shop) ? $this->id_shop = $orderPresta->id_shop : $this->id_shop = null; isset($orderPresta->secure_key) ? $this->secure_key = $orderPresta->secure_key : $this->secure_key = null; isset($orderPresta->payment) ? $this->payment = $orderPresta->payment : $this->payment = null; isset($orderPresta->recyclable) ? $this->recyclable = $orderPresta->recyclable : $this->recyclable = null; isset($orderPresta->gift) ? $this->gift = $orderPresta->gift : $this->gift = null; isset($orderPresta->gift_message) ? $this->gift_message = $orderPresta->gift_message : $this->gift_message = null; isset($orderPresta->total_discounts) ? $this->total_discounts = $orderPresta->total_discounts : $this->total_discounts = null; isset($orderPresta->total_discounts_tax_incl) ? $this->total_discounts_tax_incl = $orderPresta->total_discounts_tax_incl : $this->total_discounts_tax_incl = null; isset($orderPresta->total_discounts_tax_excl) ? $this->total_discounts_tax_excl = $orderPresta->total_discounts_tax_excl : $this->total_discounts_tax_excl = null; isset($orderPresta->total_paid) ? $this->total_paid = $orderPresta->total_paid : $this->total_paid = null; isset($orderPresta->total_paid_tax_incl) ? $this->total_paid_tax_incl = $orderPresta->total_paid_tax_incl : $this->total_paid_tax_incl = null; isset($orderPresta->total_paid_tax_excl) ? $this->total_paid_tax_excl = $orderPresta->total_paid_tax_excl : $this->total_paid_tax_excl = null; isset($orderPresta->total_paid_real) ? $this->total_paid_real = $orderPresta->total_paid_real : $this->total_paid_real = null; isset($orderPresta->total_products) ? $this->total_products = $orderPresta->total_products : $this->total_products = null; isset($orderPresta->total_products_wt) ? $this->total_products_wt = $orderPresta->total_products_wt : $this->total_products_wt = null; isset($orderPresta->total_shipping) ? $this->total_shipping = $orderPresta->total_shipping : $this->total_shipping = null; isset($orderPresta->total_shipping_tax_incl) ? $this->total_shipping_tax_incl = $orderPresta->total_shipping_tax_incl : $this->total_shipping_tax_incl = null; isset($orderPresta->total_shipping_tax_excl) ? $this->total_shipping_tax_excl = $orderPresta->total_shipping_tax_excl : $this->total_shipping_tax_excl = null; isset($orderPresta->carrier_tax_rate) ? $this->carrier_tax_rate = $orderPresta->carrier_tax_rate : $this->carrier_tax_rate = null; isset($orderPresta->total_wrapping) ? $this->total_wrapping = $orderPresta->total_wrapping : $this->total_wrapping = null; isset($orderPresta->total_wrapping_tax_incl) ? $this->total_wrapping_tax_incl = $orderPresta->total_wrapping_tax_incl : $this->total_wrapping_tax_incl = null; isset($orderPresta->total_wrapping_tax_excl) ? $this->total_wrapping_tax_excl = $orderPresta->total_wrapping_tax_excl : $this->total_wrapping_tax_excl = null; isset($orderPresta->shipping_number) ? $this->shipping_number = $orderPresta->shipping_number : $this->shipping_number = null; isset($orderPresta->conversion_rate) ? $this->conversion_rate = $orderPresta->conversion_rate : $this->conversion_rate = null; isset($orderPresta->reference) ? $this->reference = $orderPresta->reference : $this->reference = null; isset($orderPresta->associations) ? $this->associations = $orderPresta->associations : $this->associations = null; } public function XMLtoClass($xml){ $this->id = (string)$xml->id; $this->id_address_delivery = (string)$xml->id_address_delivery; $this->id_address_invoice = (string)$xml->id_address_invoice; $this->id_cart = (string)$xml->id_cart; $this->id_currency = (string)$xml->id_currency; $this->id_lang = (string)$xml->id_lang; $this->id_customer = (string)$xml->id_customer; $this->id_carrier = (string)$xml->id_carrier; $this->current_state = (string)$xml->current_state; $this->module = (string)$xml->module; $this->invoice_number = (string)$xml->invoice_number; $this->invoice_date = (string)$xml->invoice_date; $this->delivery_number = (string)$xml->delivery_number; $this->delivery_date = (string)$xml->delivery_date; $this->valid = (string)$xml->valid; $this->date_add = (string)$xml->date_add; $this->date_upd = (string)$xml->date_upd; $this->id_shop_group = (string)$xml->id_shop_group; $this->id_shop = (string)$xml->id_shop; $this->secure_key = (string)$xml->secure_key; $this->payment = (string)$xml->payment; $this->recyclable = (string)$xml->recyclable; $this->gift = (string)$xml->gift; $this->gift_message = (string)$xml->gift_message; $this->total_discounts = (string)$xml->total_discounts; $this->total_discounts_tax_incl = (string)$xml->total_discounts_tax_incl; $this->total_discounts_tax_excl = (string)$xml->total_discounts_tax_excl; $this->total_paid = (string)$xml->total_paid; $this->total_paid_tax_incl = (string)$xml->total_paid_tax_incl; $this->total_paid_tax_excl = (string)$xml->total_paid_tax_excl; $this->total_paid_real = (string)$xml->total_paid_real; $this->total_products = (string)$xml->total_products; $this->total_products_wt = (string)$xml->total_products_wt; $this->total_shipping = (string)$xml->total_shipping; $this->total_shipping_tax_incl = (string)$xml->total_shipping_tax_incl; $this->total_shipping_tax_excl = (string)$xml->total_shipping_tax_excl; $this->carrier_tax_rate = (string)$xml->carrier_tax_rate; $this->total_wrapping = (string)$xml->total_wrapping; $this->total_wrapping_tax_incl = (string)$xml->total_wrapping_tax_incl; $this->total_wrapping_tax_excl = (string)$xml->total_wrapping_tax_excl; $this->shipping_number = (string)$xml->shipping_number; $this->conversion_rate = (string)$xml->conversion_rate; $this->reference = (string)$xml->reference; $this->associations = (string)$xml->associations; } public function exchangeArray($data) { $this->id = (isset($data['id'])) ? $data['id'] : null; $this->id_address_delivery = (isset($data['id_address_delivery'])) ? $data['id_address_delivery'] : null; $this->id_address_invoice = (isset($data['id_address_invoice'])) ? $data['id_address_invoice'] : null; $this->id_cart = (isset($data['id_cart'])) ? $data['id_cart'] : null; $this->id_currency = (isset($data['id_currency'])) ? $data['id_currency'] : null; $this->id_lang = (isset($data['id_lang'])) ? $data['id_lang'] : null; $this->id_customer = (isset($data['id_customer'])) ? $data['id_customer'] : null; $this->id_carrier = (isset($data['id_carrier'])) ? $data['id_carrier'] : null; $this->current_state = (isset($data['current_state'])) ? $data['current_state'] : null; $this->module = (isset($data['module'])) ? $data['module'] : null; $this->invoice_number = (isset($data['invoice_number'])) ? $data['invoice_number'] : null; $this->invoice_date = (isset($data['invoice_date'])) ? $data['invoice_date'] : null; $this->delivery_number = (isset($data['delivery_number'])) ? $data['delivery_number'] : null; $this->delivery_date = (isset($data['delivery_date'])) ? $data['delivery_date'] : null; $this->valid = (isset($data['valid'])) ? $data['valid'] : null; $this->date_add = (isset($data['date_add'])) ? $data['date_add'] : null; $this->date_upd = (isset($data['date_upd'])) ? $data['date_upd'] : null; $this->id_shop_group = (isset($data['id_shop_group'])) ? $data['id_shop_group'] : null; $this->id_shop = (isset($data['id_shop'])) ? $data['id_shop'] : null; $this->secure_key = (isset($data['secure_key'])) ? $data['secure_key'] : null; $this->payment = (isset($data['payment'])) ? $data['payment'] : null; $this->recyclable = (isset($data['recyclable'])) ? $data['recyclable'] : null; $this->gift = (isset($data['gift'])) ? $data['gift'] : null; $this->gift_message = (isset($data['gift_message'])) ? $data['gift_message'] : null; $this->total_discounts = (isset($data['total_discounts'])) ? $data['total_discounts'] : null; $this->total_discounts_tax_incl = (isset($data['total_discounts_tax_incl'])) ? $data['total_discounts_tax_incl'] : null; $this->total_discounts_tax_excl = (isset($data['total_discounts_tax_excl'])) ? $data['total_discounts_tax_excl'] : null; $this->total_paid = (isset($data['total_paid'])) ? $data['total_paid'] : null; $this->total_paid_tax_incl = (isset($data['total_paid_tax_incl'])) ? $data['total_paid_tax_incl'] : null; $this->total_paid_tax_excl = (isset($data['total_paid_tax_excl'])) ? $data['total_paid_tax_excl'] : null; $this->total_paid_real = (isset($data['total_paid_real'])) ? $data['total_paid_real'] : null; $this->total_products = (isset($data['total_products'])) ? $data['total_products'] : null; $this->total_products_wt = (isset($data['total_products_wt'])) ? $data['total_products_wt'] : null; $this->total_shipping = (isset($data['total_shipping'])) ? $data['total_shipping'] : null; $this->total_shipping_tax_incl = (isset($data['total_shipping_tax_incl'])) ? $data['total_shipping_tax_incl'] : null; $this->total_shipping_tax_excl = (isset($data['total_shipping_tax_excl'])) ? $data['total_shipping_tax_excl'] : null; $this->carrier_tax_rate = (isset($data['carrier_tax_rate'])) ? $data['carrier_tax_rate'] : null; $this->total_wrapping = (isset($data['total_wrapping'])) ? $data['total_wrapping'] : null; $this->total_wrapping_tax_incl = (isset($data['total_wrapping_tax_incl'])) ? $data['total_wrapping_tax_incl'] : null; $this->total_wrapping_tax_excl = (isset($data['total_wrapping_tax_excl'])) ? $data['total_wrapping_tax_excl'] : null; $this->shipping_number = (isset($data['shipping_number'])) ? $data['shipping_number'] : null; $this->conversion_rate = (isset($data['conversion_rate'])) ? $data['conversion_rate'] : null; $this->reference = (isset($data['reference'])) ? $data['reference'] : null; $this->associations = (isset($data['associations'])) ? $data['associations'] : null; } public function setInputFilter(InputFilterInterface $inputFilter) { throw new \Exception("Not used"); } public function getInputFilter() { if (!$this->inputFilter) { $inputFilter = new InputFilter(); $factory = new InputFactory(); $this->inputFilter = $inputFilter; } return $this->inputFilter; } } Link to comment Share on other sites More sharing options...
nicky.dev Posted August 30, 2013 Share Posted August 30, 2013 (edited) Hi everyone. I'm searching solution for this problem too. Have you found a solution? Edited August 30, 2013 by nicky.dev (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts