コード例 #1
0
 public function downloadFile($attrs)
 {
     $link = false;
     if (isset($attrs['path'])) {
         $path = urlencode($attrs['path']);
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] encoded {$path}");
         $nvp = 'task=member_download&path=' . $path;
         $url = Cart66Common::replaceQueryString($nvp);
         if (Cart66Common::isLoggedIn()) {
             $link = '<a class="Cart66DownloadFile" href="' . $url . '">' . $attrs['text'] . '</a>';
         } else {
             $link = $attrs['text'];
         }
     }
     return $link;
 }
コード例 #2
0
    ?>
</a></span>
              <p id="what_is_price_description_answer" class="label_desc" style="max-width: 400px; display:none;"><?php 
    _e('(Optional) If you leave this blank, Cart66 will display a price description based on the information that defines this subscription. You may customize that message and briefly describe how you plan to bill your customer. This will be the message that showsup next to your add to cart buttons and also in the shopping cart.', 'cart66');
    ?>
 
              </p>
            </li>
          </ul>
          
          <ul style="margin: 15px 0px;">
            <li>
              <label class="med">&nbsp;</label>
              <?php 
    if ($data['subscription']->id > 0) {
        $url = Cart66Common::replaceQueryString('page=cart66-paypal-subscriptions');
        echo "<a href=\"{$url}\" class='button-secondary linkButton'>Cancel</a>";
    }
    ?>
              <input type="submit" name="save" value="<?php 
    _e('Save', 'cart66');
    ?>
" id="Save" class="button-primary" style="width: 60px;"/>
            </li>
          </ul>
          
        </form>
        <?php 
} else {
    ?>
          <p class="description"><?php 
コード例 #3
0
ファイル: Cart66Admin.php プロジェクト: rbredow/allyzabbacart
 public static function accountsPage()
 {
     $data = array();
     if (CART66_PRO) {
         $data['plan'] = new Cart66AccountSubscription();
         $data['activeUntil'] = '';
         $account = new Cart66Account();
         if (isset($_REQUEST['cart66-action']) && $_REQUEST['cart66-action'] == 'delete_account') {
             // Look for delete request
             if (isset($_REQUEST['accountId']) && is_numeric($_REQUEST['accountId'])) {
                 $account = new Cart66Account($_REQUEST['accountId']);
                 $account->deleteMe();
                 $account->clear();
             }
         } elseif (isset($_REQUEST['accountId']) && is_numeric($_REQUEST['accountId'])) {
             if (isset($_REQUEST['opt_out'])) {
                 $account = new Cart66Account();
                 $account->load($_REQUEST['accountId']);
                 $data = array('opt_out' => $_REQUEST['opt_out']);
                 $account->setData($data);
                 $account->save();
                 $account->clear();
             }
             // Look in query string for account id
             $account = new Cart66Account();
             $account->load($_REQUEST['accountId']);
             $id = $account->getCurrentAccountSubscriptionId(true);
             $data['plan'] = new Cart66AccountSubscription($id);
             // Return even if plan is expired
             if (date('Y', strtotime($data['plan']->activeUntil)) <= 1970) {
                 $data['activeUntil'] = '';
             } else {
                 $data['activeUntil'] = date('m/d/Y', strtotime($data['plan']->activeUntil));
             }
         }
         if ($_SERVER['REQUEST_METHOD'] == 'POST' && Cart66Common::postVal('cart66-action') == 'save account') {
             $acctData = $_POST['account'];
             // Format or unset password
             if (empty($acctData['password'])) {
                 unset($acctData['password']);
             } else {
                 $acctData['password'] = md5($acctData['password']);
             }
             // Strip HTML tags on notes field
             $acctData['notes'] = strip_tags($acctData['notes'], '<a><strong><em>');
             $planData = $_POST['plan'];
             $planData['active_until'] = date('Y-m-d 00:00:00', strtotime($planData['active_until']));
             // Updating an existing account
             if ($acctData['id'] > 0) {
                 $account = new Cart66Account($acctData['id']);
                 $account->setData($acctData);
                 $account_errors = $account->validate();
                 $sub = new Cart66AccountSubscription($planData['id']);
                 if ($planData['product_id'] != 'spreedly_subscription') {
                     $sub->setData($planData);
                     $subscription_product = new Cart66Product($sub->product_id);
                     $sub->subscription_plan_name = $subscription_product->name;
                     $sub->feature_level = $subscription_product->feature_level;
                     $sub->subscriber_token = '';
                 } else {
                     unset($planData['product_id']);
                     $sub->setData($planData);
                 }
                 $subscription_errors = $sub->validate();
                 $errors = array_merge($account_errors, $subscription_errors);
                 if (count($errors) == 0) {
                     $account->save();
                     $sub->save();
                     $account->clear();
                     $sub->clear();
                 } else {
                     $data['errors'] = $errors;
                     $data['plan'] = $sub;
                     $data['activeUntil'] = date('m/d/Y', strtotime($sub->activeUntil));
                 }
             } else {
                 // Creating a new account
                 $account = new Cart66Account();
                 $account->setData($acctData);
                 $account_errors = $account->validate();
                 if (count($account_errors) == 0) {
                     $sub = new Cart66AccountSubscription();
                     $sub->setData($planData);
                     $subscription_errors = $sub->validate();
                     if (count($subscription_errors) == 0) {
                         $account->save();
                         $sub->billingFirstName = $account->firstName;
                         $sub->billingLastName = $account->lastName;
                         $sub->billingInterval = 'Manual';
                         $sub->account_id = $account->id;
                         $subscription_product = new Cart66Product($sub->product_id);
                         $sub->subscription_plan_name = $subscription_product->name;
                         $sub->feature_level = $subscription_product->feature_level;
                         $sub->save();
                         $account->clear();
                         $data['just_saved'] = true;
                     } else {
                         $data['errors'] = $subscription_errors;
                     }
                 } else {
                     $data['errors'] = $account_errors;
                 }
             }
         }
         $data['url'] = Cart66Common::replaceQueryString('page=cart66-accounts');
         $data['account'] = $account;
     }
     $view = Cart66Common::getView('admin/accounts.php', $data);
     echo $view;
 }
コード例 #4
0
 public function updateMembershipProductIds()
 {
     global $wpdb;
     $output = false;
     // Check for subscriptions lacking a product id
     $sql = 'SELECT id from ' . Cart66Common::getTableName('account_subscriptions') . " WHERE product_id='0' OR product_id IS NULL";
     $needyAccountSubscriptions = $wpdb->get_results($sql);
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] " . count($needyAccountSubscriptions) . " accounts found that need to have a product id updated.");
     if (count($needyAccountSubscriptions) > 0) {
         // accounts needing product id have been found
         foreach ($needyAccountSubscriptions as $accountId) {
             $account = new Cart66AccountSubscription($accountId->id);
             $accountProductId = $account->getProductId();
             if ($accountProductId && !is_array($accountProductId)) {
                 $account->updateProductId($accountProductId);
                 Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Adding Product id: {$accountProductId} to account id: {$accountId->id} ");
             } elseif (is_array($accountProductId)) {
                 $latestProductId = $account->findLatestProductId($accountProductId);
                 Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Multiple products found for account {$accountId->id}");
                 if ($latestProductId) {
                     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Latest membership product id found, id: {$latestProductId}");
                     $account->updateProductId($latestProductId);
                 }
             } else {
                 $output[] = "The subscription id:{$accountId->id} belonging to {$account->billing_first_name} {$account->billing_last_name} does not have a product ID associated with it. This will prevent notifications from being sent out. Please <a href='" . Cart66Common::replaceQueryString('page=cart66-accounts&accountId=' . $account->account_id) . "'>edit the account</a> and select a product ID.";
                 Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] No products were found matching the feature level and subscription plan name of the account id: {$accountId->id}");
             }
         }
     }
     return $output;
 }
