Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Ship In Cart v2.2.2b Shipping Estimator for Cart


Guest

Recommended Posts

Okay, let me start out by saying my website is an osCommerce-based custom shop. I recently decided to install an in-cart shipping estimator contribution (Ship In Cart v 2.2.2b) to help cut down on the number of "sample" orders. I installed it according to the instructions and moderately customized its appearance to match my shop's. However, the problem that has persisted is that the order total part of the contribution conflicts with my shop's code.

 

1. Enabling order total cuts off the right infobox navigation and footer. Basically everything following the checkout button.

2. Disabling order total in Admin gets rid of the problem (not really, it just hides it).

3. I'm thinking it is probably some conflicting php code in the contribution's /includes/modules/shipping_estimator.php file.

 

In addition to this more obvious problem, I also face another: the update button to load shipping quotes on the cart page does not function. Clicking it just sends you to index.php (homepage). Quotes are loaded when the user is logged in, but clicking on the different shipping options doesn't select them. The W3C Validator does complain over the placement of the contribution's <form> tags within the cart page's <form> tags (at least that's why I think it complains). I am not sure if this could be the root of this particular problem or not.

 

So how does this sound? I have tried guess checking my way through this, but I feel stumped. Is this something I should pay someone to fix for me? Is there a better contribution out there? I have included the two conflicting files below for reference along with sectional search queries.

 

/includes/modules/shipping_estimator.php (search "if (CARTSHIP_SHOWOT == 'true'){")

 

<?php
/*
 $Id: shipping_estimator.php,v 2.20 2004/07/01 15:16:07 eml Exp $

 v2.00 by Acheron + installed Fix for v2.0 and all other versions Acheron 7 Jul 2004
 (see Install.txt for partial version history)

 Copyright (c) 2004

 Released under the GNU General Public License

+ installed Fix for v2.0 and all other versions Acheron 7 Jul 2004 
*/
?>
<!-- shipping_estimator //-->
<script type="text/javascript" language="JavaScript">
 function shipincart_submit(sid){
   if(sid){
     document.estimator.sid.value=sid;
   }
   document.estimator.submit();
   return false;
 }
</script>
             <table align="center"><tr valign="top"><td>

<?php

 require(DIR_WS_LANGUAGES . $language . '/modules/' . FILENAME_SHIPPING_ESTIMATOR);

