Hi,
Please use the code tags in your messages, otherwise, it's much harder to read...
In your first piece of code, you've added the code:
$sortingArray[] = array("name"=>"$productCategory->category_name","id"=>"$productCategory->category_id.", "productInCategory"=> $productCategory->product_id);
where I said that you should load the product category name. I don't know what this code is about but it's not what I said you should do.
First, the $productCategory variable doesn't exist yet.
Second, you already had the code:
$con = mysqli_connect('localhost', 'janjongerius_mvdmbp', '3F0S3e^tq2Ql', 'janjongerius_JO45BP', 3306);
$query_product = mysqli_query($con,"SELECT * FROM pa8ju_hikashop_product_category WHERE product_id = ".$item->product_id." LIMIT 1");
while($run_query_product = mysqli_fetch_array($query_product)){
$product_Category = $run_query_product['category_id'];
}
$query_category = mysqli_query($con,"SELECT * FROM pa8ju_hikashop_category WHERE category_id = ".$product_Category." LIMIT 1");
while($run_query_category = mysqli_fetch_array($query_category)){
$product_Category_name = $run_query_category['category_name'];
}
So if you replace my comment by that code, you should have then the products properly sorted $data->cart->products and you can just leave the standard way of displaying the products after that, as I wrote my my previous message.
So I don't understand what you're trying to do in the second piece of code.
Finally, please understand that this is a user support forum. I'm already going way beyond what I'm supposed to do here to help you.