如何使用 Android 中的 Magento SOAP API v2 方法 shoppingCartCustomerAddresses 将送货地址设置为购物车报价?
How to set shipping address to shopping cart quote using Magento SOAP API v2 method shoppingCartCustomerAddresses in Android?
如何使用 Android 中的 Magento SOAP API v2 方法 shoppingCartCustomerAddresses
使用 ksoap2 Android 库将送货地址设置为购物车报价?
当我设置送货地址和账单地址时,会设置账单地址而不是送货地址。设置地址时结果为真。使用 PHP 正确设置地址,因为我在调用 shoppingCartInfo
方法时得到正确的响应。我认为下面的格式是错误的,谁能告诉我正确的格式。以下是我尝试过的:
SoapObject item = new SoapObject(NAMESPACE, "shoppingCartCustomerAddressEntity");
PropertyInfo pinfo = new PropertyInfo();
pinfo.setName("mode");
pinfo.setValue("shipping");
pinfo.setType(String.class);
item.addProperty(pinfo);
pinfo = new PropertyInfo();
pinfo.setName("firstname");
pinfo.setValue(firstName);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("FIRST NAME 1", firstName);
pinfo = new PropertyInfo();
pinfo.setName("lastname");
pinfo.setValue(lastName);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("LAST NAME 1", lastName);
pinfo = new PropertyInfo();
pinfo.setName("company");
pinfo.setValue(company1);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("COMPANY 1", company1);
pinfo = new PropertyInfo();
pinfo.setName("street");
pinfo.setValue(street1);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("STREET 1", street1);
pinfo = new PropertyInfo();
pinfo.setName("city");
pinfo.setValue(city1);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("CITY 1", city1);
pinfo = new PropertyInfo();
pinfo.setName("region");
pinfo.setValue(region1);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("REGION 1", region1);
pinfo = new PropertyInfo();
pinfo.setName("postcode");
pinfo.setValue(postcode1);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("POST CODE 1", postcode1);
pinfo = new PropertyInfo();
pinfo.setName("country_id");
pinfo.setValue(countryId1);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("COUNTRY ID 1", countryId1);
pinfo = new PropertyInfo();
pinfo.setName("telephone");
pinfo.setValue(telephone1);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("TELEPHONE 1", telephone1);
pinfo = new PropertyInfo();
pinfo.setName("fax");
pinfo.setValue(fax1);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("FAX 1", fax1);
pinfo = new PropertyInfo();
pinfo.setName("is_default_shipping");
pinfo.setValue(0);
pinfo.setType(Integer.class);
item.addProperty(pinfo);
pinfo = new PropertyInfo();
pinfo.setName("is_default_billing");
pinfo.setValue(1);
pinfo.setType(Integer.class);
item.addProperty(pinfo);
SoapObject entityArray = new SoapObject(NAMESPACE, "shoppingCartCustomerAddressEntityArray");
entityArray.addProperty("customer",item);
SoapObject item1 = new SoapObject(NAMESPACE, "shoppingCartCustomerAddressEntity");
pinfo.setName("mode");
pinfo.setValue("billing");
pinfo.setType(String.class);
item1.addProperty(pinfo);
pinfo = new PropertyInfo();
pinfo.setName("firstname");
pinfo.setValue(firstName);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("FIRST NAME 2", firstName);
pinfo = new PropertyInfo();
pinfo.setName("lastname");
pinfo.setValue(lastName);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("LAST NAME 2", lastName);
pinfo = new PropertyInfo();
pinfo.setName("company");
pinfo.setValue(company2);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("COMPANY 2", company2);
pinfo = new PropertyInfo();
pinfo.setName("street");
pinfo.setValue(street2);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("STREET 2", street2);
pinfo = new PropertyInfo();
pinfo.setName("city");
pinfo.setValue(city2);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("CITY 2", city2);
pinfo = new PropertyInfo();
pinfo.setName("region");
pinfo.setValue(region2);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("REGION 2", region2);
pinfo = new PropertyInfo();
pinfo.setName("postcode");
pinfo.setValue(postcode2);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("POST CODE 2", postcode2);
pinfo = new PropertyInfo();
pinfo.setName("country_id");
pinfo.setValue(countryId2);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("COUNTRY ID 2", countryId2);
pinfo = new PropertyInfo();
pinfo.setName("telephone");
pinfo.setValue(telephone2);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("TELEPHONE 2", telephone2);
pinfo = new PropertyInfo();
pinfo.setName("fax");
pinfo.setValue(fax2);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("FAX 2", fax2);
pinfo = new PropertyInfo();
pinfo.setName("is_default_billing");
pinfo.setValue(0);
pinfo.setType(Integer.class);
item1.addProperty(pinfo);
entityArray.addProperty("customer",item1);
SoapObject request = new SoapObject(NAMESPACE, "shoppingCartCustomerAddresses");
request.addProperty("sessionId", MainActivity.sessionId);
request.addProperty("quoteId", getCartId());
request.addProperty("customer",entityArray);
request.addProperty("storeId", storeId);
MainActivity.env.setOutputSoapObject(request);
MainActivity.androidHttpTransport.call("", MainActivity.env);
Boolean customerAddressAdded = (Boolean) MainActivity.env.getResponse();
NAMESPACE
值为 "urn:Magento"
以下是 shoppingCartInfo 方法响应(仅相关部分):
shipping_address=shoppingCartAddressEntity{
created_at=2015-04-20 04:46:09;
updated_at=2015-04-20 04:46:38;
customer_id=93;
save_in_address_book=0;
address_type=shipping;
same_as_billing=1;
free_shipping=0;
weight=0;
};
billing_address=shoppingCartAddressEntity{
created_at=2015-04-20 04:46:09;
updated_at=2015-04-20 04:46:22;
customer_id=93;
save_in_address_book=0;
address_type=billing;
email=osama@example.com;
firstname=abc;
lastname=xyz;
company=testing;
street=testing;
city=Mumbai;
region=testing;
postcode=123456;
country_id=IN;
telephone=1234567890;
same_as_billing=0;
free_shipping=0;
weight=0;
};
Shipping to multiple addresses
是 yes
并且 Maximum Qty Allowed for Shipping to Multiple Addresses
是 100
在 Magento System->Configuration->SALES->Shipping settings.
我不知道我哪里错了,送货地址没有设置为购物车报价。请帮帮我。
我得到了答案。诀窍就是颠倒地址的顺序。
如何使用 Android 中的 Magento SOAP API v2 方法 shoppingCartCustomerAddresses
使用 ksoap2 Android 库将送货地址设置为购物车报价?
当我设置送货地址和账单地址时,会设置账单地址而不是送货地址。设置地址时结果为真。使用 PHP 正确设置地址,因为我在调用 shoppingCartInfo
方法时得到正确的响应。我认为下面的格式是错误的,谁能告诉我正确的格式。以下是我尝试过的:
SoapObject item = new SoapObject(NAMESPACE, "shoppingCartCustomerAddressEntity");
PropertyInfo pinfo = new PropertyInfo();
pinfo.setName("mode");
pinfo.setValue("shipping");
pinfo.setType(String.class);
item.addProperty(pinfo);
pinfo = new PropertyInfo();
pinfo.setName("firstname");
pinfo.setValue(firstName);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("FIRST NAME 1", firstName);
pinfo = new PropertyInfo();
pinfo.setName("lastname");
pinfo.setValue(lastName);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("LAST NAME 1", lastName);
pinfo = new PropertyInfo();
pinfo.setName("company");
pinfo.setValue(company1);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("COMPANY 1", company1);
pinfo = new PropertyInfo();
pinfo.setName("street");
pinfo.setValue(street1);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("STREET 1", street1);
pinfo = new PropertyInfo();
pinfo.setName("city");
pinfo.setValue(city1);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("CITY 1", city1);
pinfo = new PropertyInfo();
pinfo.setName("region");
pinfo.setValue(region1);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("REGION 1", region1);
pinfo = new PropertyInfo();
pinfo.setName("postcode");
pinfo.setValue(postcode1);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("POST CODE 1", postcode1);
pinfo = new PropertyInfo();
pinfo.setName("country_id");
pinfo.setValue(countryId1);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("COUNTRY ID 1", countryId1);
pinfo = new PropertyInfo();
pinfo.setName("telephone");
pinfo.setValue(telephone1);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("TELEPHONE 1", telephone1);
pinfo = new PropertyInfo();
pinfo.setName("fax");
pinfo.setValue(fax1);
pinfo.setType(String.class);
item.addProperty(pinfo);
Log.i("FAX 1", fax1);
pinfo = new PropertyInfo();
pinfo.setName("is_default_shipping");
pinfo.setValue(0);
pinfo.setType(Integer.class);
item.addProperty(pinfo);
pinfo = new PropertyInfo();
pinfo.setName("is_default_billing");
pinfo.setValue(1);
pinfo.setType(Integer.class);
item.addProperty(pinfo);
SoapObject entityArray = new SoapObject(NAMESPACE, "shoppingCartCustomerAddressEntityArray");
entityArray.addProperty("customer",item);
SoapObject item1 = new SoapObject(NAMESPACE, "shoppingCartCustomerAddressEntity");
pinfo.setName("mode");
pinfo.setValue("billing");
pinfo.setType(String.class);
item1.addProperty(pinfo);
pinfo = new PropertyInfo();
pinfo.setName("firstname");
pinfo.setValue(firstName);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("FIRST NAME 2", firstName);
pinfo = new PropertyInfo();
pinfo.setName("lastname");
pinfo.setValue(lastName);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("LAST NAME 2", lastName);
pinfo = new PropertyInfo();
pinfo.setName("company");
pinfo.setValue(company2);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("COMPANY 2", company2);
pinfo = new PropertyInfo();
pinfo.setName("street");
pinfo.setValue(street2);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("STREET 2", street2);
pinfo = new PropertyInfo();
pinfo.setName("city");
pinfo.setValue(city2);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("CITY 2", city2);
pinfo = new PropertyInfo();
pinfo.setName("region");
pinfo.setValue(region2);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("REGION 2", region2);
pinfo = new PropertyInfo();
pinfo.setName("postcode");
pinfo.setValue(postcode2);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("POST CODE 2", postcode2);
pinfo = new PropertyInfo();
pinfo.setName("country_id");
pinfo.setValue(countryId2);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("COUNTRY ID 2", countryId2);
pinfo = new PropertyInfo();
pinfo.setName("telephone");
pinfo.setValue(telephone2);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("TELEPHONE 2", telephone2);
pinfo = new PropertyInfo();
pinfo.setName("fax");
pinfo.setValue(fax2);
pinfo.setType(String.class);
item1.addProperty(pinfo);
Log.i("FAX 2", fax2);
pinfo = new PropertyInfo();
pinfo.setName("is_default_billing");
pinfo.setValue(0);
pinfo.setType(Integer.class);
item1.addProperty(pinfo);
entityArray.addProperty("customer",item1);
SoapObject request = new SoapObject(NAMESPACE, "shoppingCartCustomerAddresses");
request.addProperty("sessionId", MainActivity.sessionId);
request.addProperty("quoteId", getCartId());
request.addProperty("customer",entityArray);
request.addProperty("storeId", storeId);
MainActivity.env.setOutputSoapObject(request);
MainActivity.androidHttpTransport.call("", MainActivity.env);
Boolean customerAddressAdded = (Boolean) MainActivity.env.getResponse();
NAMESPACE
值为 "urn:Magento"
以下是 shoppingCartInfo 方法响应(仅相关部分):
shipping_address=shoppingCartAddressEntity{
created_at=2015-04-20 04:46:09;
updated_at=2015-04-20 04:46:38;
customer_id=93;
save_in_address_book=0;
address_type=shipping;
same_as_billing=1;
free_shipping=0;
weight=0;
};
billing_address=shoppingCartAddressEntity{
created_at=2015-04-20 04:46:09;
updated_at=2015-04-20 04:46:22;
customer_id=93;
save_in_address_book=0;
address_type=billing;
email=osama@example.com;
firstname=abc;
lastname=xyz;
company=testing;
street=testing;
city=Mumbai;
region=testing;
postcode=123456;
country_id=IN;
telephone=1234567890;
same_as_billing=0;
free_shipping=0;
weight=0;
};
Shipping to multiple addresses
是 yes
并且 Maximum Qty Allowed for Shipping to Multiple Addresses
是 100
在 Magento System->Configuration->SALES->Shipping settings.
我不知道我哪里错了,送货地址没有设置为购物车报价。请帮帮我。
我得到了答案。诀窍就是颠倒地址的顺序。