コード例 #1
0
<?php

if (!isset($s)) {
    $s = array('firstName' => '', 'lastName' => '', 'address' => '', 'address2' => '', 'city' => '', 'state' => '', 'zip' => '', 'country' => '', 'phone' => '');
}
if (!isset($s['phone'])) {
    $s['phone'] = '';
}
if (!isset($shippingCountryCode)) {
    $shippingCountryCode = 'US';
}
if (empty($b['country'])) {
    $b['country'] = Cart66Common::getHomeCountryCode();
}
$cart = Cart66Session::get('Cart66Cart');
if ($cart->requireShipping() || $cart->hasTaxableProducts()) {
    ?>

    <form action="" method='post' id="mijireh_shipping_form" class="phorm2
      <?php 
    // Apply CSS classes for mailing lists
    if ($lists = Cart66Setting::getValue('constantcontact_list_ids')) {
        echo ' constantcontact';
    } elseif ($lists = Cart66Setting::getValue('mailchimp_list_ids')) {
        echo ' mailchimp';
    }
    // Apply CSS class for subscription products
    if (Cart66Session::get('Cart66Cart')->hasSubscriptionProducts() || Cart66Session::get('Cart66Cart')->hasMembershipProducts()) {
        echo ' subscription';
    }
    ?>
コード例 #2
0
ファイル: checkout.php プロジェクト: rbredow/allyzabbacart
    Cart66Session::drop('Cart66InventoryWarning');
}
// Build checkout form action URL
$checkoutPage = get_page_by_path('store/checkout');
$ssl = Cart66Setting::getValue('auth_force_ssl');
$url = get_permalink($checkoutPage->ID);
if (Cart66Common::isHttps()) {
    $url = str_replace('http:', 'https:', $url);
}
// Make it easier to get to payment, billing, and shipping data
$p = $gateway->getPayment();
$b = $gateway->getBilling();
$s = $gateway->getShipping();
// Set initial country codes for billing and shipping addresses
$billingCountryCode = isset($b['country']) && !empty($b['country']) ? $b['country'] : Cart66Common::getHomeCountryCode();
$shippingCountryCode = isset($s['country']) && !empty($s['country']) ? $s['country'] : Cart66Common::getHomeCountryCode();
// Include the HTML markup for the checkout form
$checkoutFormFile = CART66_PATH . '/views/checkout-form.php';
if ($gatewayName == 'Cart66Mijireh') {
    $checkoutFormFile = CART66_PATH . '/views/mijireh/shipping_address.php';
} elseif ($gatewayName == 'Cart662Checkout') {
    $checkoutFormFile = CART66_PATH . '/views/2checkout.php';
} else {
    $userViewFile = get_stylesheet_directory() . '/cart66-templates/views/checkout-form.php';
    if (file_exists($userViewFile) && filesize($userViewFile) > 10 && CART66_PRO && Cart66Common::isRegistered()) {
        $checkoutFormFile = $userViewFile;
    }
}
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Using Checkout Form File :: {$checkoutFormFile}");
ob_start();
include $checkoutFormFile;
コード例 #3
0
 public function getLiveRates()
 {
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Call to getLiveRates");
     if (!CART66_PRO) {
         return false;
     }
     $weight = Cart66Session::get('Cart66Cart')->getCartWeight();
     $zip = Cart66Session::get('cart66_shipping_zip') ? Cart66Session::get('cart66_shipping_zip') : false;
     $countryCode = Cart66Session::get('cart66_shipping_country_code') ? Cart66Session::get('cart66_shipping_country_code') : Cart66Common::getHomeCountryCode();
     // Make sure _liveRates is a Cart66LiveRates object
     if (get_class($this->_liveRates) != 'Cart66LiveRates') {
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] WARNING: \$this->_liveRates is not a Cart66LiveRates object so we're making it one now.");
         $this->_liveRates = new Cart66LiveRates();
     }
     // Return the live rates from the session if the zip, country code, and cart weight are the same
     if (Cart66Session::get('Cart66LiveRates') && get_class($this->_liveRates) == 'Cart66LiveRates') {
         $cartWeight = $this->getCartWeight();
         $this->_liveRates = Cart66Session::get('Cart66LiveRates');
         $liveWeight = $this->_liveRates->weight;
         $liveZip = $this->_liveRates->toZip;
         $liveCountry = $this->_liveRates->getToCountryCode();
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] \n        {$liveWeight} == {$weight}\n        {$liveZip} == {$zip}\n        {$liveCountry} == {$countryCode}\n      ");
         if ($this->_liveRates->weight == $weight && $this->_liveRates->toZip == $zip && $this->_liveRates->getToCountryCode() == $countryCode) {
             Cart66Common::log("Using Live Rates from the session: " . $this->_liveRates->getSelected()->getService());
             return Cart66Session::get('Cart66LiveRates');
         }
     }
     if ($this->getCartWeight() > 0 && Cart66Session::get('cart66_shipping_zip') && Cart66Session::get('cart66_shipping_country_code')) {
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Clearing current live shipping rates and recalculating new rates.");
         $this->_liveRates->clearRates();
         $this->_liveRates->weight = $weight;
         $this->_liveRates->toZip = $zip;
         $method = new Cart66ShippingMethod();
         // Get USPS shipping rates
         if (Cart66Setting::getValue('usps_username')) {
             $this->_liveRates->setToCountryCode($countryCode);
             $rates = $countryCode == 'US' ? $this->getUspsRates() : $this->getUspsIntlRates($countryCode);
             $uspsServices = $method->getServicesForCarrier('usps');
             foreach ($rates as $name => $price) {
                 $price = number_format($price, 2, '.', '');
                 if (in_array($name, $uspsServices)) {
                     $this->_liveRates->addRate('USPS', 'USPS ' . $name, $price);
                 }
             }
         }
         // Get UPS Live Shipping Rates
         if (Cart66Setting::getValue('ups_apikey')) {
             $rates = $this->getUpsRates();
             foreach ($rates as $name => $price) {
                 $this->_liveRates->addRate('UPS', $name, $price);
             }
         }
         // Get FedEx Live Shipping Rates
         if (Cart66Setting::getValue('fedex_developer_key')) {
             $this->_liveRates->setToCountryCode($countryCode);
             $rates = $this->getFedexRates();
             foreach ($rates as $name => $price) {
                 $this->_liveRates->addRate('FedEx', $name, $price);
             }
         }
         // Get Australia Post Live Shipping Rates
         if (Cart66Setting::getValue('aupost_developer_key')) {
             $this->_liveRates->setToCountryCode($countryCode);
             $rates = $this->getAuPostRates();
             foreach ($rates as $name => $price) {
                 $this->_liveRates->addRate('Australia Post', $name, $price);
             }
         }
         // Get Canada Post Live Shipping Rates
         if (Cart66Setting::getValue('capost_merchant_id') || Cart66Setting::getValue('capost_username')) {
             $this->_liveRates->setToCountryCode($countryCode);
             $rates = $this->getCaPostRates();
             foreach ($rates as $name => $price) {
                 $this->_liveRates->addRate('Canada Post', $name, $price);
             }
         }
         if (Cart66Setting::getValue('shipping_local_pickup')) {
             $this->_liveRates->addRate('Local Pickup', Cart66Setting::getValue('shipping_local_pickup_label'), number_format(Cart66Setting::getValue('shipping_local_pickup_amount'), 2));
         }
     } else {
         $this->_liveRates->clearRates();
         $this->_liveRates->weight = 0;
         $this->_liveRates->toZip = $zip;
         $this->_liveRates->setToCountryCode($countryCode);
         $this->_liveRates->addRate('SYSTEM', 'Free Shipping', '0.00');
     }
     Cart66Session::set('Cart66LiveRates', $this->_liveRates);
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Dump live rates: " . print_r($this->_liveRates, true));
     return $this->_liveRates;
 }
