<?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);
public static function findByPath($path, $rootID = null) { $path = preg_split('|[/]+|', trim($path), -1, PREG_SPLIT_NO_EMPTY); $q = \cf\createQuery('SELECT id FROM cf_page WHERE (parent_id=:pid OR parent_id IS NULL AND :pid IS NULL) AND (id=:id OR permalink=:id)'); $res = array('page_id' => $rootID, 'found' => '', 'notfound' => ''); $pid = $rootID; $count = 0; foreach ($path as $part) { $pid = \cf\query2Var($q, array('pid' => $pid, 'id' => $part)); if ($pid) { $res['page_id'] = (int) $pid; $res['found'] .= '/' . $part; ++$count; } else { break; } } $res['notfound'] = implode('/', array_slice($path, $count)); return $res; }