/home/techb158/immovalet.com/platform/plugins/ecommerce/helpers
NameSizeModeActions
brands.php14580644editdlrm
common.php45100644editdlrm
constants.php53610644editdlrm
currencies.php47970644editdlrm
customer.php17710644editdlrm
discounts.php44840644editdlrm
order.php14830644editdlrm
prices.php32360644editdlrm
product-attributes.php11230644editdlrm
product-categories.php16300644editdlrm
product-variations.php36870644editdlrm
products.php174080644editdlrm
shipping.php6660644editdlrm
Edit: /home/techb158/immovalet.com/platform/plugins/ecommerce/helpers/prices.php (3236B)
null, 'end_date' => null, 'price' => null, 'old_price' => null, ]; if ($saleType == 'default') { $saleType = $defaultSaleType; $startDate = $defaultStartDate; $endDate = $defaultEndDate; } if ($saleType == 'none' || !$salePrice) { $priceInfo['price'] = $price; return $priceInfo; } if ($saleType == 'always') { $priceInfo['price'] = $price < $salePrice ? $price : $salePrice; $priceInfo['old_price'] = $salePrice < $price ? $price : $salePrice; } elseif (is_product_on_sale($saleType, $startDate, $endDate)) { $priceInfo['price'] = $price < $salePrice ? $price : $salePrice; $priceInfo['old_price'] = $salePrice < $price ? $price : $salePrice; $priceInfo['start_date'] = $startDate; $priceInfo['end_date'] = $endDate; } else { $priceInfo['price'] = $price > $salePrice ? $price : $salePrice; } return $priceInfo; } } if (!function_exists('get_sale_percentage')) { /** * @param float $price * @param float $salePrice * @param bool $abs * @param bool $appendSymbol * @return string */ function get_sale_percentage($price, $salePrice, $abs = false, $appendSymbol = true) { $symbol = $appendSymbol ? '%' : ''; if (!$salePrice) { return 0 . $symbol; } $down = $price - $salePrice; $result = $price > 0 ? ceil(-($down / $price) * 100) : 0; if ($abs === true) { return abs($result) . $symbol; } return $result . $symbol; } } if (!function_exists('is_product_on_sale')) { /** * @param string $saleStatus * @param null $startDate * @param null $endDate * @return bool */ function is_product_on_sale($saleStatus, $startDate = null, $endDate = null) { if ($saleStatus == 'none' || !$endDate) { return false; } if ($saleStatus == 'always') { return true; } $now = now(); $startDate = Carbon::parse($startDate); $endDate = Carbon::parse($endDate); if ($now >= $endDate || $startDate > $now) { return false; } if (!$startDate) { return true; } return true; } }