AbanteCart Community

AbanteCart Development => API Development => Topic started by: pyroxide on June 03, 2015, 03:28:34 PM

Title: formatting for options using API
Post by: pyroxide on June 03, 2015, 03:28:34 PM
currently developing an app as a front-end of my shopping cart. how am i supposed to format the options when adding an item to the customer's cart (rt=a/checkout/cart)?
Title: Re: formatting for options using API
Post by: eCommerce Core on June 04, 2015, 07:29:06 AM
You need to add 'option' : {} to your post

To know format and values you can first run a/product/product to get product options.

Check this example:
https://github.com/abantecart/testing_tools/blob/master/test_api.php

Or demo:
http://demo.abantecart.com/test_api.php


Title: Re: formatting for options using API
Post by: pyroxide on June 04, 2015, 06:27:37 PM
aha! i found the solution. the format is multiple instances of option[ID]=VALUE . i had to look at the method params in the api test to find that out. never knew that such a page existed. it was very helpful.

in C# i'm using the following:

for (int i=0; i<options.Count; i++)
{
   frmProduct.AddField("option[" + options[i].ToString() + ']', optionValues[i].ToString());
}

where options and optionValues are both instances of System.Collections.ArrayList