Enterprise3.01 > Checkout Shipping.php

Questions? Need Help? Want to share? » PHP Forum
Script Name:
Enterprise3.01

Download:
enterprise3.01.zip

Category:
E Commerce

Archive Content:

Content:

Admin

Admin > Htmlarea

Admin > Htmlarea > Images

Admin > Htmlarea > Popups

Admin > Htmlarea > Popups > File

Admin > Htmlarea > Popups > File > Icons

Admin > Htmlarea > Popups > File > Images

Admin > Images

Admin > Images > Categories

Admin > Images > Graphs

Admin > Images > Icons

Admin > Includes

Admin > Includes > Boxes

Admin > Includes > Classes

Admin > Includes > Functions

Admin > Includes > Graphs

Admin > Includes > Javascript

Admin > Includes > Javascript > SpiffyCal

Admin > Includes > Javascript > SpiffyCal > Images

Admin > Includes > Languages

Admin > Includes > Languages > English

Admin > Includes > Languages > English > CVS

Admin > Includes > Languages > English > Images > Buttons

Admin > Includes > Languages > English > Images > Buttons > CVS

Admin > Includes > Languages > English > Images > Copy Of Buttons

Admin > Includes > Languages > English > Images > Copy Of Buttons > CVS

Admin > Includes > Languages > English > Images > CVS

Admin > Includes > Languages > English > Modules > Newsletters

Admin > Includes > Languages > Espanol

Admin > Includes > Languages > Espanol > CVS

Admin > Includes > Languages > Espanol > Images > Buttons

Admin > Includes > Languages > Espanol > Images > Buttons > CVS

Admin > Includes > Languages > Espanol > Images > CVS

Admin > Includes > Languages > Espanol > Modules > Newsletters

Admin > Includes > Languages > German

Admin > Includes > Languages > German > CVS

Admin > Includes > Languages > German > Images > Buttons

Admin > Includes > Languages > German > Images > Buttons > CVS

Admin > Includes > Languages > German > Images > CVS

Admin > Includes > Languages > German > Modules > Newsletters

Admin > Includes > Local

Admin > Includes > Modules > Newsletters

Admin > Live Support

Admin > Live Support > Blue

Admin > Live Support > Green

Admin > Live Support > Red

Admin > Live Support > White

Admin > Live Support > Yellow

Download

Images

Images > Banners

Images > Default

Images > Icons

Images > Infobox

Images > Mail

Includes

Includes > Boxes

Includes > Classes

Includes > Color Schemes > 1

Includes > Color Schemes > 10

Includes > Color Schemes > 11

Includes > Color Schemes > 12

Includes > Color Schemes > 2

Includes > Color Schemes > 3

Includes > Color Schemes > 4

Includes > Color Schemes > 5

Includes > Color Schemes > 6

Includes > Color Schemes > 7

Includes > Color Schemes > 8

Includes > Color Schemes > 9

Includes > Functions

Includes > Javascript

Includes > Languages

Includes > Languages > English

Includes > Languages > English > CVS

Includes > Languages > English > Images

Includes > Languages > English > Images > Buttons

Includes > Languages > English > Images > Buttons > CVS

Includes > Languages > English > Images > CVS

Includes > Languages > English > Modules > Order Total

Includes > Languages > English > Modules > Payment

Includes > Languages > English > Modules > Shipping

Includes > Languages > Espanol

Includes > Languages > Espanol > CVS

Includes > Languages > Espanol > Images

Includes > Languages > Espanol > Images > Buttons

Includes > Languages > Espanol > Images > Buttons > CVS

Includes > Languages > Espanol > Images > CVS

Includes > Languages > Espanol > Modules > Order Total

Includes > Languages > Espanol > Modules > Payment

Includes > Languages > Espanol > Modules > Shipping

Includes > Languages > French

Includes > Languages > French > Images > Buttons

Includes > Languages > French > Modules > Payment

Includes > Languages > German

Includes > Languages > German > CVS

Includes > Languages > German > Images

Includes > Languages > German > Images > Buttons

Includes > Languages > German > Images > Buttons > CVS

Includes > Languages > German > Images > CVS

Includes > Languages > German > Modules > Order Total

Includes > Languages > German > Modules > Payment

Includes > Languages > German > Modules > Shipping

Includes > Local

Includes > Modules

Includes > Modules > Order Total

Includes > Modules > Payment

Includes > Modules > Shipping

Install

Install > Images

Install > Images > Layout

Install > Includes

Install > Includes > Functions

Install > Templates

Install > Templates > Main Page

Install > Templates > Pages

Live Support

Live Support > Blue

Live Support > Green

Live Support > Red

Live Support > White

Live Support > Yellow

Members

Members > Cashhub

Members > Cashhub > Images

Members > User

Members > User > Test Dir

Templates

Templates > Content

Checkout Shipping.php:


<?php
/*
  $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  Enterprise Shopping Cart
  http://www.enterprisecart.com

  Copyright (c) 2004 Enterprise Shopping Cart Software.  Portions Copyright (c) 2001-2004 osCommerce: http://www.oscommerce.com

  Released under the GNU General Public License
*/

  
require('includes/application_top.php');
  require(
'includes/classes/http_client.php');

// BOF: WebMakers.com Added: Downloads Controller - Free Shipping
// Reset $shipping if free shipping is on and weight is not 0
if (escs_get_configuration_key_value('MODULE_SHIPPING_FREESHIPPER_STATUS') and $cart->show_weight()!=0) {
  
escs_session_unregister('shipping');
}
// EOF: WebMakers.com Added: Downloads Controller - Free Shipping

// BOF: Individual Shipping
if (escs_get_configuration_key_value('MODULE_SHIPPING_INDVSHIP_STATUS') and $shiptotal) {
  
escs_session_unregister('shipping');
}
// EOF: Individual Shipping

// if the customer is not logged on,  redirect them to the login page
  
if (!escs_session_is_registered('customer_id')) {
    
$navigation->set_snapshot();
    
escs_redirect(escs_href_link(FILENAME_LOGIN,  '',  'SSL'));
  }

// if there is nothing in the customers cart,  redirect them to the shopping cart page
  
if ($cart->count_contents() < 1) {
    
escs_redirect(escs_href_link(FILENAME_SHOPPING_CART));
  }

// if no shipping destination address was selected,  use the customers own address as default
  
if (!escs_session_is_registered('sendto')) {
    
escs_session_register('sendto');
    
$sendto $customer_default_address_id;
  } else {
// verify the selected shipping address
    
$check_address_query escs_db_query("select count(*) as total from " TABLE_ADDRESS_BOOK " where customers_id = '" . (int)$customer_id "' and address_book_id = '" . (int)$sendto "'");
    
$check_address escs_db_fetch_array($check_address_query);

    if (
$check_address['total'] != '1') {
      
$sendto $customer_default_address_id;
      if (
escs_session_is_registered('shipping')) escs_session_unregister('shipping');
    }
  }

  require(
DIR_WS_CLASSES 'order.php');
  
$order = new order;

// register a random ID in the session to check throughout the checkout procedure
// against alterations in the shopping cart contents
  
if (!escs_session_is_registered('cartID')) escs_session_register('cartID');
  
$cartID $cart->cartID;

// if the order contains only virtual products,  forward the customer to the billing page as
// a shipping address is not needed
  
if (($order->content_type == 'virtual') || ($order->content_type == 'virtual_weight')) {
    if (!
escs_session_is_registered('shipping')) escs_session_register('shipping');
    
$shipping false;
    
$sendto false;
    
escs_redirect(escs_href_link(FILENAME_CHECKOUT_PAYMENT,  '',  'SSL'));
  }

  
$total_weight $cart->show_weight();
  
