Add response when displaying item prices. #780

This commit is contained in:
Korina Cordero 2024-01-11 16:48:23 +08:00
parent 7f4675a8a2
commit b592390554

View file

@ -79,7 +79,7 @@ class ItemPricingController extends Controller
foreach ($pt_items as $pt_item)
{
// make item price hash
$pt_prices[$pt_item->->getID()] = $pt_item->getPrice();
$pt_prices[$pt_item->getID()] = $pt_item->getPrice();
}
}
else
@ -98,6 +98,35 @@ class ItemPricingController extends Controller
}
$data_items = [];
foreach ($items as $item)
{
$item_id = $item->getID();
// get default price
if ($it->getCode() == 'battery')
$price = $item->getSellingPrice();
else
$price = $item->getFee();
// check if tier has price for item
if (isset($pt_prices[$item_id]))
{
$price = $pt_prices[$item_id];
// actual price
$actual_price = number_format($price / 100, 2, '.', '');
}
$actual_price = $price;
// TODO: recheck this
$data_items[] = [
'id' => $item_id,
'name' => '',
'item_type' => '',
'price' = $actual_price,
];
}
// response
return new JsonResponse([