if (($cart->count_contents() > 0)) {

 // shipping cost
 require('includes/classes/http_client.php'); // shipping in basket

 //if($cart->get_content_type() !== 'virtual') {
   if (tep_session_is_registered('customer_id')) {
     // user is logged in
     if (isset($HTTP_POST_VARS['address_id'])){
       // user changed address
       $sendto = $HTTP_POST_VARS['address_id'];
     }elseif (tep_session_is_registered('cart_address_id')){
       // user once changed address
       $sendto = $HTTP_POST_VARS['cart_address_id'];
     }else{
       // first timer
       $sendto = $HTTP_POST_VARS['customer_default_address_id'];
     }
     // set session now
     $cart_address_id = $sendto;

     tep_session_register('cart_address_id');
     // set shipping to null ! multipickup changes address to store address...
     $shipping='';
     // include the order class (uses the sendto !)
     require(DIR_WS_CLASSES . 'order.php');
     $order = new order;
   }else{
// user not logged in !
     if (isset($HTTP_POST_VARS['country_id'])){
       // country is selected
       $country_info = tep_get_countries($HTTP_POST_VARS['country_id'],true);
       $cache_state_prov_values = tep_db_fetch_array(tep_db_query("select zone_code from " . TABLE_ZONES . " where zone_country_id = '" . $HTTP_POST_VARS['country_id'] . "' and zone_id = '" . $HTTP_POST_VARS['state'] . "'"));
       $cache_state_prov_code = $cache_state_prov_values['zone_code'];
       $order->delivery = array('postcode' => $HTTP_POST_VARS['zip_code'],
                                'state' => $cache_state_prov_code,
                                'country' => array('id' => $HTTP_POST_VARS['country_id'], 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' =>  $country_info['countries_iso_code_3']),
                                'country_id' => $HTTP_POST_VARS['country_id'],
//add state zone_id
                                'zone_id' => $HTTP_POST_VARS['state'],
                                'format_id' => tep_get_address_format_id($HTTP_POST_VARS['country_id']));
       $cart_country_id = $HTTP_POST_VARS['country_id'];
       tep_session_register('cart_country_id');
//add state zone_id
       $cart_zone = $HTTP_POST_VARS['zone_id'];
       tep_session_register('cart_zone');
       $cart_zip_code = $HTTP_POST_VARS['zip_code'];
       tep_session_register('cart_zip_code');
     }elseif (tep_session_is_registered('cart_country_id')){
       // session is available
       $country_info = tep_get_countries($cart_country_id,true);
       $order->delivery = array('postcode' => $cart_zip_code,
                                'country' => array('id' => $cart_country_id, 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' =>  $country_info['countries_iso_code_3']),
                                'country_id' => $cart_country_id,
                                'format_id' => tep_get_address_format_id($cart_country_id));
     } else {
       // first timer
       $cart_country_id = STORE_COUNTRY;
       tep_session_register('cart_country_id');
       $country_info = tep_get_countries(STORE_COUNTRY,true);
       tep_session_register('cart_zip_code');
       $order->delivery = array(//'postcode' => '',
                                'country' => array('id' => STORE_COUNTRY, 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' =>  $country_info['countries_iso_code_3']),
                                'country_id' => STORE_COUNTRY,
                                'format_id' => tep_get_address_format_id($HTTP_POST_VARS['country_id']));
     }
     // set the cost to be able to calculate free shipping
     $order->info = array('total' => $cart->show_total(), // TAX ????
                          'currency' => $currency,
                          'currency_value'=> $currencies->currencies[$currency]['value']);
   }
// weight and count needed for shipping
   $total_weight = $cart->show_weight();
   $total_count = $cart->count_contents();
   require(DIR_WS_CLASSES . 'shipping.php');
   $shipping_modules = new shipping;
   $quotes = $shipping_modules->quote();
   $order->info['subtotal'] = $cart->total;

// set selections for displaying
   $selected_country = $order->delivery['country']['id'];
   $selected_address = $sendto;
 //}
// eo shipping cost

 // check free shipping based on order total
 if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true')) {
   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;
     default:
       $pass = false; 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;
 }
 // begin shipping cost
 if(!$free_shipping && $cart->get_content_type() !== 'virtual'){
   if (tep_not_null($HTTP_POST_VARS['sid'])){
     list($module, $method) = explode('_', $HTTP_POST_VARS['sid']);
     $cart_sid = $HTTP_POST_VARS['sid'];
     tep_session_register('cart_sid');
   }elseif (tep_session_is_registered('cart_sid')){
     list($module, $method) = explode('_', $cart_sid);
   }else{
     $module="";
     $method="";
   }
   if (tep_not_null($module)){
     $selected_quote = $shipping_modules->quote($method, $module);
     if($selected_quote[0]['error'] || !tep_not_null($selected_quote[0]['methods'][0]['cost'])){
       $selected_shipping = $shipping_modules->cheapest();
       $order->info['shipping_method'] = $selected_shipping['title'];
       $order->info['shipping_cost'] = $selected_shipping['cost'];
       $order->info['total']+= $selected_shipping['cost'];
     }else{
       $order->info['shipping_method'] = $selected_quote[0]['module'].' ('.$selected_quote[0]['methods'][0]['title'].')';
       $order->info['shipping_cost'] = $selected_quote[0]['methods'][0]['cost'];
       $order->info['total']+= $selected_quote[0]['methods'][0]['cost'];
       $selected_shipping['title'] = $order->info['shipping_method'];
       $selected_shipping['cost'] = $order->info['shipping_cost'];
       $selected_shipping['id'] = $selected_quote[0]['id'].'_'.$selected_quote[0]['methods'][0]['id'];
     }
   }else{
     $selected_shipping = $shipping_modules->cheapest();
     $order->info['shipping_method'] = $selected_shipping['title'];
     $order->info['shipping_cost'] = $selected_shipping['cost'];
     $order->info['total']+= $selected_shipping['cost'];
   }
 }
// virtual products use free shipping
 if($cart->get_content_type() == 'virtual') {
   $order->info['shipping_method'] = CART_SHIPPING_METHOD_FREE_TEXT . ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS;
   $order->info['shipping_cost'] = 0;
 }
 if($free_shipping) {
   $order->info['shipping_method'] = MODULE_ORDER_TOTAL_SHIPPING_TITLE;
   $order->info['shipping_cost'] = 0;
 }
 $shipping=$selected_shipping;
// end of shipping cost
// end free shipping based on order total

 //$info_box_contents = array();
 //$info_box_contents[] = array('text' => '<strong>' . CART_SHIPPING_OPTIONS . '</strong>'); // azer for 2.20 cosmetic change
 //new infoBoxHeading($info_box_contents, false, false);
 echo '<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="s_cart_head s_cart_head_padd se">' . CART_SHIPPING_OPTIONS . '</td></tr></table>';

 $ShipTxt= tep_draw_form('estimator', tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'), 'post'); //'onSubmit="return check_form();"'
 $ShipTxt.=tep_draw_hidden_field('sid', $selected_shipping['id']);
 $ShipTxt.='<table>';
 if(sizeof($quotes)) {
   if (tep_session_is_registered('customer_id')) {
     // logged in

 if (CARTSHIP_SHOWWT == 'true') {
   $showweight = ' (' . $total_weight . ' ' . CARTSHIP_WTUNIT . ')';
 } else {
   $showweight = '';
 }

       if(CARTSHIP_SHOWIC == 'true'){
     //ishazer remover hard code for version 2.20 : $ShipTxt.='<tr><td class="main">' . ($total_count == 1 ? ' <strong>Item:</strong></td><td colspan="2" class="main">' : ' <strong>' . CART_ITEM . '</strong></td><td colspan="2" class="main">') . $total_count . $showweight . '</td></tr>';
     $ShipTxt.='<tr><td class="main">' . ($total_count == 1 ? ' <strong>' . CART_ITEM . '</strong></td><td colspan="2" class="main">' : ' <strong>' . CART_ITEM . '</strong></td><td colspan="2" class="main">') . $total_count . $showweight . '</td></tr>';

      }
     $addresses_query = tep_db_query("select address_book_id, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "'");
     // only display addresses if more than 1
     if (tep_db_num_rows($addresses_query) > 1){
       while ($addresses = tep_db_fetch_array($addresses_query)) {
         $addresses_array[] = array('id' => $addresses['address_book_id'], 'text' => tep_address_format(tep_get_address_format_id($addresses['country_id']), $addresses, 0, ' ', ' '));
       }
       $ShipTxt.='<tr><td colspan="3" class="main" nowrap>' .
                 CART_SHIPPING_METHOD_ADDRESS .' '. tep_draw_pull_down_menu('address_id', $addresses_array, $selected_address, 'onchange="return shipincart_submit(\'\');"').'</td></tr>';
     }
     $ShipTxt.='<tr valign="top"><td class="main"><strong>' . CART_SHIPPING_METHOD_TO .'</strong> </td><td colspan="2" class="main">'. tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>') . '</td></tr>';

   } else {
// not logged in
     $ShipTxt.='<tr><td>' . CART_SHIPPING_OPTIONS_LOGIN . '</td></tr>';

       if(CARTSHIP_SHOWIC == 'true'){
//azer for 2.20:      $ShipTxt.='<tr><td class="main">' . ($total_count == 1 ? ' <strong>Item:</strong></td><td colspan="2" class="main">' : ' <strong>Items:</strong></td><td colspan="2" class="main">') . $total_count . $showweight . '</td></tr>';
             $ShipTxt.='<tr><td class="main" nowrap>' . ($total_count == 1 ? ' <strong>' . CART_ITEM . '</strong></td><td colspan="2" class="main" nowrap>' : ' <strong>' . CART_ITEM . '</strong></td><td colspan="2" class="main">') . $total_count . $showweight . '</td></tr>';

      }

     if($cart->get_content_type() != 'virtual'){

       if(CARTSHIP_SHOWCDD == 'true'){
       $ShipTxt.='<tr><td colspan="3" class="main" nowrap>' .
                 ENTRY_COUNTRY .' '. tep_get_country_list('country_id', $selected_country,'style="width=200"').'<br>';
       }

//add state zone_id
       $state_array[] = array('id' => '', 'text' => 'Please Select');
       $state_query = tep_db_query("select zone_name, zone_id from " . TABLE_ZONES . " where zone_country_id = '$selected_country' order by zone_country_id DESC, zone_name");
       while ($state_values = tep_db_fetch_array($state_query)) {
         $state_array[] = array('id' => $state_values['zone_id'],
                                'text' => $state_values['zone_name']);
       }

       if(CARTSHIP_SHOWSDD == 'true'){
        $ShipTxt.=ENTRY_STATE .' '. tep_draw_pull_down_menu('state',$state_array).'<br>';
       }

       if(CARTSHIP_SHOWZDD == 'true'){
         $ShipTxt.=ENTRY_POST_CODE .' '. tep_draw_input_field('zip_code', $selected_zip, 'size="5"');
       }
//        $ShipTxt.=' <a href="_" onclick="return shipincart_submit(\'\');">'.CART_SHIPPING_METHOD_RECALCULATE.'</a></td></tr>';

       if(CARTSHIP_SHOWUB == 'true'){
$ShipTxt.=' <td><a href="_" onclick="return shipincart_submit(\'\');">'. tep_image_button('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART) . ' </a></td></td></tr>';
       }
       }
   }
   if($cart->get_content_type() == 'virtual'){
     // virtual product-download
     //$ShipTxt.='<tr><td colspan="3" class="main">'.tep_draw_separator().'</td></tr>';
     $ShipTxt.='<tr><td class="main" colspan="3"> </td></tr><tr><td class="main" colspan="3"><i>' . CART_SHIPPING_METHOD_FREE_TEXT . ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS . '</i></td></tr>';
   }elseif ($free_shipping==1) {
     // order $total is free
     //$ShipTxt.='<tr><td colspan="3" class="main">'.tep_draw_separator().'</td></tr>';
     $ShipTxt.='<tr><td class="main" colspan="3"> </td></tr><tr><td class="main" colspan="3"><i>' . sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . '</i></td><td> </td></tr>';
   }else{
     // shipping display
  if ( empty($quotes[0]['error']) || (!empty($quotes[1])&∅($quotes[1]['error'])) ) {
       $ShipTxt.='<tr><td colspan="3" class="main"> </td></tr><tr><td class="main"><strong>' . CART_SHIPPING_CARRIER_TEXT . '</strong></td><td class="main" align="left"><strong>' . CART_SHIPPING_METHOD_TEXT . '</strong></td><td class="main" align="right"><strong>' . CART_SHIPPING_METHOD_RATES . '</strong></td></tr>';
       $ShipTxt.='<tr><td colspan="3" class="main">'.tep_draw_separator().'</td></tr>';
  } else {
    $ShipTxt.='<tr><td colspan="3" class="main"> </td></tr>';
  }
     for ($i=0, $n=sizeof($quotes); $i<$n; $i++) {
       if(sizeof($quotes[$i]['methods'])==1){
         // simple shipping method
         $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][0]['id'];
         $ShipTxt.= '<tr class="'.$extra.'">';
         $ShipTxt.='<td class="main">'.$quotes[$i]['icon'].'   </td>';
         if($quotes[$i]['error']){
           $ShipTxt.='<td colspan="2" class="main">'.$quotes[$i]['module'].' ';
           $ShipTxt.= '('.$quotes[$i]['error'].')</td></tr>';
         }else{
           if($selected_shipping['id'] == $thisquoteid){
            // commented for v2.10 : $ShipTxt.='<td class="main"><a title="Select this method" href="_"  onclick="return shipincart_submit(\''.$thisquoteid.'\');"><strong>'.$quotes[$i]['module'].' ';
$ShipTxt.='<td class="main"><a title="' . CART_SELECT_THIS_METHOD .'" href="_"  onclick="return shipincart_submit(\''.$thisquoteid.'\');"><strong>'.$quotes[$i]['module'].' ';

             $ShipTxt.= '('.$quotes[$i]['methods'][0]['title'].')</strong></a>   </td><td align="right" class="main"><strong>'.$currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])).'</strong></td></tr>';
           }else{
            // commented for v2.10 : $ShipTxt.='<td class="main"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'.$quotes[$i]['module'].' ';
$ShipTxt.='<td class="main"><a title="' . CART_SELECT_THIS_METHOD .'" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'.$quotes[$i]['module'].' ';

             $ShipTxt.= '('.$quotes[$i]['methods'][0]['title'].')</a>   </td><td align="right" class="main">'.$currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])).'</td></tr>';
           }
         }
       } else {
         // shipping method with sub methods (multipickup)
         for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
           $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][$j]['id'];
           $ShipTxt.= '<tr class="'.$extra.'">';
           $ShipTxt.='<td class="main">'.$quotes[$i]['icon'].'   </td>';
           if($quotes[$i]['error']){
             $ShipTxt.='<td colspan="2" class="main">'.$quotes[$i]['module'].' ';
             $ShipTxt.= '('.$quotes[$i]['error'].')</td></tr>';
           }else{
             if($selected_shipping['id'] == $thisquoteid){
              // commented for v2.10 :  $ShipTxt.='<td class="main"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');"><strong>'.$quotes[$i]['module'].' ';
$ShipTxt.='<td class="main"><a title="' . CART_SELECT_THIS_METHOD .'" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');"><strong>'.$quotes[$i]['module'].' ';

               $ShipTxt.= '('.$quotes[$i]['methods'][$j]['title'].')</strong></a>   </td><td align="right" class="main"><strong>'.$currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])).'</strong></td><td class="main">'.tep_image(DIR_WS_ICONS . 'selected.gif', 'Selected').'</td></tr>';
             }else{
             // commented for v2.10 :   $ShipTxt.='<td class="main"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'.$quotes[$i]['module'].' ';
$ShipTxt.='<td class="main"><a title="' . CART_SELECT_THIS_METHOD .'" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'.$quotes[$i]['module'].' ';

               $ShipTxt.= '('.$quotes[$i]['methods'][$j]['title'].')</a>   </td><td align="right" class="main">'.$currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])).'</td><td class="main"> </td></tr>';
             }
           }
         }
       }
     }
   }
 }
 $ShipTxt.= '</table></form>';

 $info_box_contents = array();
 $info_box_contents[] = array('text' => $ShipTxt);
 new infoBox($info_box_contents);

