Пример #1
0
    $comment = trim($_POST['comment']);
    $delivery = 'Курьером';
    switch ($_POST['delivery']) {
        case 'pickup':
            $delivery = 'Самовывоз';
            break;
        case 'post':
            $delivery = 'Почта России';
            break;
        case 'ems':
            $delivery = 'EMS Russian Post';
            break;
    }
    $payment = 'Наличными курьеру';
    switch ($_POST['payment']) {
        case 'bank':
            $payment = 'Квитанция через банк';
            break;
        case 'cod':
            $payment = 'Наложенным платежом';
            break;
    }
    $comment = "<b>Доставка:</b> {$delivery} \n<br><b>Оплата</b>: {$payment} \n\n<br><br>" . $comment;
    $orderId = cf\Cart::order($name, $email, $phone, $address, $comment);
    header("Location: /buy?order={$orderId}");
}
$smarty->assign('orderId', isset($_REQUEST['order']) ? $_REQUEST['order'] : false);
if (isset($_REQUEST['order'])) {
    $page['name'] = 'Покупка совершена';
}
show('buy', $page['name'], array(), $page['title'], $page['keywords'], $page['descr']);
Пример #2
0
<?php

require_once cf\Config::path . 'api/form.php';
require_once cf\Config::path . 'cart.php';
$orderform = cf\api\form\get('order');
$clientInfo = cf\api\form\results($orderform);
if ($clientInfo) {
    $products = \cf\api\cart\getList();
    $sum = $products['total'];
    $orderId = cf\Cart::order($clientInfo['name'], $clientInfo['email'], $clientInfo['phone'], $clientInfo['address'], $clientInfo['comments']);
    echo json_encode(array('id' => $orderId, 'text' => cf\query2Var("SELECT comments FROM cf_orders WHERE id=:id", array('id' => $orderId)), 'sum' => $sum['sum']));
    exit;
}
$smarty->assign('orderform', $orderform);