-
-
-
-
- 0) {
- echo '
';
- } else {
- echo '
';
- }
- } elseif ($product['product_type'] === "variable") {
- $lowest_regular_price = null;
- $highest_regular_price = null;
- $lowest_sale_price = null;
- $highest_sale_price = null;
+
+
+
+
+
+
+ 0) {
+ echo '
';
+ echo '' . $product['regular_price'] . '';
+ echo '' . $product['sale_price'] . '';
+ echo '';
+ } else {
+ echo '
' . $product['regular_price'] . '';
+ }
+ } elseif ($product['product_type'] === "variable") {
+ $lowest_regular_price = null;
+ $highest_regular_price = null;
+ $lowest_sale_price = null;
+ $highest_sale_price = null;
- if (isset($variation_details) && is_array($variation_details)) {
- foreach ($variation_details as $index => $variation) {
- $regular_price = isset($variation['regular_price']) ? $variation['regular_price'] : 0;
- $sale_price = isset($variation['sale_price']) ? $variation['sale_price'] : 0;
+ if (isset($variation_details) && is_array($variation_details)) {
+ foreach ($variation_details as $index => $variation) {
+ $regular_price = isset($variation['regular_price']) ? $variation['regular_price'] : 0;
+ $sale_price = isset($variation['sale_price']) ? $variation['sale_price'] : 0;
- // Update the minimum and maximum prices only if they are not null
- if ($lowest_regular_price === null || $regular_price < $lowest_regular_price) {
- $lowest_regular_price = $regular_price;
- }
+ // Update the minimum and maximum prices only if they are not null
+ if ($lowest_regular_price === null || $regular_price < $lowest_regular_price) {
+ $lowest_regular_price = $regular_price;
+ }
- if ($highest_regular_price === null || $regular_price > $highest_regular_price) {
- $highest_regular_price = $regular_price;
- }
+ if ($highest_regular_price === null || $regular_price > $highest_regular_price) {
+ $highest_regular_price = $regular_price;
+ }
- if ($lowest_sale_price === null || $sale_price < $lowest_sale_price) {
- $lowest_sale_price = $sale_price;
- }
+ if ($lowest_sale_price === null || $sale_price < $lowest_sale_price) {
+ $lowest_sale_price = $sale_price;
+ }
- if ($highest_sale_price === null || $sale_price > $highest_sale_price) {
- $highest_sale_price = $sale_price;
+ if ($highest_sale_price === null || $sale_price > $highest_sale_price) {
+ $highest_sale_price = $sale_price;
+ }
}
}
- }
- // Display the range of prices based on the presence of sale prices
- if ($lowest_sale_price !== null && $highest_sale_price !== null && $lowest_sale_price > 0 && $highest_sale_price > 0) {
- echo '
' . '₱' . $lowest_sale_price . ' - ₱' . $highest_sale_price . '';
- } elseif ($lowest_regular_price !== null && $highest_regular_price !== null) {
- echo '
' . '₱' . $lowest_regular_price . ' - ₱' . $highest_regular_price . '';
+ // Display the range of prices based on the presence of sale prices
+ if ($lowest_sale_price !== null && $highest_sale_price !== null && $lowest_sale_price > 0 && $highest_sale_price > 0) {
+ echo '
' . '₱' . $lowest_sale_price . ' - ₱' . $highest_sale_price . '';
+ } elseif ($lowest_regular_price !== null && $highest_regular_price !== null) {
+ echo '
' . '₱' . $lowest_regular_price . ' - ₱' . $highest_regular_price . '';
+ }
}
- }
- ?>
+ ?>
+