K2SOAP and Magento:- ERROR while adding product to cart with custom options

444 views
Skip to first unread message

Siddharth Vaghasia

unread,
Oct 18, 2014, 4:27:28 PM10/18/14
to ksoap2-...@googlegroups.com, Mehul Mistri, Manish Dudharejia, hi...@e2msolutions.com, Hiren Ponkia
Hi All,

We are trying to add product to cart using K2soap library and using magento webservice at below url


We always get error saying "please specify required options" (there is custom option which is required for a product to selected in front end). 
Below is code which we is working with PHP client and also options are retrievable with on cart info method.

PHP Client Code example-  WHICH IS WORKING FINE AND PRODUCTS OPTIONS ARE ADDING CORRECTLY
$result = $client->shoppingCartProductAdd($session, 854, array(array(
'product_id' => '899',
'qty' => '1',
'options' => array(array('key'=>8,'value'=>6))
)));  

  
From andriod we are getting above error and we are not able to add product to cart if custom options is required(which is functionality in our case)

Below is code which we are using to addproductto cart with option


SoapObject EntityArray = new SoapObject(AppUtils.NAMESPACE, "shoppingCartProductEntityArray");
String valueId = AppUtils.ticketOptionList.get(selectedTicketOptionPos).get("value_id");
Log.e("valueId===>>>",valueId);
 
// SoapObject options = new SoapObject(AppUtils.NAMESPACE, "options");
SoapObject options1 = new SoapObject(AppUtils.NAMESPACE, "options");
 
pi = new PropertyInfo();
pi.setName("key");
pi.setValue(8);
pi.setType(Integer.class);
options1.addProperty(pi);
pi = new PropertyInfo();
pi.setName("value");
pi.setValue(valueId);
pi.setType(Integer.class);
options1.addProperty(pi);
               SingleProduct.addProperty("options",options1);
 
       EntityArray.addProperty("products",SingleProduct);
request.addProperty("products",EntityArray);

Log.e("productsVa",EntityArray.toString());
env.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(AppUtils.URL);
androidHttpTransport.call("", env);

Below is array which is getting created for products and passed to cart method, but sucesss..

shoppingCartProductEntityArray{products=shoppingCartProductEntity{product_id=899; qty=1; options=options{key=8; value=5; }; }; }

Can someone please guide how to create objects IN ANDRIOD to pass ASSOCIATIVE ARRAY so that it is set correctly and product gets added to cart.

Thanks
Siddharth Vaghasia



Rahul Ansari

unread,
Nov 30, 2015, 7:43:22 AM11/30/15
to ksoap2-android, meh...@e2msolutions.com, man...@syndicateventures.com, hi...@e2msolutions.com, hi...@effectualmedia.com
Hello, did you get any solution to this problem. Please share.

shubha...@conversionbug.com

unread,
Nov 13, 2017, 1:03:15 AM11/13/17
to ksoap2-android
If you have got any answer, please let me know...I am also facing this issue.


On Sunday, October 19, 2014 at 1:57:28 AM UTC+5:30, Siddharth Vaghasia wrote:
Reply all
Reply to author
Forward
0 new messages