public static function dailySubscriptionEmailReminderCheck()
 {
     Cart66Setting::setValue('daily_subscription_reminders_last_checked', Cart66Common::localTs());
     // Function that fires daily to send out subscription reminder emails.  This will be triggered once a day at 3 AM.
     // If this function fires emails will be sent.
     $dayStart = date('Y-m-d 00:00:00', Cart66Common::localTs());
     $dayEnd = date('Y-m-d 00:00:00', strtotime('+ 1 day', Cart66Common::localTs()));
     $reminder = new Cart66MembershipReminders();
     $reminders = $reminder->getModels();
     foreach ($reminders as $r) {
         if ($r->enable == 1) {
             $interval = explode(',', $r->interval);
             foreach ($interval as $i) {
                 $new_interval = trim($i) . ' ' . $r->interval_unit;
                 $product = new Cart66Product($r->subscription_plan_id);
                 $start = date('Y-m-d H:i:s', strtotime('+ ' . $new_interval, strtotime($dayStart)));
                 $end = date('Y-m-d H:i:s', strtotime('+ ' . $new_interval, strtotime($dayEnd)));
                 $sub = new Cart66AccountSubscription();
                 $subs = $sub->getModels("where active_until >= '{$start}' AND active_until < '{$end}' AND lifetime != '1' AND product_id = '{$product->id}'");
                 $log = array();
                 foreach ($subs as $s) {
                     if ($r->validateReminderEmails($s->id)) {
                         $r->sendReminderEmails($s->id);
                         $log[] = $s->id . ' :: ' . $s->billing_first_name . ' ' . $s->billing_last_name;
                     }
                 }
                 Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Start: {$start} :: End: {$end}");
                 Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] subscription ids that meet the criteria: " . print_r($log, true));
             }
         }
     }
 }
Example #2
0
 public function dailyPrunePendingPayPalOrders()
 {
     Cart66Setting::setValue('daily_prune_pending_orders_last_checked', Cart66Common::localTs());
     $o = new Cart66Order();
     $dayStart = date('Y-m-d 00:00:00', strtotime('48 hours ago', Cart66Common::localTs()));
     $dayEnd = date('Y-m-d 00:00:00', strtotime('24 hours ago', Cart66Common::localTs()));
     $orders = $o->getOrderRows("WHERE status in ('paypal_pending','checkout_pending') AND ordered_on >= '{$dayStart}' AND ordered_on < '{$dayEnd}'");
     foreach ($orders as $order) {
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] yes, i am to delete an order or more: " . $order->id);
         $o->load($order->id);
         $o->deleteMe(true, true);
     }
 }
 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);
 }