コード例 #4
0
ファイル: cart.php プロジェクト: rbredow/allyzabbacart
                <?php 
                    $customCountries = Cart66Common::getCustomCountries();
                    foreach ($customCountries as $code => $name) {
                        $selected_country = '';
                        if ($code == Cart66Session::get('Cart66ShippingCountryCode')) {
                            $selected_country = ' selected="selected"';
                        }
                        echo "<option value='{$code}'{$selected_country}>{$name}</option>\n";
                    }
                    ?>
              </select>
            <?php 
                } else {
                    ?>
              <input type="hidden" name="shipping_country_code" value="<?php 
                    echo Cart66Common::getHomeCountryCode();
                    ?>
" id="shipping_country_code">
            <?php 
                }
                ?>
            <select name="shipping_method_id" id="shipping_method_id">
              <?php 
                foreach ($shippingMethods as $name => $id) {
                    ?>
                <?php 
                    $method_class = 'methods-country ';
                    $method = new Cart66ShippingMethod($id);
                    $methods = unserialize($method->countries);
                    if (is_array($methods)) {
                        foreach ($methods as $code => $country) {
コード例 #5
0
 public function getToCountryCode()
 {
     if (empty($this->_toCountryCode)) {
         $this->_toCountryCode = Cart66Common::getHomeCountryCode();
     }
     return $this->_toCountryCode;
 }