/** * getting campaign order total price * @param int $order_id * @param array & $campaign_orders * @return int $total_price */ function get_campaign_order_total_price($order_id, &$campaign_orders) { $campaign_totals = get_campaign_items_total($order_id); $prices = get_campaign_prices(); $j = 0; $total_price = 0; foreach ($campaign_orders as $type => &$campaign) { $count = count($campaign); for ($i = 0; $i < $count; $i++) { if ($type == 1) { $price = round($campaign_totals[$j]['s_type_1'] * get_price_by_square(390, 300, $prices[1]) + $campaign_totals[$j]['s_type_2'] * get_price_by_square(100, 100, $prices[1]) + $campaign_totals[$j]['s_type_3'] * get_price_by_square(300, 290, $prices[1]) + $campaign_totals[$j]['s_type_4'] * get_price_by_square(580, 450, $prices[1])); } else { $price = round(($campaign_totals[$j]['s_type_1'] + $campaign_totals[$j]['s_type_2'] + $campaign_totals[$j]['s_type_3'] + $campaign_totals[$j]['s_type_4']) * $prices[$type]); } $total_price += $price; $j++; } } return $total_price; }
if (!($order_id = $_SESSION['order_id']) || !isset($_SESSION['user'])) { header('location: /'); exit; } import('checkout'); import('store'); $materials = get_materials(); $campaign_orders = get_campaign_orders($order_id); $order_weeks = get_order_weeks($order_id); $banner_orders = get_additional_orders_by_type($order_id, 1); $poster_orders = get_additional_orders_by_type($order_id, 2); $rollup_orders = get_additional_orders_by_type($order_id, 3); $campaign_stores = get_campaign_stores($order_id); $campaign_totals = get_campaign_items_total($order_id); $campaign_orders_list = get_campaign_orders_list($order_id); $prices = get_campaign_prices(); $add_prices = get_additional_prices(); $template_name = ''; if ($campaign_orders && !$banner_orders && !$poster_orders && !$rollup_orders) { $template_name = 'campaign_checkout'; } elseif (!$campaign_orders && $banner_orders && !$poster_orders && !$rollup_orders) { $template_name = 'banners_checkout'; } elseif (!$campaign_orders && !$banner_orders && $poster_orders && !$rollup_orders) { $template_name = 'posters_checkout'; } elseif (!$campaign_orders && !$banner_orders && !$poster_orders && $rollup_orders) { $template_name = 'rollups_checkout'; } elseif ($campaign_orders || $banner_orders || $poster_orders || $rollup_orders) { $template_name = 'full_checkout'; } if (!$template_name) { header('location: /');