Example #1
0
 public static function resendEmailFromLog($id)
 {
     $resendEmail = false;
     global $wpdb;
     $tableName = Cart66Common::getTableName('email_log');
     $sql = "SELECT * from {$tableName} where id = {$id}";
     $results = $wpdb->get_results($sql);
     if ($results) {
         foreach ($results as $r) {
             $resendEmail = Cart66Notifications::mail($r->to_email, $r->subject, $r->body, $r->headers);
             $email = new Cart66EmailLog();
             $email_data = array('from_email' => $r->from_email, 'from_name' => $r->from_name, 'to_email' => $r->to_email, 'to_name' => $r->to_name, 'head' => array('headers' => $r->headers), 'subject' => $r->subject, 'msg' => $r->body, 'attachments' => $r->attachments, 'order_id' => $r->order_id);
             if (!$resendEmail) {
                 if (Cart66Setting::getValue('log_resent_emails')) {
                     $email->saveEmailLog($email_data, $r->email_type, $r->copy, 'RESEND FAILED');
                 }
             } else {
                 if (Cart66Setting::getValue('log_resent_emails')) {
                     $email->saveEmailLog($email_data, $r->email_type, $r->copy, 'RESEND SUCCESSFUL');
                 }
             }
         }
     }
     return $resendEmail;
 }
Example #2
0
 public function setSelected($value)
 {
     if ($value) {
         $this->_data['isSelected'] = true;
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Setting this live rate to selected: " . $this->_data['service']);
     } else {
         $this->_data['isSelected'] = false;
     }
 }
Example #3
0
 public function dump()
 {
     if (Cart66Common::sessionType() == 'database') {
         $value = Cart66SessionDb::dump();
     } else {
         $value = Cart66SessionNative::dump();
     }
     return $value;
 }
Example #4
0
 public static function getCartSettings()
 {
     global $wpdb;
     $out = "\n=====================\nCART SETTINGS\n=====================\n\n";
     $cartTable = Cart66Common::getTableName('cart_settings');
     $sql = "SELECT * from {$cartTable} order by `key`";
     $results = $wpdb->get_results($sql, OBJECT);
     foreach ($results as $row) {
         $out .= $row->key . ' = ' . $row->value . "\n";
     }
     return $out;
 }
 public function getTrialPriceDescription()
 {
     $description = 'No trial';
     if ($this->offerTrial > 0) {
         $description = Cart66Common::currency($this->trialPrice) . ' / ';
         if ($this->trialPeriod > 1) {
             $description .= $this->trialPeriod . ' ';
         }
         $description .= $this->getTrialPeriodUnit();
     }
     return $description;
 }
 /**
  * Delete all methods for the given carrier if the carrier code is not in the given array
  */
 public function pruneCarrierMethods($carrier, array $codes)
 {
     $codes = array_map(array($this->_db, 'escape'), $codes);
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Codes array map: " . print_r($codes, true));
     $codes = implode("','", $codes);
     $shippingMethods = $this->_tableName;
     // $sql = "DELETE from $shippingMethods where carrier='$carrier' and code NOT IN ($codes)";
     $sql = "DELETE from {$shippingMethods} where carrier=%s and code NOT IN ('{$codes}')";
     $sql = $this->_db->prepare($sql, $carrier);
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Pruning shipping methods: {$sql}");
     $this->_db->query($sql);
 }
 /**
  * Return the image path for the add to cart button or false if no path is available
  */
 public static function getAddToCartImagePath($attrs)
 {
     $path = false;
     if (isset($attrs['img'])) {
         // Look for custom image for this instance of the button
         $path = $attrs['img'];
     } else {
         // Look for common images
         $cartImgPath = Cart66Setting::getValue('cart_images_url');
         if ($cartImgPath) {
             $cartImgPath = Cart66Common::endSlashPath($cartImgPath);
             $path = $cartImgPath . 'add-to-cart.png';
         }
     }
     return $path;
 }
 public function getPriceDescription()
 {
     $product = new Cart66Product();
     $spreedlyProduct = $product->getOne("where spreedly_subscription_id = {$this->id}");
     if (!empty($spreedlyProduct->priceDescription)) {
         $out = $spreedlyProduct->priceDescription;
     } else {
         $price = $this->price;
         $out = Cart66Common::currency($price) . ' / ' . $this->terms;
         if ($this->hasFreeTrial()) {
             $duration = $this->chargeLaterDurationQuantity . ' ' . $this->chargeLaterDurationUnits;
             $out .= " <span class='Cart66FreePeriod'>(first {$duration} free)</span>";
         }
     }
     return $out;
 }
