add preorder
This commit is contained in:
@@ -41,6 +41,14 @@ function checkout_kuri($priceslug, $delivery_id = 1){
|
||||
echo 'товар не найден';
|
||||
return false;
|
||||
}
|
||||
|
||||
$preorder = 0;
|
||||
$current_date = date('Y-m-d H:i:s');
|
||||
$datestart = $price_id['BeginDate'];
|
||||
|
||||
if (strtotime($datestart) > strtotime($current_date)) {
|
||||
$preorder = 1; // Если дата из MySQL больше текущей, устанавливаем предзаказ = 1
|
||||
}
|
||||
|
||||
# отправляем цену на форму в js
|
||||
if ($delivery_id == 1){ // тип товара = 1 (только электронная)
|
||||
@@ -63,6 +71,7 @@ function checkout_kuri($priceslug, $delivery_id = 1){
|
||||
}
|
||||
|
||||
|
||||
|
||||
# если пришла форма
|
||||
if (count($_POST) > 0){
|
||||
|
||||
@@ -159,10 +168,10 @@ function checkout_kuri($priceslug, $delivery_id = 1){
|
||||
|
||||
$price = $price * $count;
|
||||
|
||||
$delivery = db_get("SELECT * FROM `delivery` WHERE `delivery_id` = '$delivery_id' LIMIT 1");
|
||||
$curr_delivery = db_get("SELECT * FROM `delivery` WHERE `delivery_id` = '$delivery_id' LIMIT 1");
|
||||
|
||||
if (isset($delivery['delivery_id']) and $delivery['delivery_price'] !== '0.00' ) {
|
||||
$price = $price + $delivery['delivery_price'] ;
|
||||
if (isset($curr_delivery['delivery_id']) and $curr_delivery['delivery_price'] !== '0.00' ) {
|
||||
$price = $price + $curr_delivery['delivery_price'] ;
|
||||
}
|
||||
|
||||
|
||||
@@ -212,7 +221,7 @@ function checkout_kuri($priceslug, $delivery_id = 1){
|
||||
else { # заказ создался
|
||||
|
||||
|
||||
if ( $delivery_id == 1){
|
||||
if ( $delivery_id == 1 or $preorder == 1){
|
||||
//уводим на оплату онлайн в Юкассу
|
||||
return anpay_kuri($order_id);
|
||||
}
|
||||
@@ -270,6 +279,8 @@ function checkout_kuri($priceslug, $delivery_id = 1){
|
||||
$submit_link = SITE."checkout/$priceslug";
|
||||
|
||||
|
||||
|
||||
|
||||
$tempcontent = VIEWPATH.'checkout.phtml';
|
||||
include VIEWPATH.'layout_pay.phtml';
|
||||
|
||||
|
||||
@@ -10,16 +10,25 @@
|
||||
var count = document.getElementById('count').value;
|
||||
|
||||
<?foreach($delivery as $ditem):?>
|
||||
|
||||
<?$nn++;?>
|
||||
|
||||
<?if ( $price_id['fullprice'] and $ditem['delivery_id'] == 4 or $ditem['delivery_id'] == 5 ){
|
||||
continue;
|
||||
}?>
|
||||
|
||||
<? if($nn == 1): ?>
|
||||
if (document.getElementById('devilery_id<?=$ditem['delivery_id']?>').checked) {
|
||||
<?else:?>
|
||||
else if (document.getElementById('devilery_id<?=$ditem['delivery_id']?>').checked){
|
||||
<?endif?>
|
||||
itog = product_price * count;
|
||||
|
||||
itog = product_price * count;
|
||||
|
||||
<?if ($ditem['delivery_price'] !== '0.00'):?>
|
||||
itog = itog + <?=$ditem['delivery_price']?>;
|
||||
<?endif?>
|
||||
|
||||
}
|
||||
|
||||
<?endforeach?>
|
||||
@@ -45,18 +54,25 @@
|
||||
el_adress.placeholder='Адрес в свободной форме';
|
||||
|
||||
}
|
||||
else if(document.getElementById('devilery_id4').checked){
|
||||
document.getElementById("form_adress").style.display='block';
|
||||
document.getElementById("form_samo").style.display='none';
|
||||
el_adress.placeholder='Индекс (обязательно). Далее область, населенный пункт и Ваш адрес';
|
||||
}
|
||||
else if(document.getElementById('devilery_id5').checked){
|
||||
document.getElementById("form_adress").style.display='block';
|
||||
document.getElementById("form_samo").style.display='none';
|
||||
el_adress.placeholder='Индекс (обязательно). Далее область, населенный пункт и Ваш адрес';
|
||||
}
|
||||
|
||||
|
||||
<?if ( $price_id['fullprice'] ):?>
|
||||
else if(document.getElementById('devilery_id6').checked){
|
||||
document.getElementById("form_adress").style.display='block';
|
||||
document.getElementById("form_samo").style.display='none';
|
||||
el_adress.placeholder='Индекс (обязательно). Далее область, населенный пункт и Ваш адрес';
|
||||
}
|
||||
<?else:?>
|
||||
else if(document.getElementById('devilery_id4').checked){
|
||||
document.getElementById("form_adress").style.display='block';
|
||||
document.getElementById("form_samo").style.display='none';
|
||||
el_adress.placeholder='Индекс (обязательно). Далее область, населенный пункт и Ваш адрес';
|
||||
}
|
||||
else if(document.getElementById('devilery_id5').checked){
|
||||
document.getElementById("form_adress").style.display='block';
|
||||
document.getElementById("form_samo").style.display='none';
|
||||
el_adress.placeholder='Индекс (обязательно). Далее область, населенный пункт и Ваш адрес';
|
||||
}
|
||||
<?endif?>
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -100,12 +116,16 @@
|
||||
<p><input id="buy_tel" name="buy_tel" value="<?=post_value("buy_tel")?>" type="tel"></textarea></p>
|
||||
|
||||
<p style="font-weight: bold;font-size: 22px;"><label for="devilery_id">Доставка:</label></p>
|
||||
|
||||
|
||||
|
||||
<?foreach($delivery as $ditem):?>
|
||||
|
||||
<?$checked = ($ditem['delivery_id'] == $delivery_id) ? ' checked': '';?>
|
||||
|
||||
|
||||
<?if ( $price_id['fullprice'] and $ditem['delivery_id'] == 4 or $ditem['delivery_id'] == 5 ){
|
||||
continue;
|
||||
}?>
|
||||
|
||||
|
||||
<?if ($ditem['delivery_weight_max'] > 0):?>
|
||||
<?if ($price_id['weight'] > $ditem['delivery_weight'] and $price_id['weight'] < $ditem['delivery_weight_max']):?>
|
||||
<div>
|
||||
@@ -132,7 +152,9 @@
|
||||
<div id="form_samo" class="adress_box" style="display: <?= ($delivery_id == 2) ? 'block' : 'none' ?>;">
|
||||
<p>Москва, метро "Аэропорт", Авиационный переулок, д. 4А (здание МФЮА), к. 104</p>
|
||||
<p>Мы работаем пн.-пт. c 10:00 - 18:00</p>
|
||||
<p><strong><em>Резерв - 3 рабочих дня<em></strong></p>
|
||||
<?if ($preorder == 0):?>
|
||||
<p><strong><em>Резерв - 3 рабочих дня<em></strong></p>
|
||||
<?endif?>
|
||||
</div>
|
||||
|
||||
<div id="form_adress" class="adress_box" style="display: <?= ($delivery_id == 3 or $delivery_id == 4) ? 'block' : 'none' ?>;">
|
||||
@@ -150,14 +172,15 @@
|
||||
|
||||
<div id="form_pay">
|
||||
<p style="font-weight: bold;font-size: 22px;"><label for="buy_adress">Оплата:</label></p>
|
||||
|
||||
<?foreach($pay_ids as $pkey=>$pitem):?>
|
||||
<?$p++;
|
||||
$pchecked = ($pkey == $pay_id) ? ' checked': '';?>
|
||||
<? if ($pkey == 2):?>
|
||||
<p><input name="pay_id" type="radio" value="<?=$pkey?>" id="pay_id<?=$p?>" <?=$pchecked?>><?=$pitem?></p>
|
||||
<?endif?>
|
||||
<?endforeach?>
|
||||
<?if ($preorder == 0):?>
|
||||
<?foreach($pay_ids as $pkey=>$pitem):?>
|
||||
<?$p++;
|
||||
$pchecked = ($pkey == $pay_id) ? ' checked': '';?>
|
||||
<? if ($pkey == 2):?>
|
||||
<p><input name="pay_id" type="radio" value="<?=$pkey?>" id="pay_id<?=$p?>" <?=$pchecked?>><?=$pitem?></p>
|
||||
<?endif?>
|
||||
<?endforeach?>
|
||||
<?endif?>
|
||||
</div>
|
||||
|
||||
<div id="form_itog">
|
||||
|
||||
Reference in New Issue
Block a user