//THIS IS CAUSING CUSTOM SHOP TO RIP FOOTER/RIGHT INFOBOX NAVIGATION!!
 if (CARTSHIP_SHOWOT == 'true'){
   // BOF get taxes if not logged in
   if (!tep_session_is_registered('customer_id')){
     $products = $cart->get_products();
     for ($i=0, $n=sizeof($products); $i<$n; $i++) {
       $products_tax = tep_get_tax_rate($products[$i]['tax_class_id'], $order->delivery['country_id'],$order->delivery['zone_id']);
       $products_tax_description = tep_get_tax_description($products[$i]['tax_class_id'], $order->delivery['country_id'], $order->delivery['zone_id']);
       if (DISPLAY_PRICE_WITH_TAX == 'true') {
        //Modified by Strider 42 to correct the tax calculation when a customer is not logged in
        // $tax_val = ($products[$i]['final_price']-(($products[$i]['final_price']*100)/(100+$products_tax)))*$products[$i]['quantity'];
         $tax_val = (($products[$i]['final_price']/100)*$products_tax)*$products[$i]['quantity'];
       } else {
         $tax_val = (($products[$i]['final_price']*$products_tax)/100)*$products[$i]['quantity'];
       }
       $order->info['tax'] += $tax_val;
       $order->info['tax_groups']["$products_tax_description"] += $tax_val;
       // Modified by Strider 42 to correct the order total figure when shop displays prices with tax
       if (DISPLAY_PRICE_WITH_TAX == 'true') {
          $order->info['total'];
       } else {
       $order->info['total']+=$tax_val;
              }
     }
   }
   // EOF get taxes if not logged in (seems like less code than in order class)
   require(DIR_WS_CLASSES . 'order_total.php');
   $order_total_modules = new order_total;
   //echo '</td><td align="right">';
   // order total code
   $order_total_modules->process();

   //$info_box_contents = array();
 //$info_box_contents[] = array('text' => '<strong>' . CART_OT . '</strong>'); //azer version 2.20

   //new infoBoxHeading($info_box_contents, false, false);
echo '<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="s_cart_head s_cart_head_padd ot">' . CART_OT . '</td></tr></table>';
   $otTxt='<table align="right">';
   $otTxt.=$order_total_modules->output().'</table>';

   $info_box_contents = array();
   $info_box_contents[] = array('text' => $otTxt);

   new infoBox($info_box_contents);
 }
} // Use only when cart_contents > 0

