public function section_notifications_settings()
 {
     $tab = 'notifications-email_receipt_settings';
     $data = array('tab' => $tab);
     if (CART66_PRO) {
         $reminder = new Cart66MembershipReminders();
         $orderFulfillment = new Cart66OrderFulfillment();
         $errorMessage = '';
         $successMessage = '';
         if ($_SERVER['REQUEST_METHOD'] == "POST") {
             if ($_POST['cart66-action'] == 'email log settings') {
                 foreach ($_POST['emailLog'] as $key => $value) {
                     Cart66Setting::setValue($key, $value);
                 }
                 $tab = 'notifications-email_log_settings';
             }
             if ($_POST['cart66-action'] == 'save reminder') {
                 try {
                     $reminder->load($_POST['reminder']['id']);
                     $reminder->setData($_POST['reminder']);
                     $reminder->save();
                     $reminder->clear();
                 } catch (Cart66Exception $e) {
                     $errorCode = $e->getCode();
                     // Reminder save failed
                     if ($errorCode == 66302) {
                         $errors = $reminder->getErrors();
                         $exception = Cart66Exception::exceptionMessages($e->getCode(), __("The reminder could not be saved for the following reasons", "cart66"), $errors);
                         $errorMessage = Cart66Common::getView('views/error-messages.php', $exception);
                     }
                 }
                 $tab = 'notifications-reminder_settings';
             }
             if ($_POST['cart66-action'] == 'save order fulfillment') {
                 try {
                     $orderFulfillment->load($_POST['fulfillment']['id']);
                     $orderFulfillment->setData($_POST['fulfillment']);
                     $orderFulfillment->save();
                     $orderFulfillment->clear();
                 } catch (Cart66Exception $e) {
                     $errorCode = $e->getCode();
                     if ($errorCode == 66303) {
                         $errors = $orderFulfillment->getErrors();
                         $exception = Cart66Exception::exceptionMessages($e->getCode(), __("The order fulfillment could not be saved for the following reasons", "cart66"), $errors);
                         $errorMessage = Cart66Common::getView('views/error-messages.php', $exception);
                     }
                 }
                 $tab = 'notifications-fulfillment_settings';
             }
             if ($_POST['cart66-action'] == 'advanced notifications') {
                 Cart66Setting::setValue('enable_advanced_notifications', $_POST['enable_advanced_notifications']);
                 $successMessage = __('Your notification settings have been saved.', 'cart66');
                 $tab = 'notifications-advanced_notifications';
             }
         } elseif ($_SERVER['REQUEST_METHOD'] == "GET") {
             if (isset($_GET['task']) && $_GET['task'] == 'edit_reminder' && isset($_GET['id']) && $_GET['id'] > 0) {
                 $id = Cart66Common::getVal('id');
                 $reminder->load($id);
                 $tab = 'notifications-reminder_settings';
             } elseif (isset($_GET['task']) && $_GET['task'] == 'delete_reminder' && isset($_GET['id']) && $_GET['id'] > 0) {
                 $id = Cart66Common::getVal('id');
                 $reminder->load($id);
                 $reminder->deleteMe();
                 $reminder->clear();
                 $tab = 'notifications-reminder_settings';
             } elseif (isset($_GET['task']) && $_GET['task'] == 'cancel_reminder') {
                 $tab = 'notifications-reminder_settings';
             } elseif (isset($_GET['task']) && $_GET['task'] == 'edit_fulfillment' && isset($_GET['id']) && $_GET['id'] > 0) {
                 $id = Cart66Common::getVal('id');
                 $orderFulfillment->load($id);
                 $tab = 'notifications-fulfillment_settings';
             } elseif (isset($_GET['task']) && $_GET['task'] == 'delete_fulfillment' && isset($_GET['id']) && $_GET['id'] > 0) {
                 $id = Cart66Common::getVal('id');
                 $orderFulfillment->load($id);
                 $orderFulfillment->deleteMe();
                 $orderFulfillment->clear();
                 $tab = 'notifications-fulfillment_settings';
             } elseif (isset($_GET['task']) && $_GET['task'] == 'cancel_fulfillment') {
                 $tab = 'notifications-fulfillment_settings';
             }
         }
         $data = array('reminder' => $reminder, 'order_fulfillment' => $orderFulfillment, 'tab' => $tab, 'error_message' => $errorMessage, 'success_message' => $successMessage);
     }
     echo Cart66Common::getView('admin/settings/notifications.php', $data, false);
 }