martynnorman Posted May 17, 2013 Share Posted May 17, 2013 (edited) I am having difficulties creating orders with ConfigOptions. Does anyone know what actually needs to be passed in? I'm assuming the IDs of the options, but that doesn't seem to do anything, and the documentation is not very informative on this particular parameter.. It's creating the Product itself, but it's not adding the additional configurable options, so the products/invoices are wrong. Edited May 17, 2013 by martynnorman 0 Quote Link to comment Share on other sites More sharing options...
martynnorman Posted August 1, 2013 Author Share Posted August 1, 2013 If anyone is wondering how to do it in .net - here's basically how I did it.... This formats the .net name-value-pair arrays into the php formatting for base64 encoding. NameValueCollection httpParam = new NameValueCollection(); Dictionary<string, string> configOption = new Dictionary<string, string>(); configOption.Add(strAddonId, strAddonOptionId); byte[] bytes = Encoding.UTF8.GetBytes(phpStringArray(configOption)); string base64String = Convert.ToBase64String(bytes); httpParam.Add("configoptions", base64String); public static string phpStringArray(Dictionary<string, string> arr) { StringBuilder sb = new StringBuilder("a:") .Append(arr.Count).Append(":{"); foreach (string key in arr.Keys) { sb.AppendFormat("s:{0}:\"{1}\";s:{2}:\"{3}\";", key.Length, key, arr[key].Length, arr[key]); } return sb.Append('}').ToString(); } 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.