?>
            </td></tr></table>

 

/shopping_cart.php (search "<!-- ship_in_cart //-->")

 

<?php
/*
 $Id: shopping_cart.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2007 osCommerce

 Released under the GNU General Public License
*/

 require("includes/application_top.php");

 if ($cart->count_contents() > 0) {
   include(DIR_WS_CLASSES . 'payment.php');
   $payment_modules = new payment;
 }

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOPPING_CART);

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHOPPING_CART));
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
<html <?php echo HTML_PARAMS; ?>>
<head>
<?php
/*** Begin Header Tags SEO ***/
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
 require(DIR_WS_INCLUDES . 'header_tags.php');
} else {
?>
 <title><?php echo TITLE; ?></title>
<?php
}
/*** End Header Tags SEO ***/
?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
</head>
<body>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" class="<?php echo MAIN_TABLE; ?>" cellspacing="0" cellpadding="0">
<tr>
   <td class="<?php echo BOX_WIDTH_TD_LEFT; ?>"><table border="0" class="<?php echo BOX_WIDTH_LEFT; ?>" cellspacing="0" cellpadding="0">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td class="<?php echo CONTENT_WIDTH_TD; ?>"><?php echo panel_top(); ?>




<?php echo tep_draw_title_top();?>

			<?php echo HEADING_TITLE; ?>

