Кто-нибудь знает, какие звонки на мыло необходимы для создания заказа
Я пытаюсь вставить заказ с помощью вызовов soap. Я не могу понять, какие звонки понадобятся для создания и привязки заказа, от начала до конца.
Я не делаю этого на php, но если у меня есть все вызовы, перечисленные в wsdl, то я мог бы выяснить, как они на самом деле называются..
Мне просто очень нужны имена стандартных вызовов.
2 answers
Здесь у вас есть пример php (из руководства Magento API) о том, как создать заказ с необходимыми вызовами:
/**
* Example of order creation
* Preconditionsare as follows:
* 1. Create a customer
* 2. Сreate a simple product */
$user = 'apiUser';
$password = 'apiKey';
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
$sessionId = $proxy->login($user, $password);
$cartId = $proxy->shoppingCartCreate($sessionId, 1);
// load the customer list and select the first customer from the list
$customerList = $proxy->customerCustomerList($sessionId, array());
$customer = (array) $customerList[0];
$customer['mode'] = 'customer';
$proxy->shoppingCartCustomerSet($sessionId, $cartId, $customer);
// load the product list and select the first product from the list
$productList = $proxy->catalogProductList($sessionId);
$product = (array) $productList[0];
$product['qty'] = 1;
$proxy->shoppingCartProductAdd($sessionId, $cartId, array($product));
$address = array(
array(
'mode' => 'shipping',
'firstname' => $customer['firstname'],
'lastname' => $customer['lastname'],
'street' => 'street address',
'city' => 'city',
'region' => 'region',
'telephone' => 'phone number',
'postcode' => 'postcode',
'country_id' => 'country ID',
'is_default_shipping' => 0,
'is_default_billing' => 0
),
array(
'mode' => 'billing',
'firstname' => $customer['firstname'],
'lastname' => $customer['lastname'],
'street' => 'street address',
'city' => 'city',
'region' => 'region',
'telephone' => 'phone number',
'postcode' => 'postcode',
'country_id' => 'country ID',
'is_default_shipping' => 0,
'is_default_billing' => 0
),
);
// add customer address
$proxy->shoppingCartCustomerAddresses($sessionId, $cartId, $address);
// add shipping method
$proxy->shoppingCartShippingMethod($sessionId, $cartId, 'flatrate_flatrate');
$paymentMethod = array(
'po_number' => null,
'method' => 'checkmo',
'cc_cid' => null,
'cc_owner' => null,
'cc_number' => null,
'cc_type' => null,
'cc_exp_year' => null,
'cc_exp_month' => null
);
// add payment method
$proxy->shoppingCartPaymentMethod($sessionId, $cartId, $paymentMethod);
// place the order
$orderId = $proxy->shoppingCartOrder($sessionId, $cartId, null, null);
Вот решение Создайте соответствующую роль (Администратор Magento) Создание пользователя веб-служб (администратор Magento) Назначьте созданную роль пользователю (администратор Magento) Войдите в веб-службу и получите идентификатор сеанса (клиент Soap) Вызовите соответствующий метод (Soap-клиент)
Вот ссылка для использования api magento http://www.magentocommerce.com/api/soap/introduction.html