diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-05-25 20:35:22 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-05-25 20:35:22 +0800 |
commit | e6012dd5421097ac573caed332d0703078ad6edf (patch) | |
tree | 078ce1af9d5cb26798b6fa8d55ec3ba4eed01acf | |
parent | 98de18c4a1881cdd38e00eb4e07664a9c9c6a1f6 (diff) |
Add mv_item_option
-rw-r--r-- | ord.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -25,7 +25,7 @@ void interchange_ord_order(const char *sku, const char *item, } for (size_t i = 0; i < nopts; i++) --options; - size_t total_nopts = 4 + (nopts ? 1 : 0) + nopts; + size_t total_nopts = 4 + (nopts ? 1 : 0) + nopts * 2; const char *order[total_nopts + 1][2]; order[0][0] = "mv_action"; order[0][1] = "refresh"; @@ -42,10 +42,14 @@ void interchange_ord_order(const char *sku, const char *item, } for (size_t i = 0; i < nopts; i++) { const char **pair = options[i]; - order[5 + i][0] = malloc(strlen(prefix) + strlen(pair[0]) + 1); - sprintf((char *)order[5 + i][0], "%s%s", prefix, pair[0]); - order[5 + i][1] = malloc(strlen(pair[1]) + 1); - strcpy((char *)order[5 + i][1], pair[1]); + size_t j = i * 2; + order[5 + j][0] = malloc(strlen(prefix) + strlen(pair[0]) + 1); + sprintf((char *)order[5 + j][0], "%s%s", prefix, pair[0]); + order[5 + j][1] = malloc(strlen(pair[1]) + 1); + strcpy((char *)order[5 + j][1], pair[1]); + order[6 + j][0] = "mv_item_option"; + order[6 + j][1] = malloc(strlen(pair[0]) + 1); + strcpy((char *)order[6 + j][1], pair[0]); } order[total_nopts][0] = NULL; request(parser, NULL, order, "%s", "ord/basket"); |