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