In my app I've to create a structure like this:
$arrProducts = array(
array(
“product_id” => “1”,
“qty” => 2
"options" => array(
optionId_1 => optionValue_1,
...,
optionId_n => optionValue_n
)
I did this array of array so:
NSDictionary *dict = @{
@"product_id" : productID,
@"qty": self.qty
};
NSArray *array2 = @[dict];
This array should work with a Magento store, when I run the app it shows me this message:
error cart_product.add: SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)
I guess this problem, depends on how I create this array, but I'm not understanding what's wrong with this array, can you help me to fix it?
UPDATE:
The library I'm using to connect to Magento needs this structure:
[Magento call:@[@"customer.create", @{
@"email": email,
@"password": password,
@"firstname": firstname,
@"lastname": lastname,
@"website_id": @1,
@"store_id": Magento.service.storeID
}] success:^(AFHTTPRequestOperation *operation, id responseObject) {
Magento.service.customerID = responseObject;
NSLog(@"signUp customerID = %@", Magento.service.customerID);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"error %@", error.localizedDescription);
}];
I will use it to add a product into a cart if you take a look in Magento SOAP API to add a product to cart you can see that in phpthey add product by using an array of an array. I need to replicate the same structure.