Author Topic: formatting for options using API  (Read 8847 times)

Offline pyroxide

  • Newbie
  • *
  • Posts: 8
  • Karma: +4/-0
    • View Profile
formatting for options using API
« 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)?

Offline eCommerce Core

  • Administrator
  • Hero Member
  • *****
  • Posts: 1602
  • Karma: +93/-1
    • View Profile
Re: formatting for options using API
« Reply #1 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


“If you’re in the luckiest one per cent of humanity, you owe it to the rest of humanity to think about the other 99 per cent.”
― Warren Buffett

Offline pyroxide

  • Newbie
  • *
  • Posts: 8
  • Karma: +4/-0
    • View Profile
Re: formatting for options using API
« Reply #2 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
« Last Edit: June 04, 2015, 08:21:59 PM by pyroxide »

 

Powered by SMFPacks Social Login Mod