<?php echo tep_draw_title_bottom();?>
<?php echo tep_draw_top();?>
<?php echo tep_draw1_top();?>




<?php
 if ($cart->count_contents() > 0) {
?>
<table border="0" cellpadding="0" cellspacing="0" style="background:url(images/line_x.gif) repeat-x left bottom; margin-bottom:3px;">
<tr>
   	<td class="s_cart_head s_cart_head_padd remove" style="text-align:center;">
       	<?php echo TABLE_HEADING_REMOVE ; ?>
       </td>
   	<td class="s_cart_head s_cart_head_padd products" style="text-align:center;">
       	<?php echo TABLE_HEADING_PRODUCTS ; ?>
       </td>
   	<td class="s_cart_head s_cart_head_padd quantity" style="text-align:center;">
       	<?php echo TABLE_HEADING_QUANTITY ; ?>
       </td>
   	<td class="s_cart_head s_cart_head_padd total" style="text-align:center;">
       	<?php echo TABLE_HEADING_TOTAL ; ?>
       </td>
   </tr>
</table>

<?php

}

?>





<table>
<tr>
<td style="padding:0 0 0 0;">
<?php
 if ($cart->count_contents() > 0) {
?>
<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?>


<?php 
   $info_box_contents = array();
  /* $info_box_contents[0][] = array('align' => 'center',
                                   'params' => ' class="s_cart_head s_cart_head_padd remove"',
                                   'text' => ''.TABLE_HEADING_REMOVE.'');

   $info_box_contents[0][] = array('align' => 'center',
								'params' => ' class="s_cart_head s_cart_head_padd products"',
                                   'text' => ''.TABLE_HEADING_PRODUCTS.'');

   $info_box_contents[0][] = array('align' => 'center',
                                   'params' => ' class="s_cart_head s_cart_head_padd quantity"',
                                   'text' => ''.TABLE_HEADING_QUANTITY.'');

   $info_box_contents[0][] = array('align' => 'center',
                                   'params' => ' class="s_cart_head s_cart_head_padd total"',

                                   'text' => ''.TABLE_HEADING_TOTAL.'');

						*/ 		
								?>



                                   <?php

   $any_out_of_stock = 0;
   $products = $cart->get_products();
   for ($i=0, $n=sizeof($products); $i<$n; $i++) {
// Push all attributes information in an array
     if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
       while (list($option, $value) = each($products[$i]['attributes'])) {
         echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
         $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
                                     from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                                     where pa.products_id = '" . (int)$products[$i]['id'] . "'
                                      and pa.options_id = '" . (int)$option . "'
                                      and pa.options_id = popt.products_options_id
                                      and pa.options_values_id = '" . (int)$value . "'
                                      and pa.options_values_id = poval.products_options_values_id
                                      and popt.language_id = '" . (int)$languages_id . "'
                                      and poval.language_id = '" . (int)$languages_id . "'");
         $attributes_values = tep_db_fetch_array($attributes);

         $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
         $products[$i][$option]['options_values_id'] = $value;
         $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];
         $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
         $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
       }
     }
   }

   for ($i=0, $n=sizeof($products); $i<$n; $i++) {
     if (($i/2) == floor($i/2)) {
       $info_box_contents[] = array('params' => '');
     } else {
       $info_box_contents[] = array('params' => '');
     }

     $cur_row = sizeof($info_box_contents) - 1;
  $p_cart_pic	= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => ' class="s_cart_td remove"',
                                            'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));

     $products_name = '<table border="0" cellspacing="15" cellpadding="0" align="center" style="margin:auto;">' .
     '<tr><td style="text-align:center;" class="mainsh" >'.tep_draw_prod_pic_top2().''.$p_cart_pic.''.tep_draw_prod_pic_bottom2().' </td></tr>' . 
                      '<tr><td colspan="2"  class="cont_heading_td" style="text-align:center;">




						  <table cellpadding="0" cellspacing="0" border="0">
							<tr>
								<td class="cont_heading_td" style="text-align:center; padding-right:32px;">
									 <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . $products[$i]['name'] . '</a><br>
								</td>
							</tr>
						  </table>   




				   </td></tr>'








				  ;

     if (STOCK_CHECK == 'true') {
       $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
       if (tep_not_null($stock_check)) {
         $any_out_of_stock = 1;

         $products_name .= $stock_check;
       }
     }

     if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
       reset($products[$i]['attributes']);
         $products_name .= '';		
       while (list($option, $value) = each($products[$i]['attributes'])) {
         $products_name .= '<tr><td style="text-align:center;"><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i><br>';
       }
         $products_name .= '</td></tr>';		
     }

     $products_name .= '</table>';

     $info_box_contents[$cur_row][] = array('params' => '',
                                            'text' => $products_name);

     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="s_cart_td"',
                                            'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="2"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="s_cart_td"',
                                            'text' => '<span class="productSpecialPrice">' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</span>');
   }

   new productListingBox($info_box_contents);
