���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /proc/self/root/var/www/html/tien-dien/include/functions/ |
<?php // Function to check if a product has an active discount function hasActiveDiscount($product) { if (!isset($product['discount_amount']) || $product['discount_amount'] <= 0) { return false; } $now = time(); $start_date = isset($product['discount_start_date']) && !empty($product['discount_start_date']) ? strtotime($product['discount_start_date']) : 0; $end_date = isset($product['discount_end_date']) && !empty($product['discount_end_date']) ? strtotime($product['discount_end_date']) : PHP_INT_MAX; return ($start_date <= $now && $now <= $end_date); } // Function to calculate the discounted price function getDiscountedPrice($product) { if (hasActiveDiscount($product)) { return max(0, $product['price'] - $product['discount_amount']); } return $product['price']; } ?>