[ Index ]
 

Code source de osCommerce 2.2ms2-060817

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/catalog/ -> shopping_cart.php (source)

   1  <?php
   2  /*
   3    $Id: shopping_cart.php,v 1.73 2003/06/09 23:03:56 hpdl Exp $
   4  
   5    osCommerce, Open Source E-Commerce Solutions
   6    http://www.oscommerce.com
   7  
   8    Copyright (c) 2003 osCommerce
   9  
  10    Released under the GNU General Public License
  11  */
  12  
  13    require ("includes/application_top.php");
  14  
  15    require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOPPING_CART);
  16  
  17    $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHOPPING_CART));
  18  ?>
  19  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  20  <html <?php echo HTML_PARAMS; ?>>
  21  <head>
  22  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  23  <title><?php echo TITLE; ?></title>
  24  <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
  25  <link rel="stylesheet" type="text/css" href="stylesheet.css">
  26  </head>
  27  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
  28  <!-- header //-->
  29  <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  30  <!-- header_eof //-->
  31  
  32  <!-- body //-->
  33  <table border="0" width="100%" cellspacing="3" cellpadding="3">
  34    <tr>
  35      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
  36  <!-- left_navigation //-->
  37  <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
  38  <!-- left_navigation_eof //-->
  39      </table></td>
  40  <!-- body_text //-->
  41      <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
  42        <tr>
  43          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  44            <tr>
  45              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  46              <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_cart.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  47            </tr>
  48          </table></td>
  49        </tr>
  50        <tr>
  51          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  52        </tr>
  53  <?php
  54    if ($cart->count_contents() > 0) {
  55  ?>
  56        <tr>
  57          <td>
  58  <?php
  59      $info_box_contents = array();
  60      $info_box_contents[0][] = array('align' => 'center',
  61                                      'params' => 'class="productListing-heading"',
  62                                      'text' => TABLE_HEADING_REMOVE);
  63  
  64      $info_box_contents[0][] = array('params' => 'class="productListing-heading"',
  65                                      'text' => TABLE_HEADING_PRODUCTS);
  66  
  67      $info_box_contents[0][] = array('align' => 'center',
  68                                      'params' => 'class="productListing-heading"',
  69                                      'text' => TABLE_HEADING_QUANTITY);
  70  
  71      $info_box_contents[0][] = array('align' => 'right',
  72                                      'params' => 'class="productListing-heading"',
  73                                      'text' => TABLE_HEADING_TOTAL);
  74  
  75      $any_out_of_stock = 0;
  76      $products = $cart->get_products();
  77      for ($i=0, $n=sizeof($products); $i<$n; $i++) {
  78  // Push all attributes information in an array
  79        if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
  80          while (list($option, $value) = each($products[$i]['attributes'])) {
  81            echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
  82            $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
  83                                        from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
  84                                        where pa.products_id = '" . (int)$products[$i]['id'] . "'
  85                                         and pa.options_id = '" . (int)$option . "'
  86                                         and pa.options_id = popt.products_options_id
  87                                         and pa.options_values_id = '" . (int)$value . "'
  88                                         and pa.options_values_id = poval.products_options_values_id
  89                                         and popt.language_id = '" . (int)$languages_id . "'
  90                                         and poval.language_id = '" . (int)$languages_id . "'");
  91            $attributes_values = tep_db_fetch_array($attributes);
  92  
  93            $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
  94            $products[$i][$option]['options_values_id'] = $value;
  95            $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];
  96            $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
  97            $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
  98          }
  99        }
 100      }
 101  
 102      for ($i=0, $n=sizeof($products); $i<$n; $i++) {
 103        if (($i/2) == floor($i/2)) {
 104          $info_box_contents[] = array('params' => 'class="productListing-even"');
 105        } else {
 106          $info_box_contents[] = array('params' => 'class="productListing-odd"');
 107        }
 108  
 109        $cur_row = sizeof($info_box_contents) - 1;
 110  
 111        $info_box_contents[$cur_row][] = array('align' => 'center',
 112                                               'params' => 'class="productListing-data" valign="top"',
 113                                               'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));
 114  
 115        $products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
 116                         '  <tr>' .
 117                         '    <td class="productListing-data" align="center"><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></td>' .
 118                         '    <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';
 119  
 120        if (STOCK_CHECK == 'true') {
 121          $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
 122          if (tep_not_null($stock_check)) {
 123            $any_out_of_stock = 1;
 124  
 125            $products_name .= $stock_check;
 126          }
 127        }
 128  
 129        if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
 130          reset($products[$i]['attributes']);
 131          while (list($option, $value) = each($products[$i]['attributes'])) {
 132            $products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
 133          }
 134        }
 135  
 136        $products_name .= '    </td>' .
 137                          '  </tr>' .
 138                          '</table>';
 139  
 140        $info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"',
 141                                               'text' => $products_name);
 142  
 143        $info_box_contents[$cur_row][] = array('align' => 'center',
 144                                               'params' => 'class="productListing-data" valign="top"',
 145                                               'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));
 146  
 147        $info_box_contents[$cur_row][] = array('align' => 'right',
 148                                               'params' => 'class="productListing-data" valign="top"',
 149                                               'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>');
 150      }
 151  
 152      new productListingBox($info_box_contents);
 153  ?>
 154          </td>
 155        </tr>
 156        <tr>
 157          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 158        </tr>
 159        <tr>
 160          <td align="right" class="main"><b><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?></b></td>
 161        </tr>
 162  <?php
 163      if ($any_out_of_stock == 1) {
 164        if (STOCK_ALLOW_CHECKOUT == 'true') {
 165  ?>
 166        <tr>
 167          <td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></td>
 168        </tr>
 169  <?php
 170        } else {
 171  ?>
 172        <tr>
 173          <td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></td>
 174        </tr>
 175  <?php
 176        }
 177      }
 178  ?>
 179        <tr>
 180          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 181        </tr>
 182        <tr>
 183          <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
 184            <tr class="infoBoxContents">
 185              <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 186                <tr>
 187                  <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
 188                  <td class="main"><?php echo tep_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART); ?></td>
 189  <?php
 190      $back = sizeof($navigation->path)-2;
 191      if (isset($navigation->path[$back])) {
 192  ?>
 193                  <td class="main"><?php 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_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td>
 194  <?php
 195      }
 196  ?>
 197                  <td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>
 198                  <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
 199                </tr>
 200              </table></td>
 201            </tr>
 202          </table></td>
 203        </tr>
 204  <?php
 205    } else {
 206  ?>
 207        <tr>
 208          <td align="center" class="main"><?php new infoBox(array(array('text' => TEXT_CART_EMPTY))); ?></td>
 209        </tr>
 210        <tr>
 211          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 212        </tr>
 213        <tr>
 214          <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
 215            <tr class="infoBoxContents">
 216              <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 217                <tr>
 218                  <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
 219                  <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>
 220                  <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
 221                </tr>
 222              </table></td>
 223            </tr>
 224          </table></td>
 225        </tr>
 226  <?php
 227    }
 228  ?>
 229      </table></form></td>
 230  <!-- body_text_eof //-->
 231      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
 232  <!-- right_navigation //-->
 233  <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
 234  <!-- right_navigation_eof //-->
 235      </table></td>
 236    </tr>
 237  </table>
 238  <!-- body_eof //-->
 239  
 240  <!-- footer //-->
 241  <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
 242  <!-- footer_eof //-->
 243  <br>
 244  </body>
 245  </html>
 246  <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Généré le : Mon Nov 26 19:48:25 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics