public function initCheckout($total)
 {
     $p = $this->getPayment();
     $b = $this->getBilling();
     Cart66Common::log("Payment info for checkout: " . print_r($p, true));
     $expDate = $p['cardExpirationMonth'] . substr($p['cardExpirationYear'], 2);
     $this->addField('Description', 'Your shopping cart');
     $this->addField('method', 'processCard');
     $this->addField('transactionAmount', number_format($total, 2, '.', ''));
     $this->addField('transactionCurrency', Cart66Setting::getValue('mwarrior_currency'));
     $this->addField('transactionProduct', '12345');
     $this->addField('merchantUUID', $this->_apiData['MERCHANTUUID']);
     $this->addField('apiKey', $this->_apiData['APIKEY']);
     $this->addField('customerName', $b['firstName'] . ' ' . $b['lastName']);
     $this->addField('customerCountry', $b['country']);
     $this->addField('customerAddress', $b['address']);
     $this->addField('customerCity', $b['city']);
     $this->addField('customerState', $b['state']);
     $this->addField('customerPostCode', $b['zip']);
     $this->addField('customerPhone', $p['phone']);
     $this->addField('customerEmail', $p['email']);
     $this->addField('paymentCardNumber', $p['cardNumber']);
     $this->addField('paymentCardExpiry', $expDate);
     $this->addField('paymentCardCSC', $p['securityId']);
     $this->addField('paymentCardName', $b['firstName'] . ' ' . $b['lastName']);
     $this->addField('customerIP', self::getRemoteIP());
     $this->addField('hash', self::calculateHash($this->fields));
 }
 public static function login(Cart66Account $account)
 {
     $name = $account->firstName . ' ' . $account->lastName;
     $email = $account->email;
     $externalId = $account->id;
     $organization = Cart66Setting::getValue('zendesk_organization');
     $key = Cart66Setting::getValue('zendesk_token');
     $prefix = Cart66Setting::getValue('zendesk_prefix');
     if (Cart66Setting::getValue('zendesk_jwt')) {
         $now = time();
         $token = array("jti" => md5($now . rand()), "iat" => $now, "name" => $name, "email" => $email);
         include_once CART66_PATH . "/pro/models/JWT.php";
         $jwt = JWT::encode($token, $key);
         // Redirect
         header("Location: https://" . $prefix . ".zendesk.com/access/jwt?jwt=" . $jwt);
         exit;
     } else {
         /* Build the message */
         $ts = isset($_GET['timestamp']) ? $_GET['timestamp'] : time();
         $message = $name . '|' . $email . '|' . $externalId . '|' . $organization . '|||' . $key . '|' . $ts;
         $hash = MD5($message);
         $remoteAuthUrl = 'http://' . $prefix . '.zendesk.com/access/remoteauth/';
         $arguments = array('name' => $name, 'email' => $email, 'external_id' => $externalId, 'organization' => $organization, 'timestamp' => $ts, 'hash' => $hash);
         $url = add_query_arg($arguments, $remoteAuthUrl);
         header("Location: " . $url);
         exit;
     }
 }
 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;
 }
Beispiel #4
0
 public function __construct()
 {
     $setting = new Cart66Setting();
     $this->username = Cart66Setting::getValue('capost_username');
     $this->password = Cart66Setting::getValue('capost_password');
     $this->customer_number = Cart66Setting::getValue('capost_customer_number');
     $this->fromZip = Cart66Setting::getValue('capost_ship_from_zip');
     $this->credentials = 1;
 }
 public function setPayment($p)
 {
     $this->_payment = $p;
     $skip = array('email', 'phone', 'custom-field');
     $custom_payment_fields = apply_filters('cart66_after_payment_form', '');
     if (is_array($custom_payment_fields)) {
         foreach ($custom_payment_fields as $key => $payment_field) {
             if (!$payment_field['required']) {
                 $skip[] = $payment_field['slug'];
             }
             if (isset($payment_field['validator']) && $payment_field['validator'] != '') {
                 if (function_exists($payment_field['validator'])) {
                     $skip[] = $payment_field['slug'];
                     $data_to_validate = isset($p[$payment_field['slug']]) ? $p[$payment_field['slug']] : '';
                     $validated = call_user_func($payment_field['validator'], $data_to_validate);
                     if (!$validated['valid']) {
                         foreach ($validated['errors'] as $key => $error) {
                             $this->_errors['Payment ' . $payment_field['slug'] . $key] = $error;
                             $this->_jqErrors[] = 'payment-' . $payment_field['slug'];
                         }
                     }
                 }
             }
         }
     }
     foreach ($p as $key => $value) {
         if (!in_array($key, $skip)) {
             $value = trim($value);
             if ($value == '') {
                 $keyName = ucwords(preg_replace('/([A-Z])/', " \$1", $key));
                 $this->_errors['Payment ' . $keyName] = __('Payment ', 'cart66') . $keyName . __(' required', 'cart66');
                 $this->_jqErrors[] = "payment-{$key}";
             }
         }
     }
     if ($p['email'] == '') {
         $this->_errors['Email address'] = __('Email address is required', 'cart66');
         $this->_jqErrors[] = "payment-email";
     }
     if ($p['phone'] == '') {
         $this->_errors['Phone'] = __('Phone number is required', 'cart66');
         $this->_jqErrors[] = "payment-phone";
     }
     if (!Cart66Common::isValidEmail($p['email'])) {
         $this->_errors['Email'] = __("Email address is not valid", "cart66");
         $this->_jqErrors[] = 'payment-email';
     }
     if (Cart66Setting::getValue('checkout_custom_field_display') == 'required' && $p['custom-field'] == '') {
         $this->_errors['Custom Field'] = Cart66Setting::getValue('checkout_custom_field_error_label') ? Cart66Setting::getValue('checkout_custom_field_error_label') : __('The Special Instructions Field is required', 'cart66');
         $this->_jqErrors[] = 'checkout-custom-field-multi';
         $this->_jqErrors[] = 'checkout-custom-field-single';
     }
 }
