如何在 android 中使用 magento api 从购物车中删除商品?
How to remove an item from cart using magento api in android?
我正在使用 "shoppingCartProductRemove" api 从 magento 的购物车中删除商品。为此,我使用以下代码:
SoapObject item = new SoapObject(NAMESPACE,"shoppingCartProductEntity");
PropertyInfo pinfo = new PropertyInfo();
String productid = productId.get(deleteProductPosition);
pinfo.setName("product_id");
pinfo.setValue(productid);
pinfo.setType(String.class);
item.addProperty(pinfo);
pinfo = new PropertyInfo();
String productsku = productSku.get(deleteProductPosition);
pinfo.setName("sku");
pinfo.setValue(productsku);
pinfo.setType(String.class);
item.addProperty(pinfo);
pinfo = new PropertyInfo();
int productQty = Qty.get(deleteProductPosition);
pinfo.setName("qty");
pinfo.setValue(productQty);
pinfo.setType(Double.class);
item.addProperty(pinfo);
SoapObject EntityArray = new SoapObject(NAMESPACE,"shoppingCartProductEntity");
EntityArray.addProperty("productsData", item);
SoapObject request = new SoapObject(NAMESPACE, "shoppingCartProductRemove");
request.addProperty("sessionId", sessionId);
request.addProperty("quoteId", 118);
request.addProperty("productsData", item);
env.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call("", env);
Object catrInfoObjs = env.getResponse();
但我收到 xml pullparser 异常。是否有从购物车中删除商品的参考。这里需要帮助!!
我使用以下代码得到它:
SoapObject item = new SoapObject(NAMESPACE, "shoppingCartProductEntity");
PropertyInfo pinfo = new PropertyInfo();
pinfo.setName("product_id");
pinfo.setValue(productId.get(deleteProductPosition));
pinfo.setType(String.class);
item.addProperty(pinfo);
pinfo = new PropertyInfo();
pinfo.setName("sku");
pinfo.setValue(productSku.get(deleteProductPosition));
pinfo.setType(String.class);
item.addProperty(pinfo);
int productQty = Qty.get(deleteProductPosition);
pinfo = new PropertyInfo();
pinfo.setName("qty");
pinfo.setValue(productQty);
pinfo.setType(Double.class);
item.addProperty(pinfo);
pinfo = new PropertyInfo();
pinfo.setName("options");
pinfo.setValue(" ");
pinfo.setType(String[].class);
item.addProperty(pinfo);
SoapObject EntityArray = new SoapObject(NAMESPACE, "shoppingCartProductEntityArray");
EntityArray.addProperty("products",item);
SoapObject request = new SoapObject(NAMESPACE, "shoppingCartProductRemove");
request.addProperty("sessionId", sessionId);
request.addProperty("quoteId", 74);
request.addProperty("products",EntityArray);
env.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call("", env);
Object result = (Boolean) env.getResponse();
我正在使用 "shoppingCartProductRemove" api 从 magento 的购物车中删除商品。为此,我使用以下代码:
SoapObject item = new SoapObject(NAMESPACE,"shoppingCartProductEntity");
PropertyInfo pinfo = new PropertyInfo();
String productid = productId.get(deleteProductPosition);
pinfo.setName("product_id");
pinfo.setValue(productid);
pinfo.setType(String.class);
item.addProperty(pinfo);
pinfo = new PropertyInfo();
String productsku = productSku.get(deleteProductPosition);
pinfo.setName("sku");
pinfo.setValue(productsku);
pinfo.setType(String.class);
item.addProperty(pinfo);
pinfo = new PropertyInfo();
int productQty = Qty.get(deleteProductPosition);
pinfo.setName("qty");
pinfo.setValue(productQty);
pinfo.setType(Double.class);
item.addProperty(pinfo);
SoapObject EntityArray = new SoapObject(NAMESPACE,"shoppingCartProductEntity");
EntityArray.addProperty("productsData", item);
SoapObject request = new SoapObject(NAMESPACE, "shoppingCartProductRemove");
request.addProperty("sessionId", sessionId);
request.addProperty("quoteId", 118);
request.addProperty("productsData", item);
env.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call("", env);
Object catrInfoObjs = env.getResponse();
但我收到 xml pullparser 异常。是否有从购物车中删除商品的参考。这里需要帮助!!
我使用以下代码得到它:
SoapObject item = new SoapObject(NAMESPACE, "shoppingCartProductEntity");
PropertyInfo pinfo = new PropertyInfo();
pinfo.setName("product_id");
pinfo.setValue(productId.get(deleteProductPosition));
pinfo.setType(String.class);
item.addProperty(pinfo);
pinfo = new PropertyInfo();
pinfo.setName("sku");
pinfo.setValue(productSku.get(deleteProductPosition));
pinfo.setType(String.class);
item.addProperty(pinfo);
int productQty = Qty.get(deleteProductPosition);
pinfo = new PropertyInfo();
pinfo.setName("qty");
pinfo.setValue(productQty);
pinfo.setType(Double.class);
item.addProperty(pinfo);
pinfo = new PropertyInfo();
pinfo.setName("options");
pinfo.setValue(" ");
pinfo.setType(String[].class);
item.addProperty(pinfo);
SoapObject EntityArray = new SoapObject(NAMESPACE, "shoppingCartProductEntityArray");
EntityArray.addProperty("products",item);
SoapObject request = new SoapObject(NAMESPACE, "shoppingCartProductRemove");
request.addProperty("sessionId", sessionId);
request.addProperty("quoteId", 74);
request.addProperty("products",EntityArray);
env.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call("", env);
Object result = (Boolean) env.getResponse();