Example #4
0
        }
        $method->pruneCarrierMethods('capost_intl', $intlCodes);
        $tab = 5;
    } elseif ($_POST['cart66-action'] == 'enable live rates') {
        Cart66Setting::setValue('use_live_rates', 1);
    } elseif ($_POST['cart66-action'] == 'disable live rates') {
        Cart66Setting::setValue('use_live_rates', '');
    } elseif ($_POST['cart66-action'] == 'save rate tweak') {
        Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Saving a rate tweak");
        $factor = Cart66Common::postVal('rate_tweak_factor');
        if (is_numeric($factor)) {
            Cart66Setting::setValue('rate_tweak_factor', $factor);
            Cart66Setting::setValue('rate_tweak_type', Cart66Common::postVal('rate_tweak_type'));
        } else {
            Cart66Setting::setValue('rate_tweak_factor', '');
            Cart66Setting::setValue('rate_tweak_type', '');
        }
        $tab = 7;
    }
} elseif (isset($_GET['task']) && $_GET['task'] == 'edit' && isset($_GET['id']) && $_GET['id'] > 0) {
    $id = Cart66Common::getVal('id');
    $rule->load($id);
} elseif (isset($_GET['task']) && $_GET['task'] == 'edit_method' && isset($_GET['id']) && $_GET['id'] > 0) {
    $id = Cart66Common::getVal('id');
    $method->load($id);
} elseif (isset($_GET['task']) && $_GET['task'] == 'edit_rate' && isset($_GET['id']) && $_GET['id'] > 0) {
    $id = Cart66Common::getVal('id');
    $rate->load($id);
} elseif (isset($_GET['task']) && $_GET['task'] == 'delete' && isset($_GET['id']) && $_GET['id'] > 0) {
    $id = Cart66Common::getVal('id');
    $rule->load($id);
 public static function dailyFollowupEmailCheck()
 {
     if (Cart66Setting::getValue('enable_followup_emails') == '1') {
         Cart66Setting::setValue('daily_followup_last_checked', Cart66Common::localTs());
         // Function that fires daily to send out followup emails.  This will be triggered once a day at 3 AM.
         // If this function fires emails will be sent.
         $dayStart = date('Y-m-d 00:00:00', Cart66Common::localTs());
         $dayEnd = date('Y-m-d 00:00:00', strtotime('+ 1 day', Cart66Common::localTs()));
         $total = Cart66Setting::getValue('followup_email_number') . ' ' . Cart66Setting::getValue('followup_email_time');
         $start = date('Y-m-d H:i:s', strtotime('- ' . $total, strtotime($dayStart)));
         $end = date('Y-m-d H:i:s', strtotime('- ' . $total, strtotime($dayEnd)));
         $order = new Cart66Order();
         $orders = $order->getModels("where ordered_on >= '{$start}' AND ordered_on < '{$end}'");
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Start: {$start} :: End: {$end}");
         foreach ($orders as $o) {
             Cart66AdvancedNotifications::sendFollowupEmail($o->id);
         }
     }
 }
 public static function dismissMijirehNotice()
 {
     Cart66Setting::setValue('mijireh_notice', 1);
 }
Example #7
0
<?php

if (isset($_GET['dismiss_canada_post_update']) && $_GET['dismiss_canada_post_update'] == 'true') {
    Cart66Setting::setValue('capost_merchant_id', '');
}
?>
<div id="shipping_tabs" class="wrap">
  <div class="cart66Tabbed">
  	<div id="cart66-shipping-header">
  	  <ul class="tabs" id="sidemenu">
    	  <li class="sh1"><a class="sh1 tab" href="javascript:void(0)"><?php 
_e('USPS Shipping', 'cart66');
?>
</a></li>
    	  <li class="sh2"><a class="sh2 tab" href="javascript:void(0)"><?php 
_e('UPS Shipping', 'cart66');
?>
</a></li>
    	  <li class="sh3"><a class="sh3 tab" href="javascript:void(0)"><?php 
_e('FedEx Shipping', 'cart66');
?>
</a></li>
    	  <li class="sh4"><a class="sh4 tab" href="javascript:void(0)"><?php 
_e('Australia Post Shipping', 'cart66');
?>
</a></li>
    	  <li class="sh5"><a class="sh5 tab" href="javascript:void(0)"><?php 
_e('Canada Post Shipping', 'cart66');
?>
</a></li>
    	  <li class="sh6"><a class="sh6 tab" href="javascript:void(0)"><?php 
Example #8
0
 public function upgradeDatabase()
 {
     if (Cart66Setting::getValue('auth_force_ssl') == 'no') {
         Cart66Setting::setValue('auth_force_ssl', null);
     } elseif (Cart66Setting::getValue('auth_force_ssl') == 'yes') {
         Cart66Setting::setValue('auth_force_ssl', 1);
     }
 }
    public static function cart66_recent_orders_setup()
    {
        if ($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['widget_id']) && 'cart66_recent_orders_widget' == $_POST['widget_id']) {
            $dashboardOrderLimit = Cart66Common::postVal('dashboard_order_limit');
            Cart66Setting::setValue('dashboard_order_limit', $dashboardOrderLimit);
            $dashboard_display_status = Cart66Common::postVal('dashboard_display_status');
            Cart66Setting::setValue('dashboard_display_status', $dashboard_display_status);
            $order_number_column = Cart66Common::postVal('dashboard_display_order_number');
            Cart66Setting::setValue('dashboard_display_order_number', $order_number_column);
            $dashboard_display_delivery = Cart66Common::postVal('dashboard_display_delivery');
            Cart66Setting::setValue('dashboard_display_delivery', $dashboard_display_delivery);
        }
        $dashboardOrderLimit = Cart66Setting::getValue('dashboard_order_limit') ? Cart66Setting::getValue('dashboard_order_limit') : 10;
        ?>
    <div class="optionsDiv">
      <p>
        <label for="dashboardOrderLimit"><?php 
        _e('How many recent orders would you like to display?', 'cart66');
        ?>
          <input type='text' name='dashboard_order_limit' id='dashboard_order_limit' style='width: 50px;' value="<?php 
        echo $dashboardOrderLimit;
        ?>
" />
        </label>
      </p>
      <p>
        <label for="dashboard_display_status"><input type="checkbox" name='dashboard_display_status' id='dashboard_display_status' value="1" <?php 
        echo Cart66Setting::getValue('dashboard_display_status') == 1 ? 'checked="checked"' : '';
        ?>
 />
          <?php 
        _e('Display Status Column', 'cart66');
        ?>
  
        </label>
      </p>
      <p>
        <label for="dashboard_display_order_number"><input type="checkbox" name='dashboard_display_order_number' id='dashboard_display_order_number' value="1" <?php 
        echo Cart66Setting::getValue('dashboard_display_order_number') == 1 ? 'checked="checked"' : '';
        ?>
 />
          <?php 
        _e('Display Order Number Column', 'cart66');
        ?>
 
        </label>
      </p>
      <p>
        <label for="dashboard_display_delivery"><input type="checkbox" name='dashboard_display_delivery' id='dashboard_display_delivery' value="1" <?php 
        echo Cart66Setting::getValue('dashboard_display_delivery') == 1 ? 'checked="checked"' : '';
        ?>
 />
          <?php 
        _e('Display Delivery Column', 'cart66');
        ?>
 
        </label>
      </p>
    </div>
    <?php 
    }