AbdullahBasit
Members-
Posts
13 -
Joined
-
Last visited
Profile Information
-
First Name
Abdullah
-
Last Name
Basit
AbdullahBasit's Achievements
Newbie (1/14)
6
Reputation
-
[HELP] Step-by-step to create order via webservice
AbdullahBasit replied to An'im Fahmy's topic in Core developers
You can create customer as follows: $xml->customer->firstname = $customer['firstname']; $xml->customer->lastname = $customer['lastname']; $xml->customer->email = $customer['email']; $xml->customer->newsletter = '1'; $xml->customer->optin = '1'; $xml->customer->active = '1'; $opt = array('resource' => 'customers'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt);- 6 replies
-
- step-by-step
- create order
-
(and 1 more)
Tagged with:
-
I need the function to create the order via Prestashop webservice
AbdullahBasit replied to andreekit's topic in Job Offers
Its not a question its the answer to the question asked by topic creator. It has all the steps necessary to create order via webservice. -
Also, I'm putting id['id_carrier'] as my carrier id is 3. But it is not showing in backend instead all the fields are empty in order details (admin panel) Any leads?
-
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/customers/?schema=synopsis')); $customer = array(); $product = array(); if (!empty(Tools::getValue('c_email'))) $customer['email'] = Tools::getValue('c_email'); else $customer['email'] = '[email protected]'; $customer['firstname'] = Tools::getValue('fname'); $customer['lastname'] = Tools::getValue('lname'); $customer['address1'] = Tools::getValue('c_address'); $customer['city'] = Tools::getValue('c_city'); $customer['phone'] = Tools::getValue('c_phone'); $id['country'] = '165'; $id['lang'] = '1'; $id['currency'] = '1'; $id['carrier'] = '3'; $product['quantity'] = Tools::getValue('c_qty'); $product['id'] = $id_product; $product['price'] = Product::getPriceStatic($product['id']); $product['name'] = Product::getProductName($product['id']); $product['total'] = $product['price'] * $product['quantity']; $xml->customer->firstname = $customer['firstname']; $xml->customer->lastname = $customer['lastname']; $xml->customer->email = $customer['email']; $xml->customer->newsletter = '1'; $xml->customer->optin = '1'; $xml->customer->active = '1'; $opt = array('resource' => 'customers'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created customer $id['customer'] = $xml->customer->id; // CREATE Address $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/addresses?schema=synopsis')); $xml->address->id_customer = $id['customer']; $xml->address->firstname = $customer['firstname']; $xml->address->lastname = $customer['lastname']; $xml->address->address1 = $customer['address1']; $xml->address->city = $customer['city']; $xml->address->phone_mobile = $customer['phone']; $xml->address->id_country = $id['country']; $xml->address->alias = '-'; $opt = array('resource' => 'addresses'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created address $id['address'] = $xml->address->id; // CREATE Cart $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/carts?schema=blank')); $xml->cart->id_customer = $id['customer']; $xml->cart->id_address_delivery = $id['address']; $xml->cart->id_address_invoice = $id['address']; $xml->cart->id_currency = $id['currency']; $xml->cart->id_lang = $id['lang']; $xml->cart->id_carrier = $id['carrier']; $xml->cart->associations->cart_rows->cart_row->id_product = $product['id']; $xml->cart->associations->cart_rows->cart_row->quantity = $product['quantity']; if(!empty(Tools::getValue('product_attr'))) $xml->cart->associations->cart_rows->cart_row->id_product_attribute = Tools::getValue('product_attr'); $opt = array('resource' => 'carts'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created cart $id['cart'] = $xml->cart->id; // CREATE Order $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/orders?schema=blank')); $xml->order->id_customer = $id['customer']; $xml->order->id_address_delivery = $id['address']; $xml->order->id_address_invoice = $id['address']; $xml->order->id_cart = $id['cart']; $xml->order->id_currency = $id['currency']; $xml->order->id_lang = $id['lang']; $xml->order->id_carrier = 3; $xml->order->current_state = 3; $xml->order->valid = 0; $xml->order->payment = 'Cash on delivery'; $xml->order->module = 'cashondelivery'; $xml->order->total_paid = $product['total']; $xml->order->total_paid_tax_incl = $product['total']; $xml->order->total_paid_tax_excl = $product['total']; $xml->order->total_paid_real = '0'; $xml->order->total_products = $product['total']; $xml->order->total_products_wt = $product['total']; $xml->order->conversion_rate = '1'; $xml->order->associations->order_rows->order_row->product_id = $product['id']; $xml->order->associations->order_rows->order_row->product_quantity = $product['quantity']; $opt = array('resource' => 'orders'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); $id['order'] = $xml->order->id; $id['secure_key'] = $xml->order->secure_key; $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/order_histories?schema=blank')); $xml->order_history->id_order = $id['order']; $xml->order_history->id_order_state = '3'; $opt = array('resource' => 'order_histories'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt);
-
Are you sure you need to write "putXml" instead of "postXml" ?
-
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/customers/?schema=synopsis')); $customer = array(); $product = array(); if (!empty(Tools::getValue('c_email'))) $customer['email'] = Tools::getValue('c_email'); else $customer['email'] = '[email protected]'; $customer['firstname'] = Tools::getValue('fname'); $customer['lastname'] = Tools::getValue('lname'); $customer['address1'] = Tools::getValue('c_address'); $customer['city'] = Tools::getValue('c_city'); $customer['phone'] = Tools::getValue('c_phone'); $id['country'] = '165'; $id['lang'] = '1'; $id['currency'] = '1'; $id['carrier'] = '3'; $product['quantity'] = Tools::getValue('c_qty'); $product['id'] = $id_product; $product['price'] = Product::getPriceStatic($product['id']); $product['name'] = Product::getProductName($product['id']); $product['total'] = $product['price'] * $product['quantity']; $xml->customer->firstname = $customer['firstname']; $xml->customer->lastname = $customer['lastname']; $xml->customer->email = $customer['email']; $xml->customer->newsletter = '1'; $xml->customer->optin = '1'; $xml->customer->active = '1'; $opt = array('resource' => 'customers'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created customer $id['customer'] = $xml->customer->id; // CREATE Address $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/addresses?schema=synopsis')); $xml->address->id_customer = $id['customer']; $xml->address->firstname = $customer['firstname']; $xml->address->lastname = $customer['lastname']; $xml->address->address1 = $customer['address1']; $xml->address->city = $customer['city']; $xml->address->phone_mobile = $customer['phone']; $xml->address->id_country = $id['country']; $xml->address->alias = '-'; $opt = array('resource' => 'addresses'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created address $id['address'] = $xml->address->id; // CREATE Cart $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/carts?schema=blank')); $xml->cart->id_customer = $id['customer']; $xml->cart->id_address_delivery = $id['address']; $xml->cart->id_address_invoice = $id['address']; $xml->cart->id_currency = $id['currency']; $xml->cart->id_lang = $id['lang']; $xml->cart->id_carrier = $id['carrier']; $xml->cart->associations->cart_rows->cart_row->id_product = $product['id']; $xml->cart->associations->cart_rows->cart_row->quantity = $product['quantity']; if(!empty(Tools::getValue('product_attr'))) $xml->cart->associations->cart_rows->cart_row->id_product_attribute = Tools::getValue('product_attr'); $opt = array('resource' => 'carts'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created cart $id['cart'] = $xml->cart->id; // CREATE Order $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/orders?schema=blank')); $xml->order->id_customer = $id['customer']; $xml->order->id_address_delivery = $id['address']; $xml->order->id_address_invoice = $id['address']; $xml->order->id_cart = $id['cart']; $xml->order->id_currency = $id['currency']; $xml->order->id_lang = $id['lang']; $xml->order->id_carrier = 3; $xml->order->current_state = 3; $xml->order->valid = 0; $xml->order->payment = 'Cash on delivery'; $xml->order->module = 'cashondelivery'; $xml->order->total_paid = $product['total']; $xml->order->total_paid_tax_incl = $product['total']; $xml->order->total_paid_tax_excl = $product['total']; $xml->order->total_paid_real = '0'; $xml->order->total_products = $product['total']; $xml->order->total_products_wt = $product['total']; $xml->order->conversion_rate = '1'; $xml->order->associations->order_rows->order_row->product_id = $product['id']; $xml->order->associations->order_rows->order_row->product_quantity = $product['quantity']; $opt = array('resource' => 'orders'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); $id['order'] = $xml->order->id; $id['secure_key'] = $xml->order->secure_key; $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/order_histories?schema=blank')); $xml->order_history->id_order = $id['order']; $xml->order_history->id_order_state = '3'; $opt = array('resource' => 'order_histories'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt);
-
Create order via Webservices
AbdullahBasit replied to avatarusswtor's topic in Addons, modules and themes developers
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/customers/?schema=synopsis')); $customer = array(); $product = array(); if (!empty(Tools::getValue('c_email'))) $customer['email'] = Tools::getValue('c_email'); else $customer['email'] = '[email protected]'; $customer['firstname'] = Tools::getValue('fname'); $customer['lastname'] = Tools::getValue('lname'); $customer['address1'] = Tools::getValue('c_address'); $customer['city'] = Tools::getValue('c_city'); $customer['phone'] = Tools::getValue('c_phone'); $id['country'] = '165'; $id['lang'] = '1'; $id['currency'] = '1'; $id['carrier'] = '3'; $product['quantity'] = Tools::getValue('c_qty'); $product['id'] = $id_product; $product['price'] = Product::getPriceStatic($product['id']); $product['name'] = Product::getProductName($product['id']); $product['total'] = $product['price'] * $product['quantity']; $xml->customer->firstname = $customer['firstname']; $xml->customer->lastname = $customer['lastname']; $xml->customer->email = $customer['email']; $xml->customer->newsletter = '1'; $xml->customer->optin = '1'; $xml->customer->active = '1'; $opt = array('resource' => 'customers'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created customer $id['customer'] = $xml->customer->id; // CREATE Address $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/addresses?schema=synopsis')); $xml->address->id_customer = $id['customer']; $xml->address->firstname = $customer['firstname']; $xml->address->lastname = $customer['lastname']; $xml->address->address1 = $customer['address1']; $xml->address->city = $customer['city']; $xml->address->phone_mobile = $customer['phone']; $xml->address->id_country = $id['country']; $xml->address->alias = '-'; $opt = array('resource' => 'addresses'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created address $id['address'] = $xml->address->id; // CREATE Cart $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/carts?schema=blank')); $xml->cart->id_customer = $id['customer']; $xml->cart->id_address_delivery = $id['address']; $xml->cart->id_address_invoice = $id['address']; $xml->cart->id_currency = $id['currency']; $xml->cart->id_lang = $id['lang']; $xml->cart->id_carrier = $id['carrier']; $xml->cart->associations->cart_rows->cart_row->id_product = $product['id']; $xml->cart->associations->cart_rows->cart_row->quantity = $product['quantity']; if(!empty(Tools::getValue('product_attr'))) $xml->cart->associations->cart_rows->cart_row->id_product_attribute = Tools::getValue('product_attr'); $opt = array('resource' => 'carts'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created cart $id['cart'] = $xml->cart->id; // CREATE Order $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/orders?schema=blank')); $xml->order->id_customer = $id['customer']; $xml->order->id_address_delivery = $id['address']; $xml->order->id_address_invoice = $id['address']; $xml->order->id_cart = $id['cart']; $xml->order->id_currency = $id['currency']; $xml->order->id_lang = $id['lang']; $xml->order->id_carrier = 3; $xml->order->current_state = 3; $xml->order->valid = 0; $xml->order->payment = 'Cash on delivery'; $xml->order->module = 'cashondelivery'; $xml->order->total_paid = $product['total']; $xml->order->total_paid_tax_incl = $product['total']; $xml->order->total_paid_tax_excl = $product['total']; $xml->order->total_paid_real = '0'; $xml->order->total_products = $product['total']; $xml->order->total_products_wt = $product['total']; $xml->order->conversion_rate = '1'; $xml->order->associations->order_rows->order_row->product_id = $product['id']; $xml->order->associations->order_rows->order_row->product_quantity = $product['quantity']; $opt = array('resource' => 'orders'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); $id['order'] = $xml->order->id; $id['secure_key'] = $xml->order->secure_key; $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/order_histories?schema=blank')); $xml->order_history->id_order = $id['order']; $xml->order_history->id_order_state = '3'; $opt = array('resource' => 'order_histories'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); -
I need the function to create the order via Prestashop webservice
AbdullahBasit replied to andreekit's topic in Job Offers
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/customers/?schema=synopsis')); $customer = array(); $product = array(); if (!empty(Tools::getValue('c_email'))) $customer['email'] = Tools::getValue('c_email'); else $customer['email'] = '[email protected]'; $customer['firstname'] = Tools::getValue('fname'); $customer['lastname'] = Tools::getValue('lname'); $customer['address1'] = Tools::getValue('c_address'); $customer['city'] = Tools::getValue('c_city'); $customer['phone'] = Tools::getValue('c_phone'); $id['country'] = '165'; $id['lang'] = '1'; $id['currency'] = '1'; $id['carrier'] = '3'; $product['quantity'] = Tools::getValue('c_qty'); $product['id'] = $id_product; $product['price'] = Product::getPriceStatic($product['id']); $product['name'] = Product::getProductName($product['id']); $product['total'] = $product['price'] * $product['quantity']; $xml->customer->firstname = $customer['firstname']; $xml->customer->lastname = $customer['lastname']; $xml->customer->email = $customer['email']; $xml->customer->newsletter = '1'; $xml->customer->optin = '1'; $xml->customer->active = '1'; $opt = array('resource' => 'customers'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created customer $id['customer'] = $xml->customer->id; // CREATE Address $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/addresses?schema=synopsis')); $xml->address->id_customer = $id['customer']; $xml->address->firstname = $customer['firstname']; $xml->address->lastname = $customer['lastname']; $xml->address->address1 = $customer['address1']; $xml->address->city = $customer['city']; $xml->address->phone_mobile = $customer['phone']; $xml->address->id_country = $id['country']; $xml->address->alias = '-'; $opt = array('resource' => 'addresses'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created address $id['address'] = $xml->address->id; // CREATE Cart $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/carts?schema=blank')); $xml->cart->id_customer = $id['customer']; $xml->cart->id_address_delivery = $id['address']; $xml->cart->id_address_invoice = $id['address']; $xml->cart->id_currency = $id['currency']; $xml->cart->id_lang = $id['lang']; $xml->cart->id_carrier = $id['carrier']; $xml->cart->associations->cart_rows->cart_row->id_product = $product['id']; $xml->cart->associations->cart_rows->cart_row->quantity = $product['quantity']; if(!empty(Tools::getValue('product_attr'))) $xml->cart->associations->cart_rows->cart_row->id_product_attribute = Tools::getValue('product_attr'); $opt = array('resource' => 'carts'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created cart $id['cart'] = $xml->cart->id; // CREATE Order $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/orders?schema=blank')); $xml->order->id_customer = $id['customer']; $xml->order->id_address_delivery = $id['address']; $xml->order->id_address_invoice = $id['address']; $xml->order->id_cart = $id['cart']; $xml->order->id_currency = $id['currency']; $xml->order->id_lang = $id['lang']; $xml->order->id_carrier = 3; $xml->order->current_state = 3; $xml->order->valid = 0; $xml->order->payment = 'Cash on delivery'; $xml->order->module = 'cashondelivery'; $xml->order->total_paid = $product['total']; $xml->order->total_paid_tax_incl = $product['total']; $xml->order->total_paid_tax_excl = $product['total']; $xml->order->total_paid_real = '0'; $xml->order->total_products = $product['total']; $xml->order->total_products_wt = $product['total']; $xml->order->conversion_rate = '1'; $xml->order->associations->order_rows->order_row->product_id = $product['id']; $xml->order->associations->order_rows->order_row->product_quantity = $product['quantity']; $opt = array('resource' => 'orders'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); $id['order'] = $xml->order->id; $id['secure_key'] = $xml->order->secure_key; $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/order_histories?schema=blank')); $xml->order_history->id_order = $id['order']; $xml->order_history->id_order_state = '3'; $opt = array('resource' => 'order_histories'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); -
[HELP] Step-by-step to create order via webservice
AbdullahBasit replied to An'im Fahmy's topic in Core developers
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/customers/?schema=synopsis')); $customer = array(); $product = array(); if (!empty(Tools::getValue('c_email'))) $customer['email'] = Tools::getValue('c_email'); else $customer['email'] = '[email protected]'; $customer['firstname'] = Tools::getValue('fname'); $customer['lastname'] = Tools::getValue('lname'); $customer['address1'] = Tools::getValue('c_address'); $customer['city'] = Tools::getValue('c_city'); $customer['phone'] = Tools::getValue('c_phone'); $id['country'] = '165'; $id['lang'] = '1'; $id['currency'] = '1'; $id['carrier'] = '3'; $product['quantity'] = Tools::getValue('c_qty'); $product['id'] = $id_product; $product['price'] = Product::getPriceStatic($product['id']); $product['name'] = Product::getProductName($product['id']); $product['total'] = $product['price'] * $product['quantity']; $xml->customer->firstname = $customer['firstname']; $xml->customer->lastname = $customer['lastname']; $xml->customer->email = $customer['email']; $xml->customer->newsletter = '1'; $xml->customer->optin = '1'; $xml->customer->active = '1'; $opt = array('resource' => 'customers'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created customer $id['customer'] = $xml->customer->id; // CREATE Address $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/addresses?schema=synopsis')); $xml->address->id_customer = $id['customer']; $xml->address->firstname = $customer['firstname']; $xml->address->lastname = $customer['lastname']; $xml->address->address1 = $customer['address1']; $xml->address->city = $customer['city']; $xml->address->phone_mobile = $customer['phone']; $xml->address->id_country = $id['country']; $xml->address->alias = '-'; $opt = array('resource' => 'addresses'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created address $id['address'] = $xml->address->id; // CREATE Cart $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/carts?schema=blank')); $xml->cart->id_customer = $id['customer']; $xml->cart->id_address_delivery = $id['address']; $xml->cart->id_address_invoice = $id['address']; $xml->cart->id_currency = $id['currency']; $xml->cart->id_lang = $id['lang']; $xml->cart->id_carrier = $id['carrier']; $xml->cart->associations->cart_rows->cart_row->id_product = $product['id']; $xml->cart->associations->cart_rows->cart_row->quantity = $product['quantity']; if(!empty(Tools::getValue('product_attr'))) $xml->cart->associations->cart_rows->cart_row->id_product_attribute = Tools::getValue('product_attr'); $opt = array('resource' => 'carts'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created cart $id['cart'] = $xml->cart->id; // CREATE Order $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/orders?schema=blank')); $xml->order->id_customer = $id['customer']; $xml->order->id_address_delivery = $id['address']; $xml->order->id_address_invoice = $id['address']; $xml->order->id_cart = $id['cart']; $xml->order->id_currency = $id['currency']; $xml->order->id_lang = $id['lang']; $xml->order->id_carrier = 3; $xml->order->current_state = 3; $xml->order->valid = 0; $xml->order->payment = 'Cash on delivery'; $xml->order->module = 'cashondelivery'; $xml->order->total_paid = $product['total']; $xml->order->total_paid_tax_incl = $product['total']; $xml->order->total_paid_tax_excl = $product['total']; $xml->order->total_paid_real = '0'; $xml->order->total_products = $product['total']; $xml->order->total_products_wt = $product['total']; $xml->order->conversion_rate = '1'; $xml->order->associations->order_rows->order_row->product_id = $product['id']; $xml->order->associations->order_rows->order_row->product_quantity = $product['quantity']; $opt = array('resource' => 'orders'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); $id['order'] = $xml->order->id; $id['secure_key'] = $xml->order->secure_key; $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/order_histories?schema=blank')); $xml->order_history->id_order = $id['order']; $xml->order_history->id_order_state = '3'; $opt = array('resource' => 'order_histories'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt);- 6 replies
-
- 1
-
- step-by-step
- create order
-
(and 1 more)
Tagged with:
-
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/customers/?schema=synopsis')); $customer = array(); $product = array(); if (!empty(Tools::getValue('c_email'))) $customer['email'] = Tools::getValue('c_email'); else $customer['email'] = '[email protected]'; $customer['firstname'] = Tools::getValue('fname'); $customer['lastname'] = Tools::getValue('lname'); $customer['address1'] = Tools::getValue('c_address'); $customer['city'] = Tools::getValue('c_city'); $customer['phone'] = Tools::getValue('c_phone'); $id['country'] = '165'; $id['lang'] = '1'; $id['currency'] = '1'; $id['carrier'] = '3'; $product['quantity'] = Tools::getValue('c_qty'); $product['id'] = $id_product; $product['price'] = Product::getPriceStatic($product['id']); $product['name'] = Product::getProductName($product['id']); $product['total'] = $product['price'] * $product['quantity']; $xml->customer->firstname = $customer['firstname']; $xml->customer->lastname = $customer['lastname']; $xml->customer->email = $customer['email']; $xml->customer->newsletter = '1'; $xml->customer->optin = '1'; $xml->customer->active = '1'; $opt = array('resource' => 'customers'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created customer $id['customer'] = $xml->customer->id; // CREATE Address $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/addresses?schema=synopsis')); $xml->address->id_customer = $id['customer']; $xml->address->firstname = $customer['firstname']; $xml->address->lastname = $customer['lastname']; $xml->address->address1 = $customer['address1']; $xml->address->city = $customer['city']; $xml->address->phone_mobile = $customer['phone']; $xml->address->id_country = $id['country']; $xml->address->alias = '-'; $opt = array('resource' => 'addresses'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created address $id['address'] = $xml->address->id; // CREATE Cart $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/carts?schema=blank')); $xml->cart->id_customer = $id['customer']; $xml->cart->id_address_delivery = $id['address']; $xml->cart->id_address_invoice = $id['address']; $xml->cart->id_currency = $id['currency']; $xml->cart->id_lang = $id['lang']; $xml->cart->id_carrier = $id['carrier']; $xml->cart->associations->cart_rows->cart_row->id_product = $product['id']; $xml->cart->associations->cart_rows->cart_row->quantity = $product['quantity']; if(!empty(Tools::getValue('product_attr'))) $xml->cart->associations->cart_rows->cart_row->id_product_attribute = Tools::getValue('product_attr'); $opt = array('resource' => 'carts'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // ID of created cart $id['cart'] = $xml->cart->id; // CREATE Order $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/orders?schema=blank')); $xml->order->id_customer = $id['customer']; $xml->order->id_address_delivery = $id['address']; $xml->order->id_address_invoice = $id['address']; $xml->order->id_cart = $id['cart']; $xml->order->id_currency = $id['currency']; $xml->order->id_lang = $id['lang']; $xml->order->id_carrier = 3; $xml->order->current_state = 3; $xml->order->valid = 0; $xml->order->payment = 'Cash on delivery'; $xml->order->module = 'cashondelivery'; $xml->order->total_paid = $product['total']; $xml->order->total_paid_tax_incl = $product['total']; $xml->order->total_paid_tax_excl = $product['total']; $xml->order->total_paid_real = '0'; $xml->order->total_products = $product['total']; $xml->order->total_products_wt = $product['total']; $xml->order->conversion_rate = '1'; $xml->order->associations->order_rows->order_row->product_id = $product['id']; $xml->order->associations->order_rows->order_row->product_quantity = $product['quantity']; $opt = array('resource' => 'orders'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); $id['order'] = $xml->order->id; $id['secure_key'] = $xml->order->secure_key; $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/order_histories?schema=blank')); $xml->order_history->id_order = $id['order']; $xml->order_history->id_order_state = '3'; $opt = array('resource' => 'order_histories'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt);
- 24 replies
-
- 3
-
- webservice
- crud
-
(and 2 more)
Tagged with:
-
Changing Blocklayered folder permission to 755 and all sub-folder and files permission to 644 resolves the issue. If a file or folder is set to "777" which is "world" writable for security reasons the 403 error will be displayed to protect your website from hacks. Folders should have the permissions set to "750" or "755" and files should be set to "644"
- 47 replies
-
- blocklayered
- block
-
(and 8 more)
Tagged with: