$count_rows = count_rows($category); //common amount product $pages_count = ceil($count_rows / $perpage); // common amount pages if (!$pages_count) { $pages_count = 1; } if ($page > $pages_count) { $page = $pages_count; } $start_pos = ($page - 1) * $perpage; $products = product($category, $start_pos, $perpage); break; case 'addtocart': $goods_id = abs((int) $_GET['goods_id']); addtocart($goods_id); $_SESSION['total_sum'] = total_sum($_SESSION['cart']); $_SESSION['total_quantity'] = 0; foreach ($_SESSION['cart'] as $key => $value) { if (isset($value['price'])) { $_SESSION['total_quantity'] += $value['qty']; } else { unset($_SESSION['cart'][$key]); } } redirect(); break; case 'reg': break; default: $view = 'hits';
<?php include 'model.php'; include 'functions.php'; addtocart($_POST['productname'], $_POST['productprice'], $_POST['productquantity']);
<?php /* set cache to never expire */ session_cache_expire(0); $cache_expire = session_cache_expire(); session_start(); include "sessions.php"; include "functions.php"; if ($_REQUEST['command'] == 'add' && $_REQUEST['productid'] > 0) { $pid = $_REQUEST['productid']; addtocart($pid, 1); write_cart(); header("location:shoppingcart.php"); exit; } $con = mysql_connect('cs-server.usc.edu:7787', 'root', 'richard'); if (!$con) { die('Error connecting to server: ' . mysql_error()); } mysql_select_db('store', $con); ?> <!DOCTYPE html> <html> <head> <title>Chou's Skateboard Shop</title> <link rel="stylesheet" type="text/css" href="main.css">
<?php include "../global/global.php"; include "header.php"; $pagecall = "shoppingcart"; $pesan = ""; include "../modules/cart.php"; if (isset($_POST['submitcart'])) { addtocart(); } elseif (isset($_POST['editcart'])) { $success = editquantity(); if ($success == 0) { $pesan = "Failed to update cart, this product stock is not sufficient."; } } elseif (isset($_POST['deletefromcart'])) { deletefromcart(); } ?> <div class="container"> <div class="front-content shoppingcart"> <h1>SHOPPING CART</h1> <div class="breadcrumb"> <ul> <li><a href="homepage.php">Home</a></li> <li><b>Shopping Cart</b></li> </ul> </div> <div class="message"> <p><?php if ($pesan != "") { echo $pesan;
<?php error_reporting(E_ERROR); session_start(); require_once 'connection.php'; require_once 'felhasznalo.php'; if (isset($_GET['add_id']) && logged_in()) { addtocart($_GET['add_id']); } else { if (isset($_GET['remove_id']) && logged_in()) { removefromcart($_GET['remove_id']); } else { if (isset($_GET['shopping']) == true && logged_in()) { checkout(); } else { echo '<script type="text/javascript"> alert("Hibás email/jelszó!"); window.location.href="login.php";</script>'; } } } function checkout() { global $connect; $ossz_ar = 0; $termek_szam = 0; $idopont = date('Y') . '/' . date('m') . '/' . date('d'); foreach ($_SESSION['cart']['items'] as $key => $value) { $termek_szam++; $ossz_ar += $value['ar']; }
} // check if page get set if (isset($_GET['page'])) { $sel_page = get_page_by_id($_GET['page']); $sel_product = get_product_by_id($_GET['page'], ''); } else { $sel_page = NULL; $sel_product = NULL; } if (isset($_REQUEST['command']) || isset($_REQUEST['pid']) || isset($_REQUEST['productid'])) { // for add to cart if ($_REQUEST['command'] == 'add' && $_REQUEST['productid'] > 0) { $pid = $_REQUEST['productid']; $p_qty = $_REQUEST['productqty']; $p_note = $_REQUEST['productnote']; addtocart($pid, $p_qty, $p_note); header("location:shoppingcart.php?qty=" . $p_qty); exit; } if ($_REQUEST['command'] == 'delete' && $_REQUEST['pid'] > 0) { // delete from cart remove_product($_REQUEST['pid']); } else { if ($_REQUEST['command'] == 'clear') { // clear shopping cart unset($_SESSION['cart']); } else { if ($_REQUEST['command'] == 'updatecart') { // update shopping cart $max = count($_SESSION['cart']); for ($i = 0; $i < $max; $i++) {
<?php session_start(); include 'connection.php'; include 'functions.php'; if (empty($_SESSION['prod_count'])) { $_SESSION['prod_count'] = 0; } if (isset($_POST['add_to_cart_button'])) { addtocart($_POST['product_id'], $_POST['price']); } if (isset($_POST['update'])) { update_cart($_POST['p_count'], $_POST['upd_id'], $_POST['in_cart']); } if (isset($_POST['delete'])) { remove_from_cart($_POST['del_id']); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>Test shop</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div class="header">
addtocart($goods_id); $_SESSION['total_sum'] = total_sum($_SESSION['cart']); // кол-во товара в корзине + защита от ввода несуществующего ID товара total_quantity(); redirect(); break; case 'cart': /* корзина */ // получение способов доставки $dostavka = get_dostavka(); // пересчет товаров в корзине if (isset($_GET['id'], $_GET['qty'])) { $goods_id = abs((int) $_GET['id']); $qty = abs((int) $_GET['qty']); $qty = $qty - $_SESSION['cart'][$goods_id]['qty']; addtocart($goods_id, $qty); $_SESSION['total_sum'] = total_sum($_SESSION['cart']); // сумма заказа total_quantity(); // кол-во товара в корзине + защита от ввода несуществующего ID товара redirect(); } // удаление товара из корзины if (isset($_GET['delete'])) { $id = abs((int) $_GET['delete']); if ($id) { delete_from_cart($id); } redirect(); } if ($_POST['order_x']) {