Beispiel #6
0
 public function initCheckout($total)
 {
     $p = $this->getPayment();
     $b = $this->getBilling();
     Cart66Common::log("Payment info for checkout: " . print_r($p, true));
     // Load gateway url from Cart66 settings
     $gatewayUrl = Cart66Setting::getValue('auth_url');
     $this->gateway_url = $gatewayUrl;
     $b['address2'] = $b['address2'] == "" ? null : $b['address2'];
     $cardData = array('number' => $p['cardNumber'], 'exp_month' => $p['cardExpirationMonth'], 'exp_year' => $p['cardExpirationYear'], 'cvc' => $p['securityId'], 'name' => $b['firstName'] . ' ' . $b['lastName'], 'address_line1' => $b['address'], 'address_line2' => $b['address2'], 'address_zip' => $b['zip'], 'address_state' => $b['state'], 'address_country' => $b['country']);
     $this->params = array('card' => $cardData, 'amount' => number_format($total, 2, '', ''), 'currency' => Cart66Setting::getValue('stripe_currency_code') ? Cart66Setting::getValue('stripe_currency_code') : strtolower(Cart66Setting::getValue('currency_code')), 'description' => '');
 }
 public static function prepareS3Url($bucket, $file, $duration = '5 minutes')
 {
     $awsKeyId = Cart66Setting::getValue('amazons3_id');
     $awsSecretKey = Cart66Setting::getValue('amazons3_key');
     $file = rawurlencode($file);
     $file = str_replace('%2F', '/', $file);
     $path = $bucket . '/' . $file;
     $expires = strtotime("+ {$duration}", current_time('timestamp', 1));
     $stringToSign = self::getStringToSign('GET', $expires, "/{$path}");
     $signature = self::encodeSignature($stringToSign, $awsSecretKey);
     $url = "http://{$bucket}.s3.amazonaws.com/{$file}";
     $url .= '?AWSAccessKeyId=' . $awsKeyId . '&Expires=' . $expires . '&Signature=' . $signature;
     return $url;
 }
 /**
  * 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 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;
 }
Beispiel #10
0
 /**
  * Return the monetary value of the shipping rate or false on failure.
  */
 public function getRate($PostalCode, $dest_zip, $dest_country_code, $service, $weight, $length = 0, $width = 0, $height = 0)
 {
     $setting = new Cart66Setting();
     $countryCode = array_shift(explode('~', Cart66Setting::getValue('home_country')));
     $pickupCode = Cart66Setting::getValue('ups_pickup_code') ? Cart66Setting::getValue('ups_pickup_code') : "03";
     $ResidentialAddressIndicator = Cart66Setting::getValue('ups_only_ship_commercial') ? "" : "\n    <ResidentialAddressIndicator/>";
     if ($this->credentials != 1) {
         print 'Please set your credentials with the setCredentials function';
         die;
     }
     $data = "<?xml version=\"1.0\"?>  \n      <AccessRequest xml:lang=\"en-US\">  \n        <AccessLicenseNumber>" . urlencode(trim($this->AccessLicenseNumber)) . "</AccessLicenseNumber>  \n        <UserId>" . urlencode($this->UserID) . "</UserId>  \n        <Password>" . urlencode($this->Password) . "</Password>  \n      </AccessRequest>  \n      <?xml version=\"1.0\"?>  \n      <RatingServiceSelectionRequest xml:lang=\"en-US\">  \n        <Request>  \n          <TransactionReference>  \n            <CustomerContext>Rating and Service</CustomerContext>  \n            <XpciVersion>1.0001</XpciVersion>  \n          </TransactionReference>  \n          <RequestAction>Rate</RequestAction>  \n          <RequestOption>Rate</RequestOption>  \n        </Request>  \n        <PickupType>  \n          <Code>{$pickupCode}</Code>  \n        </PickupType>  \n        <Shipment>  \n          <Shipper>  \n            <Address>  \n            <PostalCode>{$PostalCode}</PostalCode>  \n            <CountryCode>{$countryCode}</CountryCode>  \n            </Address>  \n            <ShipperNumber>{$this->shipperNumber}</ShipperNumber>  \n          </Shipper>  \n          <ShipTo>  \n            <Address>  \n            <PostalCode>{$dest_zip}</PostalCode>  \n            <CountryCode>{$dest_country_code}</CountryCode>{$ResidentialAddressIndicator}  \n            </Address>  \n          </ShipTo>  \n          <ShipFrom>  \n            <Address>  \n            <PostalCode>{$PostalCode}</PostalCode>  \n            <CountryCode>{$countryCode}</CountryCode>  \n            </Address>  \n          </ShipFrom>  \n          <Service>  \n            <Code>{$service}</Code>  \n          </Service>  \n          <Package>  \n            <PackagingType>  \n            <Code>02</Code>  \n            </PackagingType>  \n            <Dimensions>  \n              <UnitOfMeasurement>  \n                <Code>{$this->dimensionsUnits}</Code>  \n              </UnitOfMeasurement>  \n              <Length>{$length}</Length>  \n              <Width>{$width}</Width>  \n              <Height>{$height}</Height>  \n            </Dimensions>  \n            <PackageWeight>  \n              <UnitOfMeasurement>  \n                <Code>{$this->weightUnits}</Code>  \n              </UnitOfMeasurement>  \n              <Weight>{$weight}</Weight>  \n            </PackageWeight>  \n          </Package>  \n      </Shipment>  \n      </RatingServiceSelectionRequest>";
     $ch = curl_init("https://onlinetools.ups.com/ups.app/xml/Rate");
     curl_setopt($ch, CURLOPT_HEADER, 1);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_TIMEOUT, 60);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     $result = curl_exec($ch);
     $xml = substr($result, strpos($result, '<RatingServiceSelectionResponse'));
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] UPS XML REQUEST: \n{$data}");
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] UPS XML RESULT: \n{$xml}");
     try {
         $xml = new SimpleXmlElement($xml);
     } catch (Exception $e) {
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Cart66 Exception caught when trying to get UPS XML Response: " . $e->getMessage() . " \n");
         $rate = false;
     }
     $responseDescription = $xml->Response->ResponseStatusDescription;
     $errorDescription = $xml->Response->Error->ErrorDescription;
     // Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Response Description: (Service: $service) $responseDescription $errorDescription");
     if ($responseDescription == "Failure") {
         $rate = false;
     } else {
         //$rate = $xml->RatedShipment->RatedPackage->TotalCharges->MonetaryValue;
         $rate = $xml->RatedShipment->TotalCharges->MonetaryValue;
     }
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] RATE ===> {$rate}");
     return $rate;
 }
Beispiel #11
0
 /**
  * Return an array of accepted credit card types where the keys are the diplay values and the values are the gateway values
  * 
  * @return array
  */
 public function getCreditCardTypes()
 {
     $cardTypes = array();
     $setting = new Cart66Setting();
     $cards = Cart66Setting::getValue('auth_card_types');
     if ($cards) {
         $cards = explode('~', $cards);
         if (in_array('mastercard', $cards)) {
             $cardTypes['MasterCard'] = 'mastercard';
         }
         if (in_array('visa', $cards)) {
             $cardTypes['Visa'] = 'visa';
         }
         if (in_array('amex', $cards)) {
             $cardTypes['American Express'] = 'amex';
         }
         if (in_array('discover', $cards)) {
             $cardTypes['Discover'] = 'discover';
         }
     }
     return $cardTypes;
 }
    } elseif (empty($ack)) {
        echo '<pre>Failed to connect via curl to PayPal. The most likely cause is that your PHP installation failed to verify that the CA cert is OK</pre>';
    } else {
        try {
            throw new Cart66Exception(ucwords($response['L_SHORTMESSAGE0']), 66503);
        } catch (Cart66Exception $e) {
            $exception = Cart66Exception::exceptionMessages($e->getCode(), $e->getMessage(), array('Error Number: ' . $response['L_ERRORCODE0'], $response['L_LONGMESSAGE0']));
            echo Cart66Common::getView('views/error-messages.php', $exception);
        }
    }
}
?>

<?php 
if ($settingsOk) {
    ?>
<form action="" method='post' id="paypalexpresscheckout">
  <input type='hidden' name='cart66-action' value='paypalexpresscheckout'>
  <?php 
    $paypalImageUrl = 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif';
    if (CART66_PRO && Cart66Setting::getValue('custom_paypal_express_image')) {
        $paypalImageUrl = Cart66Setting::getValue('custom_paypal_express_image');
    }
    ?>
    <input type="image" id='PayPalExpressCheckoutButton' src="<?php 
    echo $paypalImageUrl;
    ?>
" value="PayPal Express Checkout" name="PayPal Express Checkout" />
</form>
<?php 
}
      $('#product-lifetime_membership').click(function() {
        toggleLifeTime();
      });

      $('#viewLocalDeliverInfo').click(function() {
        $('#localDeliveryInfo').toggle();
        return false;
      });

      $('#amazons3ForceDownload').click(function() {
        $('#amazons3ForceDownloadAnswer').toggle();
        return false;
      });

      <?php 