?>

<?php
   if ($any_out_of_stock == 1) {
     if (STOCK_ALLOW_CHECKOUT == 'true') {
?>

  <table cellpadding="0" cellspacing="0" border="0">
  	<tr><td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></td></tr>
  </table>
<?php
     } else {
?>
     <table cellpadding="0" cellspacing="0" border="0">
  	<tr><td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></td></tr>
  </table>
<?php
     }
   }
?>

<?php  /* echo tep_draw_infoBox2_top(); */ ?>

<div class="cart_line_x padd2_gg"><?php echo tep_draw_separator('spacer.gif', '1', '1'); ?></div>

			<table cellspacing="0" cellpadding="0" border="0">
				<tr>
					<td width="80%" align="right" class="cart_total_left"><?php echo SUB_TITLE_SUB_TOTAL; ?></td>
					<td width="20%" align="center" class="cart_total_right main">														
						<span class="productSpecialPrice"><?php echo $currencies->format($cart->show_total()); ?></span>
					</td>
				</tr>
<!-- ship_in_cart //-->
   <tr>
       <td><br><?php if (CARTSHIP_ONOFF == 'Enabled') { require(DIR_WS_MODULES . 'shipping_estimator.php'); } else {}; ?></td>
     </tr>
<!-- ship_in_cart_eof //-->
			</table>
<div class="cart_line_x padd2_gg"><?php echo tep_draw_separator('spacer.gif', '1', '1'); ?></div>

			<table cellspacing="0" cellpadding="0" border="0" >
				<tr>
					<td style="padding:16px 0 9px 31px;" class="button_marg bg_input"><?php echo tep_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART); ?><?php echo tep_draw_separator('spacer.gif', '1', '1'); ?><?php

   		$back = sizeof($navigation->path)-2;
   			if (isset($navigation->path[$back])) {
			echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping1.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; 
			}
			?><?php echo tep_draw_separator('spacer.gif', '1', '1'); ?><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>
				</tr>
			</table></form>
<table><tr><td><br><font size="1">Note: Google Checkout shipping calculations may take a while to load. (GC does not offer First Class quotes)</font></td>
<td>
<?php          
         // *** BEGIN GOOGLE CHECKOUT ***          
         if (defined('MODULE_PAYMENT_GOOGLECHECKOUT_STATUS') && MODULE_PAYMENT_GOOGLECHECKOUT_STATUS == 'True') {            
        include_once('googlecheckout/gcheckout.php');          
        }          
        // *** END GOOGLE CHECKOUT ***
?>	
</td></tr></table>				
<?php  /* echo tep_draw_infoBox2_bottom(); */ ?>