Example #9
0
 public static function exportOrders($startDate, $endDate)
 {
     global $wpdb;
     $start = date('Y-m-d 00:00:00', strtotime($startDate));
     $end = date('Y-m-d 00:00:00', strtotime($endDate . ' + 1 day'));
     $orders = Cart66Common::getTableName('orders');
     $items = Cart66Common::getTableName('order_items');
     $orderHeaders = array('id' => __('Order ID', 'cart66'), 'trans_id' => __('Order Number', 'cart66'), 'ordered_on' => __('Date', 'cart66'), 'bill_first_name' => __('Billing First Name', 'cart66'), 'bill_last_name' => __('Billing Last Name', 'cart66'), 'bill_address' => __('Billing Address', 'cart66'), 'bill_address2' => __('Billing Address 2', 'cart66'), 'bill_city' => __('Billing City', 'cart66'), 'bill_state' => __('Billing State', 'cart66'), 'bill_country' => __('Billing Country', 'cart66'), 'bill_zip' => __('Billing Zip Code', 'cart66'), 'ship_first_name' => __('Shipping First Name', 'cart66'), 'ship_last_name' => __('Shipping Last Name', 'cart66'), 'ship_address' => __('Shipping Address', 'cart66'), 'ship_address2' => __('Shipping Address 2', 'cart66'), 'ship_city' => __('Shipping City', 'cart66'), 'ship_state' => __('Shipping State', 'cart66'), 'ship_country' => __('Shipping Country', 'cart66'), 'ship_zip' => __('Shipping Zip Code', 'cart66'), 'phone' => __('Phone', 'cart66'), 'email' => __('Email', 'cart66'), 'coupon' => __('Coupon', 'cart66'), 'discount_amount' => __('Discount Amount', 'cart66'), 'shipping' => __('Shipping Cost', 'cart66'), 'subtotal' => __('Subtotal', 'cart66'), 'tax' => __('Tax', 'cart66'), 'total' => __('Total', 'cart66'), 'ip' => __('IP Address', 'cart66'), 'shipping_method' => __('Delivery Method', 'cart66'), 'status' => __('Order Status', 'cart66'));
     $orderColHeaders = implode(',', $orderHeaders);
     $orderColSql = implode(',', array_keys($orderHeaders));
     $out = $orderColHeaders . ",Form Data,Item Number,Description,Quantity,Product Price,Form ID\n";
     $sql = "SELECT {$orderColSql} from {$orders} where ordered_on >= %s AND ordered_on < %s AND status != %s order by ordered_on";
     $sql = $wpdb->prepare($sql, $start, $end, 'checkout_pending');
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] SQL: {$sql}");
     $selectedOrders = $wpdb->get_results($sql, ARRAY_A);
     foreach ($selectedOrders as $o) {
         $itemRowPrefix = '"' . $o['id'] . '","' . $o['trans_id'] . '",' . str_repeat(',', count($o) - 3);
         $orderId = $o['id'];
         $sql = "SELECT form_entry_ids, item_number, description, quantity, product_price FROM {$items} where order_id = {$orderId}";
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Item query: {$sql}");
         $selectedItems = $wpdb->get_results($sql, ARRAY_A);
         $out .= '"' . implode('","', $o) . '"';
         $printItemRowPrefix = false;
         if (!empty($selectedItems)) {
             foreach ($selectedItems as $i) {
                 if ($printItemRowPrefix) {
                     $out .= $itemRowPrefix;
                 }
                 if ($i['form_entry_ids'] && CART66_PRO) {
                     $i['form_id'] = $i['form_entry_ids'];
                     $GReader = new Cart66GravityReader();
                     $i['form_entry_ids'] = $GReader->displayGravityForm($i['form_entry_ids'], true);
                     $i['form_entry_ids'] = str_replace("\"", "''", $i['form_entry_ids']);
                 }
                 $i['description'] = str_replace(",", " -", $i['description']);
                 $out .= ',"' . implode('","', $i) . '"';
                 $out .= "\n";
                 $printItemRowPrefix = true;
             }
         } else {
             $out .= "\n";
         }
     }
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Report\n{$out}");
     return $out;
 }
 public function checkFulfillmentSettings($orderId)
 {
     $order = new Cart66Order($orderId);
     $data = array();
     foreach ($order->getItems() as $item) {
         $data[] = $item->product_id;
     }
     $orderFulfillment = new Cart66OrderFulfillment();
     $orderF = $orderFulfillment->getModels();
     $notify = new Cart66AdvancedNotifications($orderId);
     foreach ($orderF as $of) {
         $products = array_filter(explode(',', $of->products));
         if (array_intersect($data, $products) || empty($products)) {
             Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] THEY INTERSECT!");
             $notify->sendOrderFulfillmentEmails($of->id);
         }
     }
 }