コード例 #5
0
$stats = trim(Cart66Setting::getValue('status_options'));
if (strlen($stats) >= 1) {
    $stats = explode(',', $stats);
    ?>
      <p style="float: left; clear: both; margin-top:0; padding-top: 0;"><?php 
    _e('Filter Orders by Status', 'cart66');
    ?>
:
        <?php 
    foreach ($stats as $s) {
        $s = trim(strtolower($s));
        Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Order status query: WHERE status='{$s}'");
        $tmpRows = $order->getOrderRows("WHERE status='{$s}'", null, null, 'id');
        $n = count($tmpRows);
        if ($n > 0) {
            $url = Cart66Common::replaceQueryString("page=cart66_admin&status={$s}");
            echo "<a href=\"{$url}\">" . ucwords($s) . " (" . count($tmpRows) . ")</a> &nbsp;|&nbsp; ";
        } else {
            echo ucwords($s) . " (0) &nbsp;|&nbsp;";
        }
    }
    ?>
        <a href="?page=cart66_admin">All (<?php 
    echo count($order->getOrderRows("WHERE `status` != 'checkout_pending'", null, null, 'id'));
    ?>
)</a>
      </p>
  <?php 
} else {
    echo "<p style=\"float: left; clear: both; color: #999; font-size: 11px; both; margin-top:0; padding-top: 0;\">" . __("You should consider setting order status options such as new and complete on the \n        <a href='?page=cart66-settings'>Cart66 Settings page</a>.", "cart66") . "</p>";
}
コード例 #6
0
 public function getSubscriptionManagementLink($returnUrl = null)
 {
     $url = false;
     if ($this->isSpreedlySubscription()) {
         if (!isset($returnUrl)) {
             $returnUrl = '?return_url=' . Cart66Common::getCurrentPageUrl();
         }
         $spreedly = Cart66Setting::getValue('spreedly_shortname');
         $url = "https://spreedly.com/{$spreedly}/subscriber_accounts/" . $this->subscriberToken . $returnUrl;
     } elseif ($this->isPayPalSubscription()) {
         if ($this->isActive()) {
             $url = Cart66Common::replaceQueryString('cart66-task=CancelRecurringPaymentsProfile');
         }
     }
     return $url;
 }