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';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user