v2.5.2
Giriş yap

php fiyatlandırma hk

wwx
324 defa görüntülendi

Merhabalar tarihsel fiyatlandırma sistemim var tarihsel fiyatlandırma da 1 veri olunca sistem sorunsuz çalışmakta
ama 2-3-4 tane tarihsel fiyatlandırma olunca sistem karışmakta enson veriyi almakta

$tarih1= new DateTime($parts[0]);
    $tarih2= new DateTime($parts[1]);
    $interval= $tarih1->diff($tarih2);
    $cikan = $interval->format('%a');

Tarihsel fiyatlandırma da tarih arasındaki günleri bu şekilde buluyorum

2022-05-21 - 2022-05-22 İlk tarih veriyi düzgün hesaplıyor
2022-05-23 - 2022-05-26 İkinci tarih veriyi sapıtıyor

if ($alt['tarihsel'] != '""') {
$formatS = json_decode($alt['tarihsel']);
$selDateOne = strtotime(str_replace('/', '-', $_SESSION['alistarih']));
$selDateTwo = strtotime(str_replace('/', '-', $_SESSION['iadetarih']));
foreach ($formatS as $formats) {
	$parts = explode('|', $formats);
	$dateOne = strtotime($parts[0]);
	$dateTwo = strtotime($parts[1]);
	if ($dateOne <= $selDateOne && $dateOne <= $selDateTwo || $dateTwo <= $selDateOne && $dateTwo <= $selDateTwo) {
		$parts[2];
		$parts[3];
		$parts[4];
		$parts[5];
		$parts[6];
	}
}
	$tarih1= new DateTime($parts[0]);
	$tarih2= new DateTime($parts[1]);
	$interval= $tarih1->diff($tarih2);
    $cikan = $interval->format('%a');

     $gun = $_GET['gun'];
	 $tarihsel = $cikan;
if ($_SESSION['yetiskin'] == 1) {
	echo $gun > $tarihsel ? ($tarihsel * $parts[2]) + (($gun - $tarihsel) * $alt['priceOne']) : $gun * $parts[2] + $cocukfiyat;
} else if ($_SESSION['yetiskin'] == 2) {
	echo $gun > $tarihsel ? ($tarihsel * $parts[3]) + (($gun - $tarihsel) * $alt['priceTwo']) : $gun * $parts[3] + $cocukfiyat;
} else if ($_SESSION['yetiskin'] == 3) {
	echo $gun > $tarihsel ? ($tarihsel * $parts[4]) + (($gun - $tarihsel) * $alt['priceThree']) : $gun * $parts[4] + $cocukfiyat;
} else if ($_SESSION['yetiskin'] == 4) {
	echo $gun > $tarihsel ? ($tarihsel * $parts[5]) + (($gun - $tarihsel) * $alt['priceFour']) : $gun * $parts[5] + $cocukfiyat;
} else if ($_SESSION['yetiskin'] == 5) {
	echo $gun > $tarihsel ? ($tarihsel * $parts[6]) + (($gun - $tarihsel) * $alt['priceFive']) : $gun * $parts[6] + $cocukfiyat;
}
}
munzevi
722 gün önce

kardeş bu sefer yardımcı olamayacağım. en azından yanıt vereyim de ayıp olmasın diye düşündüm.