public function index($module = array()) { if (!file_exists(EXTPATH . 'slideshow/views/slideshow.php')) { //check if file exists in views folder show_404(); // Whoops, show 404 error page! } $result = (!empty($module['data']) and is_array($module['data'])) ? $module['data'] : array(); $this->template->setStyleTag(extension_url('slideshow/views/assets/flexslider/flexslider.css'), 'flexslider-css', '155000'); $this->template->setStyleTag(extension_url('slideshow/views/css/stylesheet.css'), 'slideshow-css', '155600'); $this->template->setScriptTag(extension_url('slideshow/views/assets/flexslider/jquery.flexslider.js'), 'flexslider-js', '155000'); $data['dimension_h'] = isset($result['dimension_h']) ? $result['dimension_h'] : '360'; $data['dimension_w'] = isset($result['dimension_w']) ? $result['dimension_w'] : '960'; $data['effect'] = isset($result['effect']) ? $result['effect'] : 'ease'; $data['speed'] = isset($result['speed']) ? $result['speed'] : '500'; $data['display_slides'] = isset($result['display']) ? $result['display'] : '1'; $this->load->model('Image_tool_model'); $data['slides'] = array(); if (!empty($result['slides'])) { foreach ($result['slides'] as $slide) { $image_src = isset($slide['image_src']) ? $slide['image_src'] : 'data/no_photo.png'; $caption = isset($slide['caption']) ? $slide['caption'] : ''; $data['slides'][] = array('image_src' => $this->Image_tool_model->resize($image_src, $data['dimension_w'], $data['dimension_h']), 'caption' => $caption); } } // pass array $data and load view files return $this->load->view('slideshow/slideshow', $data, TRUE); }
public function index() { $this->lang->load('cart'); $this->load->module('cart_module'); $data['cart'] = $this->cart_module->getCart(array(), array(), TRUE); $this->template->setTitle($this->lang->line('text_heading')); $this->template->setStyleTag(extension_url('cart_module/views/stylesheet.css'), 'cart-module-css', '144000'); $this->template->render('cart', $data); }
public function index() { if (!file_exists(EXTPATH . 'stripe/views/stripe.php')) { //check if file exists in views folder show_404(); // Whoops, show 404 error page! } $this->load->model('Stripe_model'); $this->lang->load('stripe/stripe'); $payment = $this->extension->getPayment('stripe'); $this->template->setScriptTag('https://js.stripe.com/v2/', 'stripe-js', '200000'); $this->template->setScriptTag(extension_url('stripe/views/assets/jquery-stripe-payment.js'), 'stripe-payment-js', '200001'); $this->template->setScriptTag(extension_url('stripe/views/assets/process-stripe.js'), 'process-stripe-js', '200002'); // START of retrieving lines from language file to pass to view. $data['code'] = $payment['name']; $data['title'] = !empty($payment['ext_data']['title']) ? $payment['ext_data']['title'] : $payment['title']; $data['description'] = !empty($payment['ext_data']['description']) ? $payment['ext_data']['description'] : $this->lang->line('text_description'); $data['force_ssl'] = isset($payment['ext_data']['force_ssl']) ? $payment['ext_data']['force_ssl'] : '1'; // END of retrieving lines from language file to send to view. $order_data = $this->session->userdata('order_data'); // retrieve order details from session userdata $data['payment'] = !empty($order_data['payment']) ? $order_data['payment'] : ''; $data['minimum_order_total'] = is_numeric($payment['ext_data']['order_total']) ? $payment['ext_data']['order_total'] : 0; $data['order_total'] = $this->cart->total(); if ($this->input->post('stripe_token')) { $data['stripe_token'] = $this->input->post('stripe_token'); } else { $data['stripe_token'] = ''; } if (isset($this->input->post['stripe_cc_number'])) { $padsize = strlen($this->input->post['stripe_cc_number']) < 7 ? 0 : strlen($this->input->post['stripe_cc_number']) - 7; $data['stripe_cc_number'] = substr($this->input->post['stripe_cc_number'], 0, 4) . str_repeat('X', $padsize) . substr($this->input->post['stripe_cc_number'], -3); } else { $data['stripe_cc_number'] = ''; } if (isset($this->input->post['stripe_cc_exp_month'])) { $data['stripe_cc_exp_month'] = $this->input->post('stripe_cc_exp_month'); } else { $data['stripe_cc_exp_month'] = ''; } if (isset($this->input->post['stripe_cc_exp_year'])) { $data['stripe_cc_exp_year'] = $this->input->post('stripe_cc_exp_year'); } else { $data['stripe_cc_exp_year'] = ''; } if (isset($this->input->post['stripe_cc_cvc'])) { $data['stripe_cc_cvc'] = $this->input->post('stripe_cc_cvc'); } else { $data['stripe_cc_cvc'] = ''; } // pass array $data and load view files return $this->load->view('stripe/stripe', $data, TRUE); }
public function index() { if (!file_exists(EXTPATH . 'newsletter/views/newsletter.php')) { //check if file exists in views folder show_404(); // Whoops, show 404 error page! } $this->template->setStyleTag(extension_url('newsletter/views/stylesheet.css'), 'newsletter-css', '20150828'); $data['newsletter_alert'] = $this->alert->display('newsletter_alert'); $data['subscribe_url'] = site_url('newsletter/newsletter/subscribe'); // pass array $data and load view files return $this->load->view('newsletter/newsletter', $data, TRUE); }
public function index() { $this->load->model('Menus_model'); // load the menus model $this->load->model('Categories_model'); // load the menus model $this->lang->load('categories_module/categories_module'); if (!file_exists(EXTPATH . 'categories_module/views/categories_module.php')) { //check if file exists in views folder show_404(); // Whoops, show 404 error page! } if (is_numeric($this->input->get('category_id'))) { $data['category_id'] = $this->input->get('category_id'); } else { $data['category_id'] = 0; } $this->template->setStyleTag(extension_url('categories_module/views/stylesheet.css'), 'categories-module-css', '155000'); $data['menu_total'] = $this->Menus_model->getCount(); $data['categories'] = array(); $results = $this->Categories_model->getCategories(0); // retrieve all menu categories from getCategories method in Menus model foreach (sort_array($results) as $result) { // loop through menu categories array $children_data = array(); if (!empty($result['child_id'])) { $sibling_data = array(); if (!empty($result['sibling_id'])) { $sibling = $this->Categories_model->getCategories($result['child_id']); // retrieve all menu categories from getCategories method in Menus model foreach ($sibling as $sib) { $sibling_data[$sib['category_id']] = array('category_id' => $sib['category_id'], 'category_name' => $sib['name'], 'href' => site_url('menus?category_id=' . $sib['category_id'])); } } $children = $this->Categories_model->getCategories($result['category_id']); // retrieve all menu categories from getCategories method in Menus model foreach ($children as $child) { $children_data[$child['category_id']] = array('category_id' => $child['category_id'], 'category_name' => $child['name'], 'href' => site_url('menus?category_id=' . $child['category_id']), 'children' => $sibling_data); } } $data['categories'][$result['category_id']] = array('category_id' => $result['category_id'], 'category_name' => $result['name'], 'href' => site_url('menus?category_id=' . $result['category_id']), 'children' => $children_data); } $mix_it_up = (!empty($menu_total) and $menu_total > 500) ? FALSE : TRUE; $data['category_tree'] = $this->categoryTree($data['categories'], $mix_it_up); $fixed_top_offset = isset($ext_data['fixed_top_offset']) ? $ext_data['fixed_top_offset'] : '350'; $fixed_bottom_offset = isset($ext_data['fixed_bottom_offset']) ? $ext_data['fixed_bottom_offset'] : '320'; $data['fixed_categories'] = 'data-spy="affix" data-offset-top="' . $fixed_top_offset . '" data-offset-bottom="' . $fixed_bottom_offset . '"'; // pass array $data and load view files return $this->load->view('categories_module/categories_module', $data, TRUE); }
public function index($ext_data = array()) { if (!file_exists(EXTPATH . 'featured_menus/views/featured_menus.php')) { //check if file exists in views folder show_404(); // Whoops, show 404 error page! } if (!empty($ext_data['featured_menu'])) { $filter = array('menu_ids' => $ext_data['featured_menu'], 'page' => '1', 'limit' => '3', 'dimension_w' => isset($ext_data['dimension_w']) ? $ext_data['dimension_w'] : '400', 'dimension_h' => isset($ext_data['dimension_h']) ? $ext_data['dimension_h'] : '300'); } else { $filter = array(); } $this->template->setStyleTag(extension_url('featured_menus/views/featured_menus.css'), 'featured_menus-css', '20150918'); $data['featured_menus_alert'] = $this->alert->display('featured_menus_alert'); $data['featured_menus'] = $this->Featured_menus_model->getByIds($filter); // pass array $data and load view files return $this->load->view('featured_menus/featured_menus', $data, TRUE); }
public function index() { $this->load->model('Menus_model'); // load the menus model $this->load->model('Categories_model'); // load the menus model $this->lang->load('categories_module/categories_module'); if (!file_exists(EXTPATH . 'categories_module/views/categories_module.php')) { //check if file exists in views folder show_404(); // Whoops, show 404 error page! } if (is_numeric($this->input->get('category_id'))) { $data['category_id'] = $this->input->get('category_id'); } else { $data['category_id'] = 0; } $this->template->setStyleTag(extension_url('categories_module/views/stylesheet.css'), 'categories-module-css', '155000'); $data['menu_total'] = $this->Menus_model->getCount(); $data['categories'] = array(); $results = $this->Categories_model->getCategories(); // retrieve all menu categories from getCategories method in Menus model foreach (sort_array($results) as $result) { // loop through menu categories array $children_data = array(); if ($result['child_id'] !== NULL) { $children = $this->Categories_model->getCategories($result['category_id']); // retrieve all menu categories from getCategories method in Menus model foreach ($children as $child) { $children_data[$child['category_id']] = array('category_id' => $child['category_id'], 'category_name' => $child['name'], 'href' => site_url('menus?category_id=' . $child['category_id'])); } } $data['categories'][$result['category_id']] = array('category_id' => $result['category_id'], 'category_name' => $result['name'], 'children' => $children_data, 'href' => site_url('menus?category_id=' . $result['category_id'])); } // pass array $data and load view files return $this->load->view('categories_module/categories_module', $data, TRUE); }
public function index($module = array()) { $this->load->model('Featured_menus_model'); // load the featured menus model $this->lang->load('featured_menus/featured_menus'); if (!file_exists(EXTPATH . 'featured_menus/views/featured_menus.php')) { //check if file exists in views folder show_404(); // Whoops, show 404 error page! } $ext_data = (!empty($module['data']) and is_array($module['data'])) ? $module['data'] : array(); if (!empty($ext_data['featured_menu'])) { $filter = array('menu_ids' => $ext_data['featured_menu'], 'page' => '1', 'limit' => isset($ext_data['limit']) ? $ext_data['limit'] : '3', 'dimension_w' => isset($ext_data['dimension_w']) ? $ext_data['dimension_w'] : '400', 'dimension_h' => isset($ext_data['dimension_h']) ? $ext_data['dimension_h'] : '300'); } else { $filter = array(); } $data['featured_menu_title'] = isset($ext_data['title']) ? $ext_data['title'] : $this->lang->line('text_featured_menus'); $data['items_per_row'] = isset($ext_data['items_per_row']) ? $ext_data['items_per_row'] : '3'; $this->template->setStyleTag(extension_url('featured_menus/views/featured_menus.css'), 'featured_menus-css', '20150918'); $data['featured_menus_alert'] = $this->alert->display('featured_menus_alert'); $data['featured_menus'] = $this->Featured_menus_model->getByIds($filter); // pass array $data and load view files return $this->load->view('featured_menus/featured_menus', $data, TRUE); }
public function index($ext_data = array()) { if (!file_exists(EXTPATH . 'local_module/views/local_module.php')) { //check if file exists in views folder show_404(); // Whoops, show 404 error page! } if (empty($ext_data['status']) or $ext_data['status'] !== '1') { return; } $this->template->setStyleTag(extension_url('local_module/views/stylesheet.css'), 'local-module-css', '100000'); $data['local_lang'] = array(); if (!empty($ext_data['lang'])) { $data['local_lang'] = $ext_data['lang']; } $data['location_search_mode'] = 'multi'; if ($ext_data['location_search_mode'] === 'single') { $data['location_search_mode'] = 'single'; if (is_numeric($ext_data['use_location'])) { $use_location = $ext_data['use_location']; } else { $use_location = $this->config->item('default_location_id'); } if (!empty($use_location) and is_numeric($use_location)) { $this->location->setLocation($use_location); $data['single_location_url'] = site_url('local?location_id=' . $use_location); } else { $data['single_location_url'] = site_url('local/all'); } } $data['local_action'] = site_url('local_module/local_module/search'); $data['rsegment'] = $rsegment = ($this->uri->rsegment(1) === 'local_module' and !empty($this->referrer_uri)) ? $this->referrer_uri : $this->uri->rsegment(1); $data['local_alert'] = $this->alert->display('local_module'); $data['info_url'] = site_url('local'); $data['local_info'] = $this->location->local(); // retrieve local location data $data['location_id'] = $this->location->getId(); // retrieve local location data $data['location_name'] = $this->location->getName(); // retrieve local location data $data['location_address'] = $this->location->getAddress(); // retrieve local location data $data['location_image'] = $this->location->getImage(); // retrieve local location data $data['is_opened'] = $this->location->isOpened(); $data['opening_type'] = $this->location->getOpeningType(); $data['opening_status'] = $this->location->openingStatus(); $data['opening_time'] = $this->location->openingTime(); $data['closing_time'] = $this->location->closingTime(); $data['order_type'] = $this->location->orderType(); $data['delivery_charge'] = $this->location->deliveryCharge(); $data['delivery_time'] = $this->location->deliveryTime(); $data['collection_time'] = $this->location->collectionTime(); $data['search_query'] = $this->location->searchQuery(); $data['has_delivery'] = $this->location->hasDelivery(); $data['has_collection'] = $this->location->hasCollection(); $data['location_search'] = FALSE; if ($rsegment === 'home') { $data['location_search'] = TRUE; } if ($this->config->item('maps_api_key')) { $data['map_key'] = '&key=' . $this->config->item('maps_api_key'); } else { $data['map_key'] = ''; } if (!$this->location->hasDelivery() and $this->location->hasCollection()) { // checks if cart contents is empty $data['text_service_offered'] = !empty($data['local_lang']['text_collection_only']) ? $data['local_lang']['text_collection_only'] : $this->lang->line('text_collection_only'); } else { if ($this->location->hasDelivery() and !$this->location->hasCollection()) { $data['text_service_offered'] = !empty($data['local_lang']['text_delivery_only']) ? $data['local_lang']['text_delivery_only'] : $this->lang->line('text_delivery_only'); } else { if ($this->location->hasDelivery() and $this->location->hasCollection()) { $data['text_service_offered'] = !empty($data['local_lang']['text_both_types']) ? $data['local_lang']['text_both_types'] : $this->lang->line('text_both_types'); // display we are open } else { $data['text_service_offered'] = !empty($data['local_lang']['text_no_types']) ? $data['local_lang']['text_no_types'] : $this->lang->line('text_no_types'); } } } if ($this->location->deliveryCharge() > 0) { $text_delivery_charge = !empty($data['local_lang']['text_delivery_charge']) ? $data['local_lang']['text_delivery_charge'] : $this->lang->line('text_delivery_charge'); $data['text_delivery_charge'] = sprintf($text_delivery_charge, $this->currency->format($this->location->deliveryCharge())); } else { $data['text_delivery_charge'] = !empty($data['local_lang']['text_free_delivery']) ? $data['local_lang']['text_free_delivery'] : $this->lang->line('text_free_delivery'); } if ($this->location->minimumOrder() > 0) { $data['min_total'] = $this->currency->format($this->location->minimumOrder()); } else { $data['min_total'] = $this->currency->format('0.00'); } if ($ext_data['controller'] !== 'home') { // dont display alert if referrer is home if ($this->location->searchQuery() and !$this->location->isOpened() and $this->config->item('future_orders') !== '1') { // else if local restaurant is not open $data['local_alert'] = $this->lang->line('alert_location_closed'); } else { if ($this->location->searchQuery() and !$this->location->isOpened() and $this->config->item('future_orders') === '1') { $data['local_alert'] = $this->lang->line('alert_local_future_order'); } } } $this->load->model('Reviews_model'); $total_reviews = $this->Reviews_model->getTotalLocationReviews($this->location->getId()); $data['text_total_review'] = sprintf($this->lang->line('text_total_review'), $total_reviews); // pass array $data and load view files $this->load->view('local_module/local_module', $data); }
public function getCart($module = array(), $data = array(), $is_mobile = FALSE) { if (!file_exists(EXTPATH . 'cart_module/views/cart_module.php')) { //check if file exists in views folder show_404(); // Whoops, show 404 error page! } $data['rsegment'] = $rsegment = $this->referrer_uri; $ext_data = (!empty($module['data']) and is_array($module['data'])) ? $module['data'] : array(); if (empty($ext_data)) { $extension = $this->extension->getModule('cart_module'); if (!empty($extension['ext_data'])) { $ext_data = $extension['ext_data']; } } $this->template->setStyleTag(extension_url('cart_module/views/stylesheet.css'), 'cart-module-css', '144000'); $data['is_opened'] = $this->location->isOpened(); $data['order_type'] = $this->location->orderType(); $data['search_query'] = $this->location->searchQuery(); $data['opening_status'] = $this->location->workingStatus('opening'); $data['delivery_status'] = $this->location->workingStatus('delivery'); $data['collection_status'] = $this->location->workingStatus('collection'); $data['has_delivery'] = $this->location->hasDelivery(); $data['has_collection'] = $this->location->hasCollection(); $data['show_cart_images'] = isset($ext_data['show_cart_images']) ? $ext_data['show_cart_images'] : ''; $data['cart_images_h'] = isset($ext_data['cart_images_h']) ? $ext_data['cart_images_h'] : ''; $data['cart_images_w'] = isset($ext_data['cart_images_w']) ? $ext_data['cart_images_w'] : ''; $data['delivery_time'] = $this->location->deliveryTime(); if ($data['delivery_status'] === 'closed') { $data['delivery_time'] = 'closed'; } else { if ($data['delivery_status'] === 'opening') { $data['delivery_time'] = $this->location->workingTime('delivery', 'open'); } } $data['collection_time'] = $this->location->collectionTime(); if ($data['collection_status'] === 'closed') { $data['collection_time'] = 'closed'; } else { if ($data['collection_status'] === 'opening') { $data['collection_time'] = $this->location->workingTime('collection', 'open'); } } $order_data = $this->session->userdata('order_data'); if ($this->input->post('checkout_step')) { $checkout_step = $this->input->post('checkout_step'); } else { if (isset($order_data['checkout_step'])) { $checkout_step = $order_data['checkout_step']; } else { $checkout_step = 'one'; } } if ($rsegment === 'checkout' and $checkout_step === 'two') { $data['button_order'] = '<a class="btn btn-order btn-primary btn-block btn-lg" onclick="$(\'#checkout-form\').submit();">' . $this->lang->line('button_confirm') . '</a>'; } else { if ($rsegment == 'checkout') { $data['button_order'] = '<a class="btn btn-order btn-primary btn-block btn-lg" onclick="$(\'#checkout-form\').submit();">' . $this->lang->line('button_payment') . '</a>'; } else { $data['button_order'] = '<a class="btn btn-order btn-primary btn-block btn-lg" href="' . site_url('checkout') . '">' . $this->lang->line('button_order') . '</a>'; } } if ($this->location->isClosed() or !$this->location->checkOrderType()) { $data['button_order'] = '<a class="btn btn-default btn-block btn-lg" href="' . site_url('checkout') . '"><b>' . $this->lang->line('text_is_closed') . '</b></a>'; } $menus = $this->Cart_model->getMenus(); $data['cart_items'] = $data['cart_totals'] = array(); if ($cart_contents = $this->cart->contents()) { // checks if cart contents is not empty foreach ($cart_contents as $row_id => $cart_item) { // loop through items in cart $menu_data = isset($menus[$cart_item['id']]) ? $menus[$cart_item['id']] : FALSE; // get menu data based on cart item id from getMenu method in Menus model if (($alert_msg = $this->cart_module_lib->validateCartMenu($menu_data, $cart_item)) === TRUE) { $cart_image = ''; if (isset($data['show_cart_images']) and $data['show_cart_images'] === '1') { $menu_photo = !empty($menu_data['menu_photo']) ? $menu_data['menu_photo'] : 'data/no_photo.png'; $cart_image = $this->Image_tool_model->resize($menu_photo, $data['cart_images_h'], $data['cart_images_w']); } // load menu data into array $data['cart_items'][] = array('rowid' => $cart_item['rowid'], 'menu_id' => $cart_item['id'], 'name' => strlen($cart_item['name']) > 25 ? strtolower(substr($cart_item['name'], 0, 25)) . '...' : strtolower($cart_item['name']), 'price' => $this->currency->format($cart_item['price']), 'qty' => $cart_item['qty'], 'image' => $cart_image, 'sub_total' => $this->currency->format($cart_item['subtotal']), 'comment' => isset($cart_item['comment']) ? $cart_item['comment'] : '', 'options' => $this->cart->has_options($row_id) == TRUE ? $this->cart->product_options_string($row_id) : ''); } else { $this->alert->set('custom_now', $alert_msg, 'cart_module'); $this->cart->update(array('rowid' => $cart_item['rowid'], 'qty' => '0')); // pass the cart_data array to add item to cart, if successful } } if (($response = $this->cart_module_lib->validateOrderType()) !== TRUE) { $this->alert->set('custom', $response, 'cart_module'); } if (($response = $this->cart_module_lib->validateDeliveryCharge($this->cart->total())) !== TRUE) { $this->alert->set('custom', $response, 'cart_module'); } if (($response = $this->cart_module_lib->validateCoupon($this->cart->coupon_code())) !== TRUE) { $this->alert->set('custom', $response, 'cart_module'); } Events::trigger('cart_module_before_cart_totals'); $this->cart->calculate_tax(); $data['cart_totals'] = $this->cart_module_lib->cartTotals(); } $data['fixed_cart'] = ''; $fixed_cart = isset($ext_data['fixed_cart']) ? $ext_data['fixed_cart'] : '1'; if (!$is_mobile and $fixed_cart === '1' and $rsegment !== 'checkout') { $fixed_top_offset = isset($ext_data['fixed_top_offset']) ? $ext_data['fixed_top_offset'] : '250'; $fixed_bottom_offset = isset($ext_data['fixed_bottom_offset']) ? $ext_data['fixed_bottom_offset'] : '120'; $data['fixed_cart'] = 'id="cart-box-affix" data-spy="affix" data-offset-top="' . $fixed_top_offset . '" data-offset-bottom="' . $fixed_bottom_offset . '"'; } $data['is_checkout'] = $rsegment === 'checkout' ? TRUE : FALSE; $data['is_mobile'] = $is_mobile; $data['cart_alert'] = $this->alert->display('cart_module'); if ($is_mobile) { return $this->load->view('cart_module/cart_module', $data, TRUE); } else { $this->load->view('cart_module/cart_module', $data); } }
public function index($module = array()) { if (!file_exists(EXTPATH . 'local_module/views/local_module.php')) { //check if file exists in views folder show_404(); // Whoops, show 404 error page! } $ext_data = (!empty($module['data']) and is_array($module['data'])) ? $module['data'] : array(); if (empty($module['status']) or isset($ext_data['status']) and $ext_data['status'] !== '1') { return; } $this->template->setStyleTag(extension_url('local_module/views/stylesheet.css'), 'local-module-css', '100000'); $data['location_search_mode'] = 'multi'; if (isset($ext_data['location_search_mode']) and $ext_data['location_search_mode'] === 'single') { $data['location_search_mode'] = 'single'; if (!empty($ext_data['use_location'])) { $use_location = $ext_data['use_location']; } else { $use_location = $this->config->item('default_location_id'); } if (!empty($use_location) and is_numeric($use_location)) { $this->location->setLocation($use_location); $data['single_location_url'] = site_url('local?location_id=' . $use_location); } else { $data['single_location_url'] = site_url('local/all'); } } $data['local_action'] = site_url('local_module/local_module/search'); $data['rsegment'] = $rsegment = ($this->uri->rsegment(1) === 'local_module' and !empty($this->referrer_uri)) ? $this->referrer_uri : $this->uri->rsegment(1); $this->load->library('cart'); // load the cart library $cart_total = $this->cart->total(); $data['info_url'] = site_url('local'); $data['local_info'] = $this->location->local(); // retrieve local location data $data['location_id'] = $this->location->getId(); // retrieve local location data $data['location_name'] = $this->location->getName(); // retrieve local location data $data['location_address'] = $this->location->getAddress(); // retrieve local location data $data['location_image'] = $this->location->getImage(); // retrieve local location data $data['is_opened'] = $this->location->isOpened(); $data['opening_type'] = $this->location->workingType('opening'); $data['opening_status'] = $this->location->workingStatus('opening'); $data['delivery_status'] = $this->location->workingStatus('delivery'); $data['collection_status'] = $this->location->workingStatus('collection'); $data['opening_time'] = $this->location->workingTime('opening', 'open'); $data['closing_time'] = $this->location->workingTime('opening', 'close'); $data['order_type'] = $this->location->orderType(); $data['delivery_charge'] = $this->location->deliveryCharge($cart_total); $data['delivery_coverage'] = $this->location->checkDeliveryCoverage(); $data['search_query'] = $this->location->searchQuery(); $data['has_search_query'] = $this->location->hasSearchQuery(); $data['has_delivery'] = $this->location->hasDelivery(); $data['has_collection'] = $this->location->hasCollection(); $data['location_order'] = $this->config->item('location_order'); $data['location_search'] = FALSE; if ($rsegment === 'home') { $data['location_search'] = TRUE; } if ($this->config->item('maps_api_key')) { $data['map_key'] = '&key=' . $this->config->item('maps_api_key'); } else { $data['map_key'] = ''; } $data['delivery_time'] = $this->location->deliveryTime(); if ($data['delivery_status'] === 'closed') { $data['delivery_time'] = 'closed'; } else { if ($data['delivery_status'] === 'opening') { $data['delivery_time'] = $this->location->workingTime('delivery', 'open'); } } $data['collection_time'] = $this->location->collectionTime(); if ($data['collection_status'] === 'closed') { $data['collection_time'] = 'closed'; } else { if ($data['collection_status'] === 'opening') { $data['collection_time'] = $this->location->workingTime('collection', 'open'); } } $conditions = array('all' => $this->lang->line('text_condition_all_orders'), 'above' => $this->lang->line('text_condition_above_total'), 'below' => $this->lang->line('text_condition_below_total')); $count = 1; $data['text_delivery_condition'] = ''; $delivery_condition = $this->location->deliveryCondition(); foreach ($delivery_condition as $condition) { $condition = explode('|', $condition); $delivery = (isset($condition[0]) and $condition[0] > 0) ? $this->currency->format($condition[0]) : $this->lang->line('text_free_delivery'); $con = isset($condition[1]) ? $condition[1] : 'above'; $total = (isset($condition[2]) and $condition[2] > 0) ? $this->currency->format($condition[2]) : $this->lang->line('text_no_min_total'); if ($count === 1 and isset($condition[0]) and $condition[0] > 0) { $data['text_delivery_condition'] .= sprintf($this->lang->line('text_delivery_charge'), ''); } if ($con === 'all') { $data['text_delivery_condition'] .= sprintf($conditions['all'], $delivery); } else { if ($con === 'above') { $data['text_delivery_condition'] .= sprintf($conditions[$con], $delivery, $total) . ', '; } else { if ($con === 'below') { $data['text_delivery_condition'] .= sprintf($conditions[$con], $total) . ', '; } } } $count++; } $data['text_delivery_condition'] = trim($data['text_delivery_condition'], ', '); if ($this->location->deliveryCharge($cart_total) > 0) { $data['text_delivery_charge'] = sprintf($this->lang->line('text_delivery_charge'), $this->currency->format($this->location->deliveryCharge($cart_total))); } else { $data['text_delivery_charge'] = $this->lang->line('text_free_delivery'); } if ($this->location->minimumOrder($cart_total) > 0) { $data['min_total'] = $this->location->minimumOrder($cart_total); } else { $data['min_total'] = '0.00'; } $this->load->model('Reviews_model'); $total_reviews = $this->Reviews_model->getTotalLocationReviews($this->location->getId()); $data['text_total_review'] = sprintf($this->lang->line('text_total_review'), $total_reviews); $data['local_alert'] = $this->alert->display('local_module'); // pass array $data and load view files $this->load->view('local_module/local_module', $data); }
public function index($ext_data = array()) { if (!file_exists(EXTPATH . 'cart_module/views/cart_module.php')) { //check if file exists in views folder show_404(); // Whoops, show 404 error page! } $referrer_uri = explode('/', str_replace(site_url(), '', $this->agent->referrer())); $data['rsegment'] = $rsegment = ($this->uri->rsegment(1) === 'cart_module' and !empty($referrer_uri[0])) ? $referrer_uri[0] : $this->uri->rsegment(1); if (empty($ext_data)) { $extension = $this->extension->getModule('cart_module'); if (!empty($extension['ext_data'])) { $ext_data = $extension['ext_data']; } } $this->template->setStyleTag(extension_url('cart_module/views/stylesheet.css'), 'cart-module-css', '144000'); $this->template->setStyleTag(base_url("assets/js/fancybox/jquery.fancybox.css"), 'jquery-fancybox-css', '145000'); $this->template->setScriptTag(base_url("assets/js/fancybox/jquery.fancybox.js"), 'jquery-fancybox-js', '14000'); $order_data = $this->session->userdata('order_data'); if ($rsegment === 'checkout' and isset($order_data['checkout_step']) and $order_data['checkout_step'] === 'two') { $data['button_order'] = '<a class="btn btn-primary btn-block btn-lg" onclick="$(\'#checkout-form\').submit();">' . $this->lang->line('button_confirm') . '</a>'; } else { if ($rsegment == 'checkout') { $data['button_order'] = '<a class="btn btn-primary btn-block btn-lg" onclick="$(\'#checkout-form\').submit();">' . $this->lang->line('button_payment') . '</a>'; } else { $data['button_order'] = '<a class="btn btn-primary btn-block btn-lg" href="' . site_url('checkout') . '">' . $this->lang->line('button_order') . '</a>'; } } $data['is_opened'] = $this->location->isOpened(); $data['order_type'] = $this->location->orderType(); $data['search_query'] = $this->location->searchQuery(); $data['delivery_time'] = $this->location->deliveryTime(); $data['collection_time'] = $this->location->collectionTime(); $data['show_cart_images'] = isset($ext_data['show_cart_images']) ? $ext_data['show_cart_images'] : ''; $data['cart_images_h'] = isset($ext_data['cart_images_h']) ? $ext_data['cart_images_h'] : ''; $data['cart_images_w'] = isset($ext_data['cart_images_w']) ? $ext_data['cart_images_w'] : ''; $menus = $this->Cart_model->getMenus(); $data['cart_items'] = array(); if ($cart_contents = $this->cart->contents()) { // checks if cart contents is not empty foreach ($cart_contents as $row_id => $cart_item) { // loop through items in cart $menu_data = isset($menus[$cart_item['id']]) ? $menus[$cart_item['id']] : FALSE; // get menu data based on cart item id from getMenu method in Menus model $cart_status = FALSE; if (!$menu_data) { $alert_msg = sprintf($this->lang->line('alert_menu_not_found'), $cart_item['name']); } else { if ($menu_data['subtract_stock'] === '1' and $menu_data['stock_qty'] <= 0) { // checks if stock quantity is less than or equal to zero $alert_msg = sprintf($this->lang->line('alert_out_of_stock'), $cart_item['name']); } else { if ($menu_data['subtract_stock'] === '1' and $menu_data['stock_qty'] <= $cart_item['qty']) { // checks if stock quantity is less than or equal to zero $alert_msg = sprintf($this->lang->line('alert_low_on_stock'), $menu_data['menu_name'], $menu_data['stock_qty']); } else { if ($cart_item['qty'] < $menu_data['minimum_qty']) { // if stock quantity is less than or equal to zero $alert_msg = sprintf($this->lang->line('alert_minimum_qty'), $cart_item['name'], $menu_data['minimum_qty']); } else { $cart_status = TRUE; $cart_image = ''; if (isset($data['show_cart_images']) and $data['show_cart_images'] === '1') { $menu_photo = !empty($menu_data['menu_photo']) ? $menu_data['menu_photo'] : 'data/no_photo.png'; $cart_image = $this->Image_tool_model->resize($menu_photo, $data['cart_images_h'], $data['cart_images_w']); } // load menu data into array $data['cart_items'][] = array('rowid' => $cart_item['rowid'], 'menu_id' => $cart_item['id'], 'name' => strlen($cart_item['name']) > 25 ? strtolower(substr($cart_item['name'], 0, 25)) . '...' : strtolower($cart_item['name']), 'price' => $this->currency->format($cart_item['price']), 'qty' => $cart_item['qty'], 'image' => $cart_image, 'sub_total' => $this->currency->format($cart_item['subtotal']), 'comment' => isset($cart_item['comment']) ? $cart_item['comment'] : '', 'options' => $this->cart->has_options($row_id) == TRUE ? $this->cart->product_options_string($row_id) : ''); } } } } if ($cart_status === FALSE) { $this->alert->set('custom_now', $alert_msg, 'cart_module'); $this->cart->update(array('rowid' => $cart_item['rowid'], 'qty' => '0')); // pass the cart_data array to add item to cart, if successful } } if ($this->location->orderType() === '1' and $this->cart->set_delivery($this->location->deliveryCharge())) { $data['delivery'] = $this->currency->format($this->cart->delivery()); } else { $this->cart->set_delivery(0); } $data['coupon'] = array(); if ($this->cart->coupon_code()) { if (($response = $this->validateCoupon($this->cart->coupon_code())) !== TRUE) { $this->alert->set('custom', $response, 'cart_module'); } $data['coupon'] = array('code' => $this->cart->coupon_code(), 'discount' => $this->currency->format($this->cart->coupon_discount())); } $data['sub_total'] = $this->currency->format($this->cart->total()); $data['order_total'] = $this->currency->format($this->cart->order_total()); } $data['cart_alert'] = $this->alert->display('cart_module'); $this->load->view('cart_module/cart_module', $data); }
public function index() { $this->load->model('Reservations_model'); $this->load->library('location'); // load the location library $this->lang->load('reservation_module/reservation_module'); if (!file_exists(EXTPATH . 'reservation_module/views/reservation_module.php')) { //check if file exists in views folder show_404(); // Whoops, show 404 error page! } $this->template->setStyleTag(extension_url('reservation_module/views/stylesheet.css'), 'reservation-module-css', '154000'); $this->template->setStyleTag(base_url('assets/js/datepicker/datepicker.css'), 'datepicker-css', '124000'); $this->template->setScriptTag(base_url("assets/js/datepicker/bootstrap-datepicker.js"), 'bootstrap-datepicker-js', '12000'); $this->template->setStyleTag(base_url('assets/js/datepicker/bootstrap-timepicker.css'), 'bootstrap-timepicker-css', '124440'); $this->template->setScriptTag(base_url("assets/js/datepicker/bootstrap-timepicker.js"), 'bootstrap-timepicker-js', '12550'); if ($this->config->item('reservation_mode') !== '1') { $this->alert->set('alert', $this->lang->line('alert_reservation_disabled')); redirect('home'); } $date_format = $this->config->item('date_format') ? $this->config->item('date_format') : '%d %M %y'; $time_format = $this->config->item('time_format') ? $this->config->item('time_format') : '%h:%i %a'; if (strpos($time_format, '%h') !== FALSE) { $data['time_format'] = '12hr'; $time_format = '%g:%i %A'; } else { $data['time_format'] = '24hr'; $time_format = '%H:%i'; } if (strpos($date_format, 'm') === 1) { $data['date_format'] = 'month_first'; $date_format = '%m-%d-%Y'; } else { if (strpos($date_format, 'Y') === 1) { $data['date_format'] = 'year_first'; $date_format = '%Y-%m-%d'; } else { $data['date_format'] = 'day_first'; $date_format = '%d-%m-%Y'; } } $data['current_url'] = page_url() . '?action=find_table&'; $data['reset_url'] = site_url('reservation'); $data['find_table_action'] = 'find_table'; if ($this->input->get() and ($response = $this->findTable()) !== FALSE) { if ($this->input->get('action') === 'select_time' and $this->input->get('selected_time')) { $data['find_table_action'] = 'view_summary'; $data['current_url'] = page_url() . '?action=select_time&'; } else { $data['find_table_action'] = 'select_time'; $data['current_url'] = page_url() . '?action=select_time&'; } } $data['locations'] = array(); $locations = $this->Locations_model->getLocations(); foreach ($locations as $location) { $data['locations'][] = array('id' => $location['location_id'], 'name' => $location['location_name']); } $data['guest_numbers'] = array('2', '3', '4', '5', '6', '7', '8', '9', '10'); $data['location_image'] = $this->location->getImage(); if ($this->input->get('location')) { $data['location_id'] = $this->input->get('location'); $data['current_url'] .= 'location=' . $data['location_id'] . '&'; } else { $data['location_id'] = $this->location->getId(); } if ($this->input->get('guest_num')) { $data['guest_num'] = $this->input->get('guest_num'); $data['current_url'] .= 'guest_num=' . $data['guest_num'] . '&'; } else { $data['guest_num'] = ''; } if ($this->input->get('reserve_date')) { $data['date'] = $this->input->get('reserve_date'); $data['current_url'] .= 'reserve_date=' . urlencode($data['date']) . '&'; } else { $data['date'] = mdate($date_format, strtotime('+1 day', time())); } if ($this->input->get('selected_time')) { $data['time'] = mdate($time_format, strtotime($this->input->get('selected_time'))); $data['current_url'] .= 'reserve_time=' . urlencode($data['time']) . '&'; } else { if ($this->input->get('reserve_time')) { $data['time'] = mdate($time_format, strtotime($this->input->get('reserve_time'))); $data['current_url'] .= 'reserve_time=' . urlencode($data['time']) . '&'; } else { $data['time'] = ''; } } $data['reservation_times'] = array(); $start_time = mdate('%H:%i', strtotime($this->location->openingTime()) + $this->location->getReservationInterval() * 60); $reservation_times = time_range($start_time, $this->location->closingTime(), $this->location->getReservationInterval()); // retrieve the location delivery times from location library foreach ($reservation_times as $key => $value) { // loop through delivery times $data['reservation_times'][$value] = mdate($time_format, strtotime($value)); } $data['time_slots'] = array(); if (!empty($response['time_slots'])) { for ($i = 0; $i < 5; $i++) { if (isset($response['time_slots'][$i])) { $time = mdate($time_format, strtotime($response['time_slots'][$i])); $data['time_slots'][$i]['state'] = ''; $data['time_slots'][$i]['time'] = $time; } else { $data['time_slots'][$i]['state'] = 'disabled'; $data['time_slots'][$i]['time'] = '--'; } } } $data['reservation_alert'] = $this->alert->display('reservation_module'); $this->load->view('reservation_module/reservation_module', $data); }
public function index() { if (!file_exists(EXTPATH . 'reservation_module/views/reservation_module.php')) { //check if file exists in views folder show_404(); // Whoops, show 404 error page! } $this->template->setStyleTag(extension_url('reservation_module/views/stylesheet.css'), 'reservation-module-css', '154000'); $this->template->setStyleTag(base_url('assets/js/datepicker/datepicker.css'), 'datepicker-css', '124000'); $this->template->setScriptTag(base_url("assets/js/datepicker/bootstrap-datepicker.js"), 'bootstrap-datepicker-js', '12000'); $this->template->setStyleTag(base_url('assets/js/datepicker/bootstrap-timepicker.css'), 'bootstrap-timepicker-css', '124440'); $this->template->setScriptTag(base_url("assets/js/datepicker/bootstrap-timepicker.js"), 'bootstrap-timepicker-js', '12550'); if ($this->config->item('reservation_mode') !== '1') { $this->alert->set('alert', $this->lang->line('alert_reservation_disabled')); redirect('home'); } $data['current_url'] = page_url() . '?action=find_table&'; $data['reset_url'] = site_url('reservation'); $data['find_table_action'] = 'find_table'; if ($this->input->get() and ($response = $this->findTable()) !== FALSE) { if ($this->input->get('action') === 'select_time' and $this->input->get('selected_time')) { $data['find_table_action'] = 'view_summary'; $data['current_url'] = page_url() . '?action=select_time&'; } else { $data['find_table_action'] = 'select_time'; $data['current_url'] = page_url() . '?action=select_time&'; } } $data['locations'] = array(); $locations = $this->Locations_model->getLocations(); foreach ($locations as $location) { $data['locations'][] = array('id' => $location['location_id'], 'name' => $location['location_name']); } $data['guest_numbers'] = array('2', '3', '4', '5', '6', '7', '8', '9', '10'); $data['location_image'] = $this->location->getImage(); if ($this->input->get('location')) { $data['location_id'] = $this->input->get('location'); $data['current_url'] .= 'location=' . $data['location_id'] . '&'; } else { $data['location_id'] = ''; } if ($this->input->get('guest_num')) { $data['guest_num'] = $this->input->get('guest_num'); $data['current_url'] .= 'guest_num=' . $data['guest_num'] . '&'; } else { $data['guest_num'] = ''; } if ($this->input->get('reserve_date')) { $data['date'] = $this->input->get('reserve_date'); $data['current_url'] .= 'reserve_date=' . urlencode($data['date']) . '&'; } else { $data['date'] = ''; } if ($this->input->get('selected_time')) { $data['time'] = mdate('%g:%i %A', strtotime($this->input->get('selected_time'))); $data['current_url'] .= 'reserve_time=' . urlencode($data['time']) . '&'; } else { if ($this->input->get('reserve_time')) { $data['time'] = mdate('%g:%i %A', strtotime($this->input->get('reserve_time'))); $data['current_url'] .= 'reserve_time=' . urlencode($data['time']) . '&'; } else { $data['time'] = ''; } } $data['time_slots'] = array(); if (!empty($response['time_slots'])) { for ($i = 0; $i < 5; $i++) { if (isset($response['time_slots'][$i])) { $time = mdate('%g:%i %A', strtotime($response['time_slots'][$i])); $data['time_slots'][$i]['state'] = ''; $data['time_slots'][$i]['time'] = $time; } else { $data['time_slots'][$i]['state'] = 'disabled'; $data['time_slots'][$i]['time'] = '--'; } } } $data['reservation_alert'] = $this->alert->display('reservation_module'); $this->load->view('reservation_module/reservation_module', $data); }