request->method('post')) { $order->name2 = $simpla->request->post('name2'); $order->name = $simpla->request->post('name'); $order->phone = $simpla->request->post('phone'); $order->email = $simpla->request->post('email'); $order->comment = $simpla->request->post('comment'); // if(empty($order->name)) // $simpla->design->assign('error', 'empty_name'); // if(empty($order->name2)) // $simpla->design->assign('error', 'empty_name2'); if(empty($order->phone)) $simpla->design->assign('error', 'empty_phone'); //elseif(empty($order->email)) // $simpla->design->assign('error', 'empty_email'); else{ $order->ip = $_SERVER['REMOTE_ADDR']; $order_id = $simpla->orders->add_order($order); $simpla->orders->add_purchase(array('order_id'=>$order_id, 'variant_id'=>$simpla->request->post('variant', 'integer'), 'amount'=>1)); $simpla->notify->email_order_admin($order_id); $simpla->design->assign('result', 1); $simpla->design->assign('order_id', $order_id); } } $result = $simpla->design->fetch('ajax_order.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;