<?php
   $initialize_checkout_methods = $payment_modules->checkout_initialization_method();

   if (!empty($initialize_checkout_methods)) {
?>
   <table cellpadding="0" cellspacing="0" border="0">
  <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td align="right" class="main" style="padding-right:50px;"><?php echo TEXT_ALTERNATIVE_CHECKOUT_METHODS; ?></td>
     </tr>
<?php
     reset($initialize_checkout_methods);
     while (list(, $value) = each($initialize_checkout_methods)) {
?>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td align="right" class="main"><?php echo $value; ?></td>
     </tr>
</table>

<?php echo tep_draw4_bottom();?>

<?php
     }
   }
 }else {
?>

<?php //echo tep_draw1_top();?>

<?php echo tep_draw_infoBox_top();?>

<?php new infoBox_search_criteria(array(array('text' => TEXT_CART_EMPTY))); ?>

<?php echo tep_draw_infoBox_bottom();?>

<?php //echo tep_draw1_bottom();?>

<?php echo tep_pixel_trans();?>

<?php  /* echo tep_draw_infoBox2_top(); */ ?>

		<table border="0" width="100%" cellspacing="0" cellpadding="2"><tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table>

<?php  /* echo tep_draw_infoBox2_bottom(); */ ?>

<?php
 }
?>
</td>
</tr>
</table>
<?php echo tep_draw_bottom();?>	
<?php echo tep_draw1_bottom();?>



</td>
<!-- body_text_eof //-->
<td class="<?php echo BOX_WIDTH_TD_RIGHT; ?>"><table border="0" class="<?php echo BOX_WIDTH_RIGHT; ?>" cellspacing="0" cellpadding="0">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->

<!-- google_analytics //-->
<?php require(DIR_WS_INCLUDES . 'google_analytics.php'); ?>
<!-- google_analytics_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

If you are being sent to the index.php page when submitting the quotes form it's because you have the quote form inside the original form on the page. Pay close attention to the </form> tags when you install the contribution and make sure one is not inside the other.

Matt

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...