Hi there,
I tried order form with postresql and i take this error
Hi @esattav,
I think you'll find a solution to your problem in this post:
Hi Miguel,
Thanks for your kind answer but i tried that solution. However thats not the perfect fit for me. This is works but not secure. So tried write a JS query like this. Maybe will help for another ones problem.
console.log("Creating Customer...");
let customerResult = await createCustomer.trigger({
onError: function (err) {
console.log("Error:", err);
throw new Error("Customer could not be created!");
}
});
let customerId = customerResult.id[0];
console.log("Creating Order...");
let orderResult = await createOrder.trigger({
additionalScope: { "customer_id": customerId, "order_date": text1.value, "total_price": 10.00, "status": "Pending" },
onError: function (err) {
console.log("Error:", err);
throw new Error("Order could not be created!");
}
});
let orderID = orderResult.id[0];
console.log("Creating Order Items...");
for (let i = 0; i < listViewLegacy1.data.length; i++) {
console.log(listViewLegacy1.data[i].select3)
let item = {
"order_id": orderID,
"product_id": listViewLegacy1.data[i].select3,
"quantity": listViewLegacy1.data[i].numberInput1,
"currency": 0,
}
await createOrderDetails.trigger({
additionalScope: { "item": item },
onError: function (err) {
console.log("Error:", err);
throw new Error("Order Item could not be created!");
}
});
}