$total_count $cart->count_contents();

// load all enabled shipping modules
  
require(DIR_WS_CLASSES 'shipping.php');
  
$shipping_modules = new shipping;

  if ( 
defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') ) {
    
$pass false;

    switch (
MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
      case 
'national':
        if (
$order->delivery['country_id'] == STORE_COUNTRY) {
          
$pass true;
        }
        break;
      case 
'international':
        if (
$order->delivery['country_id'] != STORE_COUNTRY) {
          
$pass true;
        }
        break;
      case 
'both':
        
$pass true;
        break;
    }

    
$free_shipping false;
    if ( (
$pass == true) && ($order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
      
$free_shipping true;

      include(
DIR_WS_LANGUAGES $language '/modules/order_total/ot_shipping.php');
    }
  } else {
    
$free_shipping false;
  }

// process the selected shipping method
  
if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') ) {
    if (!
escs_session_is_registered('comments')) escs_session_register('comments');
    if (
escs_not_null($HTTP_POST_VARS['comments'])) {
      
$comments escs_db_prepare_input($HTTP_POST_VARS['comments']);
    }

    if (!
escs_session_is_registered('shipping')) escs_session_register('shipping');

    if ( (
escs_count_shipping_modules() > 0) || ($free_shipping == true) ) {
      if ( (isset(
$HTTP_POST_VARS['shipping'])) && (strpos($HTTP_POST_VARS['shipping'],  '_')) ) {
        
$shipping $HTTP_POST_VARS['shipping'];

        list(
$module,  $method) = explode('_',  $shipping);
        if ( 
is_object($$module) || ($shipping == 'free_free') ) {
          if (
$shipping == 'free_free') {
            
$quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
            
$quote[0]['methods'][0]['cost'] = '0';
          } else {
            
$quote $shipping_modules->quote($method,  $module);
          }
          if (isset(
$quote['error'])) {
            
escs_session_unregister('shipping');
          } else {
            if ( (isset(
$quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {
              
$shipping = array('id' => $shipping,
                                
'title' => (($free_shipping == true) ?  $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' $quote[0]['methods'][0]['title'] . ')'),
                                
'cost' => $quote[0]['methods'][0]['cost']);

              
escs_redirect(escs_href_link(FILENAME_CHECKOUT_PAYMENT,  '',  'SSL'));
            }
          }
        } else {
          
escs_session_unregister('shipping');
        }
      }
    } else {
      
$shipping false;

      
escs_redirect(escs_href_link(FILENAME_CHECKOUT_PAYMENT,  '',  'SSL'));
    }
  }

// get all available shipping quotes
  
$quotes $shipping_modules->quote();

// if no shipping method has been selected,  automatically select the cheapest method.
// if the modules status was changed when none were available,  to save on implementing
// a javascript force-selection method,  also automatically select the cheapest shipping
// method if more than one module is now enabled
  
if ( !escs_session_is_registered('shipping') || ( escs_session_is_registered('shipping') && ($shipping == false) && (escs_count_shipping_modules() > 1) ) ) $shipping $shipping_modules->cheapest();

  require(
DIR_WS_LANGUAGES $language '/' FILENAME_CHECKOUT_SHIPPING);

  
$breadcrumb->add(NAVBAR_TITLE_1,  escs_href_link(FILENAME_CHECKOUT_SHIPPING,  '',  'SSL'));
  
$breadcrumb->add(NAVBAR_TITLE_2,  escs_href_link(FILENAME_CHECKOUT_SHIPPING,  '',  'SSL'));

  
$content CONTENT_CHECKOUT_SHIPPING;
  
$javascript $content '.js';

  require(
DIR_WS_TEMPLATES TEMPLATENAME_MAIN_PAGE);

  require(
DIR_WS_INCLUDES 'application_bottom.php');
?>



Other E Commerce Scripts:

WebMaster Resources Home

©RingsWorld.com