Example #11
0
 public static function getRemoteRequestParams()
 {
     $params = false;
     $setting = new Cart66Setting();
     $orderNumber = Cart66Setting::getValue('order_number');
     if (!$orderNumber) {
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Order number not available");
     }
     $version = Cart66Setting::getValue('version');
     if (!$version) {
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Version number not available");
     }
     if ($orderNumber && $version) {
         global $wpdb;
         $versionName = 'pro';
         $params = sprintf("task=getLatestVersion&pn=Cart66&key=%s&v=%s&vnm=%s&wp=%s&php=%s&mysql=%s&ws=%s", urlencode($orderNumber), urlencode($version), urlencode($versionName), urlencode(get_bloginfo("version")), urlencode(phpversion()), urlencode($wpdb->db_version()), urlencode(get_bloginfo("url")));
     }
     return $params;
 }
Example #12
0
 public static function curlRequest($url, $method = "get", $data = null)
 {
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] curl request info: {$url}\nMethod: {$method}\nData: {$data}");
     $ch = curl_init(self::$baseUri . $url);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
     curl_setopt($ch, CURLOPT_MAXREDIRS, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_USERPWD, self::$apiToken . ":X");
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
     curl_setopt($ch, CURLOPT_TIMEOUT, 8);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml", "Accept: text/xml"));
     switch ($method) {
         case "post":
             if ($data) {
                 curl_setopt($ch, CURLOPT_POST, true);
                 curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
             } else {
                 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
             }
             break;
         case "delete":
             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
             break;
         case "put":
             $fh = fopen("php://memory", "rw");
             fwrite($fh, $data);
             rewind($fh);
             curl_setopt($ch, CURLOPT_INFILE, $fh);
             curl_setopt($ch, CURLOPT_INFILESIZE, strlen($data));
             curl_setopt($ch, CURLOPT_PUT, true);
             curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml", "Accept: text/xml", "Expect:"));
             break;
         default:
             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
             break;
     }
     $result = new StdClass();
     $result->response = curl_exec($ch);
     $result->code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     return $result;
 }
 /**
  * Log the PayPal recurring payment. 
  * 
  * The $data array paramter is a URL decoded version of the IPN post data.
  *   - Log the data in the pp_recurring_posts table
  *   - Update the account_subscriptions table with the new active_until date
  */
 public function log(array $ipnData)
 {
     $isLogged = false;
     $subscription = new Cart66AccountSubscription();
     if ($subscription->loadByPayPalBillingProfileId($ipnData['recurring_payment_id'])) {
         $data = array('account_id' => $subscription->accountId, 'recurring_payment_id' => $ipnData['recurring_payment_id'], 'mc_gross' => $ipnData['mc_gross'], 'txn_id' => $ipnData['txn_id'], 'product_name' => $ipnData['product_name'], 'first_name' => $ipnData['first_name'], 'last_name' => $ipnData['last_name'], 'payer_email' => $ipnData['payer_email'], 'ipn' => serialize($ipnData), 'next_payment_date' => $ipnData['next_payment_date'], 'time_created' => date('Y-m-d H:i:s', strtotime($ipnData['time_created'])));
         $this->setData($data);
         $id = $this->save();
         if ($id > 0) {
             $isLogged = true;
             Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Recurring payment logged with ID: {$id}");
             $subscription->extendActiveUntil($ipnData['next_payment_date']);
         } else {
             Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Failed to log recurring payment. " . print_r($data, true));
         }
     } else {
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Unable to log recurring payment because the paypal billing profile id is unknown: " . $ipnData['recurring_payment_id']);
     }
     return $isLogged;
 }
 /**
  * Return an array of enabled spreedly subscriptions
  * 
  * @return array
  */
 public static function getSubscriptions()
 {
     if (empty(self::$_subscriptionPlans)) {
         $result = SpreedlyCommon::curlRequest("/subscription_plans.xml", "get");
         if ($result->code == '200') {
             $subscriptions = array();
             $plans = new SimpleXmlElement($result->response);
             foreach ($plans as $plan) {
                 $subscription = new SpreedlySubscription();
                 $subscription->setData($plan);
                 /// Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Spreedly subscription enabled: " . $subscription->enabled);
                 if ('true' == (string) $subscription->enabled) {
                     $subscriptions[] = $subscription;
                 }
             }
             self::$_subscriptionPlans = $subscriptions;
         } else {
             Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Spreedly Subscription: Unable to retrieve remote list of subscriptions ");
             //throw new SpreedlyException('Spreedly Subscription: Unable to retrieve remote list of subscriptions', 66003);
         }
     }
     return self::$_subscriptionPlans;
 }
 public function widget($args, $instance)
 {
     extract($args);
     $data['title'] = $instance['title'];
     $data['shipping'] = isset($instance['shipping']) ? $instance['shipping'] : false;
     if (!Cart66Session::get('Cart66Cart')) {
         Cart66Session::set('Cart66Cart', new Cart66Cart());
     }
     $this->_items = Cart66Session::get('Cart66Cart')->getItems();
     $data['items'] = $this->_items;
     $data['cartPage'] = get_page_by_path('store/cart');
     $data['checkoutPage'] = get_page_by_path('store/checkout');
     $data['numItems'] = $this->countItems();
     $data['cartWidget'] = $this;
     $data['beforeWidget'] = $before_widget;
     $data['afterWidget'] = $after_widget;
     $data['beforeTitle'] = $before_title;
     $data['afterTitle'] = $after_title;
     if (isset($instance['standard_advanced']) && $instance['standard_advanced'] == 'advanced') {
         echo Cart66Common::getView('views/cart-sidebar-advanced.php', $data);
     } else {
         echo Cart66Common::getView('views/cart-sidebar.php', $data);
     }
 }
