diff --git a/services/nginx/app/objects/products_o.php b/services/nginx/app/objects/products_o.php index fe4779be..6dc691d0 100644 --- a/services/nginx/app/objects/products_o.php +++ b/services/nginx/app/objects/products_o.php @@ -270,7 +270,7 @@ class products_o extends db $discount_percentage = $customer->getProductDiscountPercentage($product['id']); // Apply the discount to the product price if ($discount_percentage > 0) { - $product['price'] = round($product['price'] * (1 - ($discount_percentage / 100))); + $product['price'] = (int)(round($product['price'] * (1 - ($discount_percentage / 100)))); } return $product; } diff --git a/services/nginx/app/routes/productsRoute.php b/services/nginx/app/routes/productsRoute.php index 47eadc0e..d7329416 100644 --- a/services/nginx/app/routes/productsRoute.php +++ b/services/nginx/app/routes/productsRoute.php @@ -118,7 +118,7 @@ class productsRoute // Update the option with the new product $options[$key]['product'] = $product; // Set the price of the option to the price of the product - $options[$key]['price'] = $product['price']; + $options[$key]['price'] = (int)$product['price']; } return $options; } @@ -187,7 +187,7 @@ class productsRoute // Get all products $products = (array)(new products_o())->listObjectsWithPaginationIfSet( function ($product) { - return $product; + return parseProduct($product); } ); } @@ -200,7 +200,7 @@ class productsRoute $result = array_map(function ($product) use ($customer, $departmentId) { $productArray = parseProduct($product); // Get the price of the product with the department pricing and customer discounts applied - $productArray = self::parseProductsPrice([$productArray], $customer, $departmentId)[0]; + $productArray = parseProduct(self::parseProductsPrice([$productArray], $customer, $departmentId)[0]); // Get the options for the product $productArray['addons'] = self::parseOptionsPrice($productArray['addons'], $customer, $departmentId); // Return the product with the updated price