/** * insert $campaigns orders data to database * @param array $campaigns * @param int $order_id */ function insert_campaign_data(&$campaigns, $order_id, $type) { foreach ($campaigns as $key => $campaign) { $campaign_id = insert_to_db('campaign_orders', array('order_id' => $order_id, 'type' => $type)); $insert_data = array(); foreach ($campaign as $store_id => $data) { $insert_data[] = array('parent_id' => $campaign_id, 'store_id' => abs((int) $store_id), 'type_1' => isset($data['0']) ? $data['0'] : 0, 'type_2' => isset($data['1']) ? $data['1'] : 0, 'type_3' => isset($data['2']) ? $data['2'] : 0, 'type_4' => isset($data['3']) ? $data['3'] : 0, 'material_id' => isset($data['4']) ? $data['4'] : 0, 'ophaeng_id' => isset($data['5']) ? $data['5'] : 0); } insert_multi_to_db('campaign_orders_items', $insert_data); } }
} $valid_count = 8; } elseif ($type_key == 2) { if ($var = abs((int) $_POST['material'][$i])) { $insert['material_id'] = $var; } $valid_count = 7; } else { $valid_count = 6; } if (count($insert) == $valid_count) { $insert_array[] = $insert; } } //inserting order details to db insert_multi_to_db('additional_orders_items', $insert_array); $week_number = isset($_POST['week_number']) ? esc(htmlspecialchars(strip_tags(trim($_POST['week_number'])))) : 1; if (empty($weeks)) { insert_to_db('orders_weeks', array('order_id' => $order_id, 'week_number' => $week_number, 'type' => $type_key)); } else { update_in_db('orders_weeks', array('week_number' => $week_number), 'id = ' . $weeks['id']); } $_SESSION['order_id'] = $order_id; header('location: /test/checkout'); exit; } import('store'); import('checkout'); $template_name = 'additional_' . $type; // if user clicked last button getting last order details and showing last order template if ('last' == get_url_param(3)) {
} $store = db_query_to_row("SELECT * FROM `stores` WHERE id = {$id}"); if (!$store) { die('store not found'); } import('store'); if (isset($_POST['shop_name'])) { $update = array(); if (!store_validate($update)) { $error_msg = 'All fields must be filled'; } else { $hanging_methods = $update['hanging_methods']; unset($update['hanging_methods']); if (update_in_db('stores', $update, '`id`=' . $id)) { delete_from_db('stores_hanging_methods', '`store_id`=' . $id); $store_hanging_methods = array(); foreach ($hanging_methods as $value) { $store_hanging_methods[] = array('store_id' => $id, 'hanging_method_id' => $value); } insert_multi_to_db('stores_hanging_methods', $store_hanging_methods); $_SESSION['edit_store_msg'] = 'Store Successfully Updated'; header('location: /store/edit/' . $id); die; } } } $hanging_methods = get_hanging_methods(); $store_hanging_methods = db_query_to_list('SELECT `hanging_method_id` FROM `stores_hanging_methods` WHERE `store_id`=' . $id, 'hanging_method_id'); $template = set_template('store', 'edit'); $link = THEME . 'template2.php'; require_once $link;