if (Cart66Setting::getValue('amazons3_id')) {
    ?>
      validateS3BucketName();  
      <?php 
}
?>
      $("#product-s3_bucket, #product-s3_file").blur(function(){
         validateS3BucketName();        
      })
    })
    $(document).on('click', '.delete', function(e) {
      return confirm('Are you sure you want to delete this item?');
    });
    function toggleLifeTime() {
      if($('#product-lifetime_membership').is(':checked')) {
        $('#product-billing_interval').val('');
 public function SetExpressCheckout()
 {
     $this->_requestFields = array('METHOD' => 'SetExpressCheckout', 'PAYMENTACTION' => 'Sale');
     if (!Cart66Setting::getValue('disable_landing_page')) {
         $this->_requestFields['LANDINGPAGE'] = 'Billing';
     }
     if (Cart66Setting::getValue('express_force_paypal')) {
         $this->_requestFields['SOLUTIONTYPE'] = 'Sole';
     }
     $nvp = $this->_buildNvpStr();
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Set Express Checkout Request NVP: " . str_replace('&', "\n", $nvp));
     $result = $this->_decodeNvp($this->_sendRequest($this->_apiEndPoint, $nvp));
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] SetExpressCheckout result: " . print_r($result, true));
     return $result;
 }
    }
}
if (isset($_REQUEST['newsletter'])) {
    if ($_REQUEST['newsletter'] == 1) {
        ?>
  <form action="" method='post' id="newsletter_form" class="phorm2">
    <?php 
        if ($lists) {
            ?>
      <ul id="<?php 
            echo $service_name;
            ?>
">
        <li>
          <?php 
            if (!($optInMessage = Cart66Setting::getValue($service_name . '_opt_in_message'))) {
                $optInMessage = 'Yes, I would like to subscribe to:';
            }
            echo "<p>{$optInMessage}</p>";
            $lists = explode('~', $lists);
            echo '<ul class="Cart66NewsletterList">';
            foreach ($lists as $list) {
                list($id, $name) = explode('::', $list);
                echo "<li><input class=\"Cart66CheckboxList\" type=\"checkbox\" name=\"" . $service_name . "_subscribe_ids[]\" value=\"{$id}\" /> {$name}</li>";
            }
            echo '</ul>';
            ?>
        </li>
      </ul>
    <?php 
        }
Beispiel #16
0
<?php

global $wpdb;
if (!defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}
define("CART66_PATH", plugin_dir_path(__FILE__));
// e.g. /var/www/example.com/wordpress/wp-content/plugins/cart66
require_once CART66_PATH . "/models/Cart66Common.php";
require_once CART66_PATH . "/models/Cart66Setting.php";
if (Cart66Setting::getValue('uninstall_db')) {
    global $wpdb;
    $prefix = $wpdb->prefix . "cart66_";
    $sqlFile = dirname(__FILE__) . "/sql/uninstall.sql";
    $sql = str_replace('[prefix]', $prefix, file_get_contents($sqlFile));
    $queries = explode(";\n", $sql);
    foreach ($queries as $sql) {
        if (strlen($sql) > 5) {
            $wpdb->query($sql);
        }
    }
}
 public function initCheckout($total)
 {
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] PayPal Pro Checkout init total: {$total}");
     $this->setCreditCardData();
     $this->setPayerInfo();
     $this->setPayerName();
     $this->setAddress();
     $this->setShipToAddress();
     // Calculate tax
     $tax = $this->getTaxAmount();
     // Calculate total cost of all items in cart, not including tax and shipping
     $itemSubTotal = Cart66Session::get('Cart66Cart')->getSubTotal() - Cart66Session::get('Cart66Cart')->getDiscountAmount() - Cart66Session::get('Cart66Cart')->getSubscriptionAmount();
     $itemTotal = number_format($itemSubTotal, 2, '.', '');
     $itemTotal = $itemTotal < 0 ? 0 : $itemTotal;
     // Calculate shipping costs
     $shipping = Cart66Session::get('Cart66Cart')->getShippingCost();
     // Set payment information
     // 'NOTIFYURL' => $ipnUrl
     $currencyCode = Cart66Setting::getValue('currency_code');
     if ($currencyCode == false) {
         $currencyCode = 'USD';
     }
     $payment = array('AMT' => $total, 'ITEMAMT' => $itemTotal, 'SHIPPINGAMT' => $shipping, 'TAXAMT' => $tax, 'CURRENCYCODE' => $currencyCode, 'BUTTONSOURCE' => 'Reality66_SP');
     // Add cart items to PayPal
     $items = Cart66Session::get('Cart66Cart')->getItems();
     // An array of Cart66CartItem objects
     foreach ($items as $i) {
         if ($i->isSpreedlySubscription()) {
             $amount = $i->getBaseProductPrice();
         } else {
             $amount = $i->getProductPrice();
         }
         $itemData = array('NAME' => $i->getFullDisplayName(), 'AMT' => $amount, 'NUMBER' => $i->getItemNumber(), 'QTY' => $i->getQuantity());
         $this->addItem($itemData);
     }
     // Add a coupon discount if needed
     $discount = Cart66Session::get('Cart66Cart')->getDiscountAmount();
     if ($discount > 0) {
         $negDiscount = 0 - $discount;
         $itemData = array('NAME' => 'Discount', 'AMT' => $negDiscount, 'NUMBER' => 'DSC', 'QTY' => 1);
         $this->addItem($itemData);
     }
     // Store the shipping price as an "item" if the item total is $0.00. Otherwise paypal will not accept the transaction.
     if ($payment['ITEMAMT'] == 0 && $payment['SHIPPINGAMT'] > 0) {
         $payment['ITEMAMT'] = $payment['SHIPPINGAMT'] + ($itemSubTotal < 0 ? $itemSubTotal : 0);
         $itemData = array('NAME' => 'Shipping', 'AMT' => $payment['SHIPPINGAMT'], 'NUMBER' => 'SHIPPING', 'QTY' => 1);
         $this->addItem($itemData);
         $payment['SHIPPINGAMT'] = 0;
     }
     $this->setPaymentDetails($payment);
 }
Beispiel #18
0
 public function deleteMe($resetInventory = false, $resetRedemptions = false)
 {
     if ($this->id > 0) {
         // Delete attached Gravity Forms if they exist
         $items = $this->getItems();
         foreach ($items as $item) {
             if (!empty($item->form_entry_ids)) {
                 $entryIds = explode(',', $item->form_entry_ids);
                 if (is_array($entryIds)) {
                     foreach ($entryIds as $entryId) {
                         RGFormsModel::delete_lead($entryId);
                     }
                 }
             }
         }
         if ($resetInventory && Cart66Setting::getValue('track_inventory')) {
             $this->resetInventoryForItems();
         }
         if ($resetRedemptions && $this->coupon != 'none') {
             $this->resetRedemptionsForCoupon();
         }
         // Delete order items
         $orderItems = Cart66Common::getTableName('order_items');
         $sql = "DELETE from {$orderItems} where order_id = {$this->id}";
         $this->_db->query($sql);
         // Delete the order
         $sql = "DELETE from {$this->_tableName} where id = {$this->id}";
         $this->_db->query($sql);
     }
 }
 public static function getUpsServices()
 {
     $usaServices = array('UPS Next Day Air' => '01', 'UPS Second Day Air' => '02', 'UPS Ground' => '03', 'UPS Worldwide Express' => '07', 'UPS Worldwide Expedited' => '08', 'UPS Standard' => '11', 'UPS Three-Day Select' => '12', 'UPS Next Day Air Early A.M.' => '14', 'UPS Worldwide Express Plus' => '54', 'UPS Second Day Air A.M.' => '59', 'UPS Saver' => '65');
     $internationalServices = array('UPS Express' => '01', 'UPS Expedited' => '02', 'UPS Worldwide Express' => '07', 'UPS Worldwide Expedited' => '08', 'UPS Standard' => '11', 'UPS Three-Day Select' => '12', 'UPS Saver' => '13', 'UPS Express Early A.M.' => '14', 'UPS Worldwide Express Plus' => '54', 'UPS Saver' => '65');
     $homeCountryCode = 'US';
     $setting = new Cart66Setting();
     $home = Cart66Setting::getValue('home_country');
     if ($home) {
         list($homeCountryCode, $name) = explode('~', $home);
     }
     $services = $homeCountryCode == 'US' ? $usaServices : $internationalServices;
     return $services;
 }
<?php

$subject = Cart66Setting::getValue('reminder_subject');
$subId = $data[0];
$html = $data[1];
$test = $data[2];
if (!$test) {
    if ($html) {
        $sub = new Cart66AccountSubscription($subId);
        $account = new Cart66Account($sub->account_id);
        $reminderId = $data[3];
        $reminder = new Cart66MembershipReminders($reminderId);
        ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <title><?php 
        echo $subject;
        ?>
</title>
      <style type="text/css">
        .ExternalClass {width:100%;}
        .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}
        body {-webkit-text-size-adjust:none; -ms-text-size-adjust:none;}
        body {margin:0; padding:0;}
        table td {border-collapse:collapse;}
        p {margin:0; padding:0; margin-bottom:0;}
        h1, h2, h3, h4, h5, h6 {
          color: black; 
          line-height: 100%; 
<?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);
Beispiel #22
0
        ?>
          </td>
        </tr>
      </table>
      <?php 
    } else {
        echo '<p>' . __('You have not yet created any products', 'cart66') . '.</p>';
    }
} else {
    echo '<p>' . __('Product sales reports are only available in <a href="http://cart66.com">Cart66 Professional</a>', 'cart66') . '</p>';
}
?>

