This commit is contained in:
Alan
2026-02-14 19:34:54 +03:00
commit 5c3329238b
867 changed files with 214778 additions and 0 deletions

40
ajax/order.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
session_start();
chdir('..');
error_reporting(0);
require_once('api/Simpla.php');
$simpla = new Simpla();
if($simpla->request->method('post'))
{
$order->name = $simpla->request->post('name');
$order->phone = $simpla->request->post('phone');
$order->comment = $simpla->request->post('comment', 'string');
if(empty($order->name))
$simpla->design->assign('error', 'Введите имя');
elseif(empty($order->phone))
$simpla->design->assign('error', 'Введите телефон');
//elseif(empty($order->comment))
// $simpla->design->assign('error', 'Введите сообщение');
else{
$order->ip = $_SERVER['REMOTE_ADDR'];
$order_id = $simpla->orders->add_order($order);
//if(trim($item_product_name))
// $simpla->orders->add_purchase(array('order_id'=>$order_id, 'product_name'=>item_product_name));
$simpla->orders->add_purchase(array('order_id'=>$order_id, 'variant_id'=>$simpla->request->post('variant', 'integer'), 'amount'=>$simpla->request->post('amount', 'integer')));
$simpla->notify->email_order_admin($order_id);
$simpla->design->assign('result', 1);
$simpla->design->assign('order_id', $order_id);
}
}
$result = $simpla->design->fetch('order_result.tpl');
//header("Content-type: application/json; charset=UTF-8");
header("Content-type: text/html; charset=UTF-8");
header("Cache-Control: must-revalidate");
header("Pragma: no-cache");
header("Expires: -1");
//print_r( $_POST );
//print json_encode($result);
print $result;