I was hoping that I would be able to do it, but again I ran into something where I am powerless... Please help me with a solution. After the call I get a JSON Response. I decode the response and read individual fields from "data". But I came across the EAN and PLU fields where the field looks like "ean": ["2112244"] and the processing I'm using reads 0 = false or 1 = true from that.
And I don't know how to read it in order to write the EAN of the given product into the database.
Decode response
$data = json_decode($response, true);
foreach($data["data"] as $row){
$categoryid = $row["_categoryId"];
$productid = $row["id"];
$name = $row["name"];
$ean = $row["ean"];
$plu = $row["plu"];
$externalid = $row["externalId"];
$units = $row["unit"];
$unitsmeasurment = $row["unitMeasurement"];
$packaging = $row["packaging"];
$packagingmeasurment = $row["packagingMeasurement"];
}
Json response
"data": [
{
"_categoryId": "415874342455239",
"_cloudId": "349305323",
"_defaultCourseId": null,
"_eetSubjectId": null,
"_supplierId": null,
"allergens": [],
"alternativeName": null,
"created": "2023-01-25T12:39:57.19Z",
"currency": "CZK",
"deleted": false,
"deliveryNoteIds": null,
"description": null,
"discountPercent": "0",
"discountPermitted": true,
"display": true,
"ean": ["54544844544"],
"externalId": null,
"features": [],
"flags": "4096",
"hexColor": "#623320",
"id": "200915715273883",
"imageUrl": null,
"margin": null,
"marginMin": null,
"modifiedBy": "411782225143287",
"name": "Americano",
"notes": null,
"onSale": false,
"packageItem": "1",
"packaging": "1",
"packagingMeasurement": "1",
"packagingPriceWithVat": null,
"plu": [],
"points": "0",
"priceInPoints": null,
"priceWithVat": "59",
"priceWithVatB": null,
"priceWithVatC": null,
"priceWithVatD": null,
"priceWithVatE": null,
"priceWithoutVat": "51.30434782608696",
"purchasePriceWithoutVat": null,
"requiresPriceEntry": false,
"sortOrder": "0",
"stockDeduct": true,
"stockOverdraft": "ALLOW",
"subtitle": null,
"supplierProductCode": null,
"tags": null,
"unit": "Piece",
"unitMeasurement": "Piece",
"vat": "1.15",
"versionDate": "2023-01-25T12:39:57.19Z"
},