Example #16
0
 /**
  * Manage the status of the recurring payments profile identified by the profileId
  * Action may be: Cancel, Suspend, or Reactivate.
  *   Cancel - Only profiles in Active or Suspended state can be canceled.
  *   Suspend - Only profiles in Active state can be suspended.
  *   Reactivate - Only profiles in a suspended state can be reactivated.
  */
 public function ManageRecurringPaymentsProfileStatus($profileId, $action, $note)
 {
     $this->_requestFields = array('METHOD' => 'ManageRecurringPaymentsProfileStatus', 'PROFILEID' => $profileId, 'ACTION' => $action, 'NOTE' => $note);
     $nvp = $this->_buildNvpStr();
     Cart66Common::log("Manage recurring payments profile request NVP: " . str_replace('&', "\n", $nvp));
     $result = $this->_decodeNvp($this->_sendRequest($this->_apiEndPoint, $nvp));
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Manage recurring payments profile response: " . print_r($result, true));
     return $result;
 }
">
        </li>
        
        <li>
          <label for="Cart66CheckoutButton" class="short">&nbsp;</label>
          <?php 
    $cartImgPath = Cart66Setting::getValue('cart_images_url');
    if ($cartImgPath && stripos(strrev($cartImgPath), '/') !== 0) {
        $cartImgPath .= '/';
    }
    if ($cartImgPath) {
        $continueImg = $cartImgPath . 'continue.png';
    }
    ?>
          <?php 
    if ($cartImgPath && Cart66Common::urlIsLIve($continueImg)) {
        ?>
            <input class="Cart66CheckoutButton" type="image" src='<?php 
        echo $continueImg;
        ?>
' value="<?php 
        _e('Continue', 'cart66');
        ?>
" name="Complete Order"/>
          <?php 
    } else {
        ?>
            <input id="Cart66CheckoutButton" class="Cart66ButtonPrimary Cart66CompleteOrderButton Cart66ContinueButton" type="submit"  value="<?php 
        _e('Continue', 'cart66');
        ?>
" name="Complete Order"/>
Example #18
0
 public function getAffiliateTotal()
 {
     // return portion of order total eligible for affiliate comission
     $affiliate_total = $this->total - ($this->shipping + $this->tax);
     $affiliate_total = Cart66Common::currencyFormat($affiliate_total, 2, '.', '');
     return $affiliate_total;
 }
 public static function getValue($key, $entities = false)
 {
     global $cart66Settings;
     if (isset($cart66Settings[$key])) {
         $value = $cart66Settings[$key];
     } else {
         global $wpdb;
         $settingsTable = Cart66Common::getTableName('cart_settings');
         $value = $wpdb->get_var("SELECT `value` from {$settingsTable} where `key`='{$key}'");
         $GLOBALS['cart66Settings'][$key] = $value;
     }
     if (!empty($value) && $entities) {
         $value = htmlentities($value, ENT_COMPAT, 'UTF-8');
     }
     return empty($value) ? false : $value;
 }
<?php

$url = trim($url);
$saleAmt = $order->subtotal - $order->discount_amount;
$saleAmt = number_format($saleAmt, 2, '.', '');
$url = str_replace('idev_saleamt=XXX', 'idev_saleamt=' . $saleAmt, $url);
$url = str_replace('idev_ordernum=XXX', 'idev_ordernum=' . $order->trans_id, $url);
$ip = $_SERVER['REMOTE_ADDR'];
if ($order->ip != '') {
    $ip = $order->ip;
}
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] order ip: {$ip}");
$url .= '&ip_address=' . $ip;
$promotionCode = Cart66Session::get('Cart66PromotionCode');
if (Cart66Setting::getValue('idev_coupon_codes') && $promotionCode) {
    $url .= '&coupon_code=' . $promotionCode;
}
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Commission notification sent to: {$url}");
Cart66Common::curl($url);
    if (Cart66Common::isHttps()) {
        $url = preg_replace('/http[s]*:/', 'https:', $url);
    } else {
        $url = preg_replace('/http[s]*:/', 'http:', $url);
    }
    ?>
  <input type="hidden" name="lookup-url" id="lookup-url" value="<?php 
    echo $url;
    ?>
