[ PHPXref.com ] [ Generated: Sun Jul 20 19:28:27 2008 ] [ PgMarket 2.2.3 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/shopping/ -> shopping_cart_add.php (source)

   1  <?php
   2  // (C) 2000 Ying Zhang (ying@zippydesign.com)
   3  // (C) 2000-2002 Marco Pratesi <marco@pgmarket.net>
   4  
   5  include  ("../config.inc.php");
   6  include  ("../common.inc.php");
   7  
   8  if ($_SERVER["REQUEST_METHOD"] == "GET") {
   9      $product_id = nvl($_GET["product_id"], "");
  10      $color_id = nvl($_GET["color_id"], 1);
  11      $qty = nvl($_GET["qty"], "");
  12  }
  13  if ($_SERVER["REQUEST_METHOD"] == "POST") {
  14      $product_id = nvl($_POST["product_id"], "");
  15      $color_id = nvl($_POST["color_id"], 1);
  16      $qty = nvl($_POST["qty"], "");
  17  }
  18  
  19  if ($qty == "") {
  20      $qty = 1;
  21  } else {
  22      $qty = intval($qty);
  23  }
  24  if ($qty > 0) { // && $qty < 1000) {
  25      $PGM_SESSION["CART"]->add_item(array($product_id, $color_id), $qty);
  26      $PGM_SESSION["CART"]->calc_grandtotal();
  27  }
  28  
  29  if (!empty($PGM_SESSION["REFERER_AND_QUERY"])) {
  30      pgm_session_close($PGM_SESSION, $session_name);
  31      redirect($PGM_SESSION["REFERER_AND_QUERY"]);
  32      die;
  33  } else {
  34      pgm_session_close($PGM_SESSION, $session_name);
  35      redirect($CFG["firstpage"]);
  36      die;
  37  }
  38  
  39  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]