<div class="cart66-product-report-pagination">
<?php 
if (Cart66Setting::getValue('page_product_report')) {
    ?>
        
  <?php 
    if ($productPageStart > 0) {
        ?>
    <a href="admin.php?page=cart66-reports">First <?php 
        echo $productPageInterval;
        ?>
 Products</a>
    &nbsp;&nbsp;&nbsp;
    <a href="admin.php?page=cart66-reports&amp;start=<?php 
        echo $productPageStart - $productPageInterval - 1;
        ?>
">Previous <?php 
        echo $productPageInterval;
    ?>
        <li>
          <label for="payment-phone"><?php 
    _e('Phone', 'cart66');
    ?>
:</label>
          <input type="text" id="payment-phone" name="payment[phone]" value="<?php 
    Cart66Common::showValue($p['phone']);
    ?>
">
        </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');
 public function getLists()
 {
     $MailChimp = new Cart66MailChimp();
     $api_key = Cart66Setting::getValue('mailchimp_apikey');
     $api = $MailChimp->MCAPI($api_key);
     $retval = $MailChimp->lists();
     $output = "";
     if (empty($retval)) {
         $output = "Unable to load lists!";
         $output .= "\n\tCode=" . $api->errorCode;
         $output .= "\n\tMsg=" . $api->errorMessage . "\n";
     } else {
         $output = $retval['data'];
     }
     return $output;
 }
 protected function _buildCheckoutView($gateway)
 {
     $ssl = Cart66Setting::getValue('auth_force_ssl');
     if ($ssl) {
         if (!Cart66Common::isHttps()) {
             $sslUrl = "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
             wp_redirect($sslUrl);
             exit;
         }
     }
     if (!Cart66Session::get('Cart66Cart')->requirePayment()) {
         require_once CART66_PATH . "/gateways/Cart66ManualGateway.php";
         $gateway = new Cart66ManualGateway();
     }
     $view = Cart66Common::getView('views/checkout.php', array('gateway' => $gateway), true, true);
     return $view;
 }
Beispiel #26
0
    $product->updateInventoryFromPost($_REQUEST);
    ?>
  <script type="text/javascript">
    (function($){
      $(document).ready(function(){
        $("#Cart66SuccessBox").show().delay(1000).fadeOut('slow'); 
      })
    })(jQuery);
  </script> 
  <div id='Cart66SuccessBox' style='width: 300px;'><p class='alert-message success'><?php 
    _e('Inventory updated', 'cart66');
    ?>
</p></div>
  <?php 
}
$setting = new Cart66Setting();
$track = Cart66Setting::getValue('track_inventory');
$wpurl = get_bloginfo('wpurl');
if (CART66_PRO) {
    require_once CART66_PATH . "/pro/admin/inventory.php";
} else {
    ?>
 <p class="description"><?php 
    _e('Inventory functionality is only available in', 'cart66');
    ?>
 <a href='http://cart66.com'><?php 
    _e('Cart66 Professional', 'cart66');
    ?>
</a></p>
<?php 
}
Beispiel #27
0
    <form id="orderNumberActivation" method="post">
      <input type="hidden" name="cart66-action" value="saveOrderNumber" id="saveOrderNumber">
      <h3><?php 
    _e('Order Number', 'cart66');
    ?>
</h3>
      <table class="form-table cart66-settings-table">
        <tbody>
          <tr valign="top">
            <th scope="row"><?php 
    _e('Activation', 'cart66');
    ?>
</th>
            <td>
              <input type="password" name="order_number" id="orderNumber" value="<?php 
    echo Cart66Setting::getValue('order_number');
    ?>
" />
              <p class="description"><?php 
    _e('Please enter your Cart66 order number to get automatic upgrades and support.', 'cart66');
    ?>
                <br /><?php 
    _e('If you do not have an order number please', 'cart66');
    ?>
 <a href="http://www.Cart66.com"><?php 
    _e('buy a license', 'cart66');
    ?>
</a></p>
            </td>
          </tr>
          <tr valign="top">
Beispiel #28
0
      $('#usps_select_all').click(function() {
        $('.usps_shipping_options').attr('checked', true);
        return false;
      });
      
      $('#ups_pickup_code').val("<?php 
echo Cart66Setting::getValue('ups_pickup_code');
?>
");
      $('#fedex_pickup_code').val("<?php 
echo Cart66Setting::getValue('fedex_pickup_code');
?>
");
      $('#fedex_location_type').val("<?php 
echo Cart66Setting::getValue('fedex_location_type');
?>
");
      
      $('#fedex_clear_all').click(function() {
        $('.fedex_shipping_options').attr('checked', false);
        return false;
      });

      $('#fedex_select_all').click(function() {
        $('.fedex_shipping_options').attr('checked', true);
        return false;
      });
      
      $('#aupost_clear_all').click(function() {
        $('.aupost_shipping_options').attr('checked', false);
Beispiel #29
0
        <?php 
    if (!empty($p)) {
        ?>
          initializeCart66CodeMirror('fulfillment');
        <?php 
    }
    ?>
        <?php 
    if (!empty($subscriptions)) {
        ?>
        initializeCart66CodeMirror('reminder');
        <?php 
    }
    ?>
        <?php 
    $opts = explode(',', Cart66Setting::getValue('status_options'));
    foreach ($opts as $o) {
        $o = str_replace(' ', '_', trim($o));
        if (!empty($o)) {
            ?>
            initializeCart66CodeMirror('<?php 
            echo $o;
            ?>
');
          <?php 
        }
        ?>
        <?php 
    }
    ?>
        function copyBlock(blockName){
Beispiel #30
0
 public function Cart66Help()
 {
     $setting = new Cart66Setting();
     define('HELP_URL', "http://www.cart66.com/cart66-help/?order_number=" . Cart66Setting::getValue('order_number'));
     $view = Cart66Common::getView('admin/help.php');
     echo $view;
 }