" />
  <input type="hidden" name="ouid" id="ouid" value="<?php 
    echo Cart66Session::get('Cart66PendingOUID');
    ?>
" />
  <input type="hidden" name="current-page" id="current-page" value="<?php 
    echo Cart66Common::getCurrentPageUrl();
    ?>
" />
  <script type="text/javascript">
    (function($){
      $(document).ready(function(){
        setInterval(function(){
          lookUpOrder();
        }, 5000);
      })
      function lookUpOrder() {
        var ajaxurl = $('#lookup-url').val();
        var ouid = $('#ouid').val();
        var currentPage = $('#current-page').val();
        $.ajax({
          type: "POST",
 public static function getSalesForMonth()
 {
     $thisMonth = Cart66Common::localTs();
     $year = date('Y', "{$thisMonth}");
     $month = date('n', "{$thisMonth}");
     $orders = Cart66Common::getTableName('orders');
     $orderItems = Cart66Common::getTableName('order_items');
     $products = Cart66Common::getTableName('products');
     $start = date('Y-m-d 00:00:00', strtotime($month . '/1/' . $year));
     $end = date('Y-m-d 00:00:00', strtotime($month . '/1/' . $year . ' +1 month'));
     $sql = "SELECT \n        oi.id, \n        oi.description, \n        oi.product_id, \n        oi.product_price, \n        o.ordered_on,\n        oi.quantity\n      from \n        {$products} as p,\n        {$orders} as o, \n        {$orderItems} as oi \n      where\n        oi.product_id = p.id and\n        oi.order_id = o.id and\n        o.ordered_on >= '{$start}' and \n        o.ordered_on < '{$end}'\n    ";
     global $wpdb;
     $results = $wpdb->get_results($sql);
     return $results;
 }
 protected function _buildNvpStr()
 {
     $nvp = false;
     $dataSources = array('_apiData', '_requestFields', '_ecUrls', '_creditCardData', '_payerInfo', '_payerName', '_payerAddress', '_paymentDetails', '_payerShipToAddress');
     $params = array();
     foreach ($dataSources as $source) {
         if (is_array($this->{$source}) && count($this->{$source}) > 0) {
             foreach ($this->{$source} as $key => $value) {
                 // Only add values that contain a value
                 if (isset($value) && strlen($value) > 0) {
                     $value = urlencode($value);
                     $params[] = "{$key}={$value}";
                 }
             }
         }
     }
     // Add information about individual items
     if (is_array($this->_items) && count($this->_items) > 0) {
         $counter = 0;
         // Look for subscriptions first. PayPal feels like this is important.
         foreach ($this->_items as $itemInfo) {
             if (isset($itemInfo['BILLINGAGREEMENTDESCRIPTION'])) {
                 $params[] = 'L_BILLINGAGREEMENTDESCRIPTION' . $counter . '=' . urlencode($itemInfo['BILLINGAGREEMENTDESCRIPTION']);
                 $params[] = 'L_BILLINGTYPE' . $counter . '=' . 'RecurringPayments';
             }
         }
         // Look for non-subscription products
         foreach ($this->_items as $itemInfo) {
             if (!isset($itemInfo['BILLINGAGREEMENTDESCRIPTION'])) {
                 $params[] = 'L_NAME' . $counter . '=' . urlencode($itemInfo['NAME']);
                 $params[] = 'L_AMT' . $counter . '=' . urlencode(number_format($itemInfo['AMT'], 2, '.', ''));
                 $params[] = 'L_NUMBER' . $counter . '=' . urlencode($itemInfo['NUMBER']);
                 $params[] = 'L_QTY' . $counter . '=' . urlencode($itemInfo['QTY']);
                 $counter++;
             }
         }
     } else {
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Not adding information about individual products because this items array is empty: " . print_r($this->_items, true));
     }
     $nvp = implode('&', $params);
     return $nvp;
 }
Example #24
0
 public function generateUnsubscribeLink($accountId)
 {
     $url = false;
     if ($unsubscribeLink = get_page_by_path('store/unsubscribe')) {
         $account = new Cart66Account();
         $account->load($accountId);
         $url = get_permalink($unsubscribeLink->ID) . '?cart66-task=opt_out&e=' . urlencode(base64_encode($account->email)) . '&t=' . Cart66ProCommon::generateEmailToken($account->id);
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] {$url}");
     }
     return $url;
 }
 public function doSale()
 {
     $transId = 'MT-' . Cart66Common::getRandString();
     return $transId;
 }
    ?>
</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 
 public function emailOptOut()
 {
     if (isset($_GET['cart66-task']) && $_GET['cart66-task'] == 'opt_out') {
         if (isset($_GET['e']) && isset($_GET['t'])) {
             $email = base64_decode(urldecode($_GET['e']));
             $verify = Cart66ProCommon::verifyEmailToken($_GET['t'], $email);
             if ($verify == 1) {
                 $data = array('form' => 'form', 'email' => $email, 'token' => $_GET['t']);
                 echo Cart66Common::getView('pro/views/unsubscribe.php', $data);
             } else {
                 if ($verify == -1) {
                     $message = __('This email has already been unsubscribed', 'cart66');
                 }
                 if ($verify == -2) {
                     $message = __('This email does not exist in our system', 'cart66');
                 }
                 $data = array('form' => 'error', 'message' => $message);
                 echo Cart66Common::getView('pro/views/unsubscribe.php', $data);
             }
         }
     } elseif (isset($_GET['cart66-action']) && $_GET['cart66-action'] == 'opt_out') {
         Cart66ProCommon::unsubscribeEmailToken($_POST['token'], $_POST['email']);
         $data = array('form' => 'opt_out', 'email' => $_POST['email']);
         echo Cart66Common::getView('pro/views/unsubscribe.php', $data);
     } elseif (isset($_GET['cart66-action']) && $_GET['cart66-action'] == 'cancel_opt_out') {
         $data = array('form' => 'cancel');
         echo Cart66Common::getView('pro/views/unsubscribe.php', $data);
     }
 }
Example #28
0
     } elseif (isset($mu_plugin)) {
         $mj_plugin_file = $mu_plugin;
     } elseif (isset($network_plugin)) {
         $mj_plugin_file = $network_plugin;
     }
     define('CART66_PATH', WP_PLUGIN_DIR . '/' . basename(dirname($mj_plugin_file)) . '/');
     define('CART66_URL', plugin_dir_url(CART66_PATH) . basename(dirname($mj_plugin_file)));
 }
 require_once CART66_PATH . "/models/Cart66CartWidget.php";
 require_once CART66_PATH . "/models/Cart66.php";
 require_once CART66_PATH . "/models/Cart66Common.php";
 define("CART66_ORDER_NUMBER", false);
 define("CART66_PRO", true);
 define('CART66_VERSION_NUMBER', cart66_plugin_version());
 define("WPCURL", Cart66Common::getWpContentUrl());
 define("WPURL", Cart66Common::getWpUrl());
 define("MIJIREH_CHECKOUT", 'https://secure.mijireh.com');
 if (CART66_PRO) {
     require_once CART66_PATH . "/pro/models/Cart66ProCommon.php";
 }
 // IS_ADMIN is true when the dashboard or the administration panels are displayed
 if (!defined("IS_ADMIN")) {
     define("IS_ADMIN", is_admin());
 }
 /* Uncomment this block of code for load time debugging
   $filename = CART66_PATH . "/log.txt";
   if(file_exists($filename) && is_writable($filename)) {
     file_put_contents($filename, "\n\n\n================= Loading Cart66 Main File [" . date('m/d/Y g:i:s a') . "] " .
       $_SERVER['REMOTE_ADDR'] . " " . $_SERVER['REQUEST_URI'] . " =================\n\n", FILE_APPEND);
   }
   */
Example #29
0
</label>
            </td>
          </tr>
          <tr valign="top" class="eligible_countries_block">
            <th scope="row"><?php 
_e('Ship to Countries', 'cart66');
?>
</th>
            <td>
              <select id="countries" name="countries[]" class="multiselect" multiple="multiple">
                <?php 
$countryList = Cart66Setting::getValue('countries');
$countryList = $countryList ? explode(',', $countryList) : array();
?>
                <?php 
foreach (Cart66Common::getCountries(true) as $code => $country) {
    ?>
                  <?php 
    $selected = in_array($code . '~' . $country, $countryList) ? 'selected="selected"' : '';
    if (!empty($code)) {
        ?>
                    <option value="<?php 
        echo $code . '~' . $country;
        ?>
" <?php 
        echo $selected;
        ?>
><?php 
        echo $country;
        ?>
</option>
Example #30
0
if (CART66_PRO) {
    require_once CART66_PATH . "/pro/admin/reports.php";
} else {
    echo '<p class="description">' . __('Sales reports are only available in <a href="http://cart66.com">Cart66 Professional</a>.', 'cart66') . '</p>';
}
?>
  
  <br/>
  
  <h3><?php 
_e('Export Orders', 'cart66');
?>
</h3>
  
  <?php 
$firstDayLastMonth = date("m/1/Y", strtotime('-1 month', Cart66Common::localTs()));
$lastDayLastMonth = date("m/d/Y", strtotime('-1 day', strtotime('+1 month', strtotime($firstDayLastMonth))));
?>
  <form action="" method="post" style="margin-bottom: 25px;">
    <input type="hidden" name="cart66-action" value="export_csv" />
    <table class="">
      <tr>
        <th style="text-align: left; padding: 0px 5px;"><?php 
_e('Start Date', 'cart66');
?>
</th>
        <th style="text-align: left; padding: 0px 5px;"><?php 
_e('End Date', 'cart66');
?>
</th>
        <th>&nbsp;</th>