[WIP] Order process

This commit is contained in:
Ludovic CANDELLIER
2022-07-03 22:38:08 +02:00
parent bcb3e15f33
commit 06cfb92757
60 changed files with 1146 additions and 295 deletions

View File

@@ -13,15 +13,12 @@ class ShopCart
if (self::has($item['id'])) {
if ($update) {
self::remove($item['id']);
$ret = self::get()->add($item);
// $ret = self::get()->update($item['id'], ['quantity' => $item['quantity']]);
self::get()->add($item);
} else {
$ret = self::get()->update($item['id'], ['quantity' => $item['quantity']]);
// self::remove($item['id']);
// $ret = self::get()->add($item);
self::get()->update($item['id'], ['quantity' => $item['quantity']]);
}
} else {
$ret = self::get()->add($item);
self::get()->add($item);
}
return [
'count' => self::count(),
@@ -73,7 +70,12 @@ class ShopCart
public static function getTotal()
{
return number_format(round(self::get()->getTotal(),2),2);
return self::fixDecimal(self::get()->getTotal());
}
public static function fixDecimal($number)
{
return number_format(round($number, 2), 2);
}
public static function getItemQuantity($id)