From cda6288d14f30e13e206448b44d0c83a71764e04 Mon Sep 17 00:00:00 2001 From: sampoyigi Date: Tue, 11 Aug 2015 19:24:06 +0100 Subject: [PATCH 1/5] fixed form error language --- admin/controllers/Locations.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/admin/controllers/Locations.php b/admin/controllers/Locations.php index d6e4c02f3c..cb79e19762 100644 --- a/admin/controllers/Locations.php +++ b/admin/controllers/Locations.php @@ -461,13 +461,13 @@ private function validateForm() { if ($this->input->post('delivery_areas')) { foreach ($this->input->post('delivery_areas') as $key => $value) { - $this->form_validation->set_rules('delivery_areas['.$key.'][shape]', $key.' lang:label_area_shape', 'trim|required'); - $this->form_validation->set_rules('delivery_areas['.$key.'][circle]', $key.' lang:label_area_circle', 'trim|required'); - $this->form_validation->set_rules('delivery_areas['.$key.'][vertices]', $key.' lang:label_area_vertices', 'trim|required'); - $this->form_validation->set_rules('delivery_areas['.$key.'][type]', $key.' lang:label_area_type', 'xss_clean|trim|required'); - $this->form_validation->set_rules('delivery_areas['.$key.'][name]', $key.' lang:label_area_name', 'xss_clean|trim|required'); - $this->form_validation->set_rules('delivery_areas['.$key.'][charge]', $key.' lang:label_area_charge', 'xss_clean|trim|required|numeric'); - $this->form_validation->set_rules('delivery_areas['.$key.'][min_amount]', $key.' lang:label_area_min_amount', 'xss_clean|trim|required|numeric'); + $this->form_validation->set_rules('delivery_areas['.$key.'][shape]', 'lang:label_area_shape', 'trim|required'); + $this->form_validation->set_rules('delivery_areas['.$key.'][circle]', 'lang:label_area_circle', 'trim|required'); + $this->form_validation->set_rules('delivery_areas['.$key.'][vertices]', 'lang:label_area_vertices', 'trim|required'); + $this->form_validation->set_rules('delivery_areas['.$key.'][type]', 'lang:label_area_type', 'xss_clean|trim|required'); + $this->form_validation->set_rules('delivery_areas['.$key.'][name]', 'lang:label_area_name', 'xss_clean|trim|required'); + $this->form_validation->set_rules('delivery_areas['.$key.'][charge]', 'lang:label_area_charge', 'xss_clean|trim|required|numeric'); + $this->form_validation->set_rules('delivery_areas['.$key.'][min_amount]', 'lang:label_area_min_amount', 'xss_clean|trim|required|numeric'); } } From 2c192c349891d92a3cbee10b29abb7f713bc1497 Mon Sep 17 00:00:00 2001 From: sampoyigi Date: Tue, 11 Aug 2015 19:50:58 +0100 Subject: [PATCH 2/5] fixed referral_url helper function redirect loop error --- system/tastyigniter/helpers/TI_url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/tastyigniter/helpers/TI_url_helper.php b/system/tastyigniter/helpers/TI_url_helper.php index f4d111ce9a..ba0fdfc32b 100644 --- a/system/tastyigniter/helpers/TI_url_helper.php +++ b/system/tastyigniter/helpers/TI_url_helper.php @@ -171,7 +171,7 @@ function referrer_url() $CI->load->library('user_agent'); if (!$CI->agent->is_referral()) { - return $CI->agent->referrer(); + return ($CI->agent->referrer() == page_url()) ? $CI->config->site_url() : $CI->agent->referrer(); } else { return $CI->config->site_url(); } From 1abd415f2aad59049c16002c051ca9996cc25c9c Mon Sep 17 00:00:00 2001 From: sampoyigi Date: Tue, 11 Aug 2015 20:00:16 +0100 Subject: [PATCH 3/5] added restaurant_url helper function --- main/controllers/Checkout.php | 10 +++--- system/tastyigniter/helpers/TI_url_helper.php | 33 ++++++++++++++----- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/main/controllers/Checkout.php b/main/controllers/Checkout.php index 6d4bfcc249..72f5c776ab 100644 --- a/main/controllers/Checkout.php +++ b/main/controllers/Checkout.php @@ -25,26 +25,26 @@ public function __construct() { public function index() { if ( ! $this->cart->contents()) { // checks if cart contents is empty $this->alert->set('alert', $this->lang->line('alert_no_menu_to_order')); - redirect(referrer_url()); // redirect to menus page and display error + redirect(restaurant_url()); // redirect to menus page and display error } if ($this->config->item('location_order') === '1' AND ! $this->location->hasSearchQuery()) { // else if local restaurant is not selected $this->alert->set('alert', $this->lang->line('alert_no_selected_local')); - redirect(referrer_url()); // redirect to menus page and display error + redirect(restaurant_url()); // redirect to menus page and display error } if ( ! $this->location->isOpened() AND $this->config->item('future_orders') !== '1') { // else if local restaurant is not open $this->alert->set('alert', $this->lang->line('alert_location_closed')); - redirect(referrer_url()); // redirect to previous page and display error + redirect(restaurant_url()); // redirect to previous page and display error } if (( ! $this->location->hasDelivery() AND ! $this->location->hasCollection()) AND $this->config->item('location_order') === '1') { // else if local restaurant is not open $this->alert->set('alert', $this->lang->line('alert_order_unavailable')); - redirect(referrer_url()); // redirect to previous page and display error + redirect(restaurant_url()); // redirect to previous page and display error } if ($this->location->orderType() === '1' AND ! $this->location->checkMinimumOrder($this->cart->total())) { // checks if cart contents is empty - redirect(referrer_url()); // redirect to previous page and display error + redirect(restaurant_url()); // redirect to previous page and display error } if ( ! $this->customer->islogged() AND $this->config->item('guest_order') !== '1') { // else if customer is not logged in diff --git a/system/tastyigniter/helpers/TI_url_helper.php b/system/tastyigniter/helpers/TI_url_helper.php index ba0fdfc32b..a8b030b8d6 100644 --- a/system/tastyigniter/helpers/TI_url_helper.php +++ b/system/tastyigniter/helpers/TI_url_helper.php @@ -104,13 +104,6 @@ function admin_url($uri = '', $protocol = NULL) return get_instance()->config->root_url(ADMINDIR.'/'.$uri, $protocol); } } -if ( ! function_exists('roott_url')) -{ - function roott_url($uri = '', $protocol = NULL) - { - return get_instance()->config->root_url(ADMINDIR.'/'.$uri, $protocol); - } -} // ------------------------------------------------------------------------ @@ -154,6 +147,30 @@ function page_url() // ------------------------------------------------------------------------ +/** + * Restaurant URL + * + * Returns the full URL (including segments) of the local restaurant if any, + * else locations URL is returned + * + * @access public + * @return string + */ +if ( ! function_exists('restaurant_url')) +{ + function restaurant_url() + { + $CI =& get_instance(); + if (isset($CI->location) AND !empty($CI->location->getId())) { + return site_url('local?location_id='.$CI->location->getId()); + } else { + return site_url('locations'); + } + } +} + +// ------------------------------------------------------------------------ + /** * Referrer URL * @@ -171,7 +188,7 @@ function referrer_url() $CI->load->library('user_agent'); if (!$CI->agent->is_referral()) { - return ($CI->agent->referrer() == page_url()) ? $CI->config->site_url() : $CI->agent->referrer(); + return $CI->agent->referrer(); } else { return $CI->config->site_url(); } From b73161b29295e53e979bf6054cb0cef44ae4cc16 Mon Sep 17 00:00:00 2001 From: sampoyigi Date: Tue, 11 Aug 2015 21:21:06 +0100 Subject: [PATCH 4/5] fixed CI3.0 compatibility issues --- extensions/cart_module/models/{cart_model.php => Cart_model.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename extensions/cart_module/models/{cart_model.php => Cart_model.php} (100%) diff --git a/extensions/cart_module/models/cart_model.php b/extensions/cart_module/models/Cart_model.php similarity index 100% rename from extensions/cart_module/models/cart_model.php rename to extensions/cart_module/models/Cart_model.php From 7bedd45c77ad2cc083393fcf41bc64bfec987020 Mon Sep 17 00:00:00 2001 From: sampoyigi Date: Tue, 11 Aug 2015 21:50:32 +0100 Subject: [PATCH 5/5] fixed minor issue with checkout payment --- system/tastyigniter/migrations/initial_schema.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/tastyigniter/migrations/initial_schema.sql b/system/tastyigniter/migrations/initial_schema.sql index 6e721c2de9..0a6431dab9 100644 --- a/system/tastyigniter/migrations/initial_schema.sql +++ b/system/tastyigniter/migrations/initial_schema.sql @@ -509,7 +509,7 @@ VALUES (14, 'module', 'cart_module', 'a:3:{s:16:\"show_cart_images\";s:1:\"0\";s:13:\"cart_images_h\";s:0:\"\";s:13:\"cart_images_w\";s:0:\"\";}', 1, 1, 'Cart'), (15, 'module', 'reservation_module', 'a:1:{s:7:\"layouts\";a:1:{i:0;a:4:{s:9:\"layout_id\";s:2:\"16\";s:8:\"position\";s:4:\"left\";s:8:\"priority\";s:1:\"1\";s:6:\"status\";s:1:\"1\";}}}', 1, 1, 'Reservation'), (16, 'module', 'slideshow', 'a:6:{s:11:\"dimension_h\";s:3:\"420\";s:11:\"dimension_w\";s:4:\"1170\";s:6:\"effect\";s:4:\"fade\";s:5:\"speed\";s:3:\"500\";s:7:\"layouts\";a:1:{i:0;a:4:{s:9:\"layout_id\";s:2:\"15\";s:8:\"position\";s:3:\"top\";s:8:\"priority\";s:1:\"1\";s:6:\"status\";s:1:\"1\";}}s:6:\"slides\";a:3:{i:0;a:3:{s:4:\"name\";s:9:\"slide.png\";s:9:\"image_src\";s:14:\"data/slide.jpg\";s:7:\"caption\";s:0:\"\";}i:1;a:3:{s:4:\"name\";s:10:\"slide1.png\";s:9:\"image_src\";s:15:\"data/slide1.jpg\";s:7:\"caption\";s:0:\"\";}i:2;a:3:{s:4:\"name\";s:10:\"slide2.png\";s:9:\"image_src\";s:15:\"data/slide2.jpg\";s:7:\"caption\";s:0:\"\";}}}', 1, 1, 'Slideshow'), - (18, 'payment', 'cod', 'a:5:{s:4:\"name\";N;s:11:\"order_total\";s:7:\"1000.00\";s:12:\"order_status\";s:2:\"11\";s:8:\"priority\";s:1:\"1\";s:6:\"status\";s:1:\"1\";}', 1, 1, 'Cash On Delivery'), + (18, 'payment', 'cod', 'a:5:{s:4:\"name\";N;s:11:\"order_total\";s:4:\"0.00\";s:12:\"order_status\";s:2:\"11\";s:8:\"priority\";s:1:\"1\";s:6:\"status\";s:1:\"1\";}', 1, 1, 'Cash On Delivery'), (20, 'module', 'pages_module', 'a:1:{s:7:\"layouts\";a:1:{i:0;a:4:{s:9:\"layout_id\";s:2:\"17\";s:8:\"position\";s:5:\"right\";s:8:\"priority\";s:1:\"1\";s:6:\"status\";s:1:\"1\";}}}', 1, 1, 'Pages'), (21, 'payment', 'paypal_express', 'a:11:{s:8:\"priority\";s:0:\"\";s:6:\"status\";s:1:\"0\";s:8:\"api_mode\";s:7:\"sandbox\";s:8:\"api_user\";s:0:\"\";s:8:\"api_pass\";s:0:\"\";s:13:\"api_signature\";s:0:\"\";s:10:\"api_action\";s:4:\"sale\";s:10:\"return_uri\";s:24:\"paypal_express/authorize\";s:10:\"cancel_uri\";s:21:\"paypal_express/cancel\";s:11:\"order_total\";s:4:\"0.00\";s:12:\"order_status\";s:2:\"11\";}', 1, 1, 'PayPal Express'), (23, 'theme', 'tastyigniter-orange', 'a:13:{s:11:\"logo_height\";s:2:\"40\";s:16:\"logo_padding_top\";s:2:\"25\";s:19:\"logo_padding_bottom\";s:2:\"25\";s:11:\"font_family\";s:25:\"\"Oxygen\",Arial,sans-serif\";s:11:\"font_weight\";s:6:\"normal\";s:9:\"font_size\";s:2:\"13\";s:10:\"font_color\";s:7:\"#333333\";s:4:\"body\";a:2:{s:10:\"background\";s:7:\"#ffffff\";s:5:\"image\";s:0:\"\";}s:6:\"header\";a:3:{s:10:\"background\";s:7:\"#fdeae2\";s:5:\"image\";s:0:\"\";s:5:\"color\";s:7:\"#333333\";}s:7:\"sidebar\";a:4:{s:10:\"background\";s:7:\"#ffffff\";s:5:\"image\";s:0:\"\";s:4:\"font\";s:7:\"#484848\";s:6:\"border\";s:7:\"#ffffff\";}s:4:\"link\";a:2:{s:5:\"color\";s:7:\"#428bca\";s:5:\"hover\";s:7:\"#2a6496\";}s:6:\"button\";a:4:{s:7:\"default\";a:2:{s:10:\"background\";s:7:\"#ffffff\";s:6:\"border\";s:7:\"#cccccc\";}s:7:\"primary\";a:2:{s:10:\"background\";s:7:\"#428bca\";s:6:\"border\";s:7:\"#357ebd\";}s:7:\"success\";a:2:{s:10:\"background\";s:7:\"#5cb85c\";s:6:\"border\";s:7:\"#4cae4c\";}s:6:\"danger\";a:2:{s:10:\"background\";s:7:\"#d9534f\";s:6:\"border\";s:7:\"#d43f3a\";}}s:10:\"custom_css\";s:0:\"\";}', 1, 1, 'TastyIgniter Orange'),