SHOPPING CARTS CHAPTER 19. E-COMMERCE Typically, an e-commerce site will have public pages and admin pages.

Slides:



Advertisements
Similar presentations
Cookies, Sessions. Server Side Includes You can insert the content of one file into another file before the server executes it, with the require() function.
Advertisements

09/04/2015Unit 2 (b) Back-Office processes Unit 2 Assessment Criteria (b) 10 marks.
PRACTICAL PHP AND MYSQL WALKTHROUGH USING SAMPLE CODES – MAX NG.
The easy way to shop online and explore all around market sitting at home Project Created & Presented By: Siddhant Aggarwal 2374 CSE-B(4 TH YEAR) DITM.
The J2EE BookShop A detailed walk through of the J2EE BookShop.
Enhanced Shipping & Handling A Feature of D-Plus An Enhancement For iSeries 400 DMAS from  Copyright I/O International, 2005 Skip Intro.
Design of GuitarWorld.com
© Yanbu University College YANBU UNIVERSITY COLLEGE Management Science Department © Yanbu University College Module 6:WEB SERVER AND SERVER SIDE SCRPTING,
Advanced Web 2012 Lecture 4 Sean Costain PHP Sean Costain 2012 What is PHP? PHP is a widely-used general-purpose scripting language that is especially.
Class 3Intro to Databases Arrays Sending Values to a Script Manually For and While Loops.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Cookies & Sessions.
Cookies Set a cookie – setcookie() Extract data from a cookie - $_COOKIE Augment user authentication script with a cookie.
CHAPTER 12 COOKIES AND SESSIONS. INTRO HTTP is a stateless technology Each page rendered by a browser is unrelated to other pages – even if they are from.
 Basic.  Punch-Out Supplier – The punch-out suppliers are available on the main Home/Shop screen. These are vendors with which RPI has pricing agreements.
Welcome to Century Equipment’s Shop Online Website! This presentation will highlight some of it’s key features.
About Dynamic Sites (Front End / Back End Implementations) by Janssen & Associates Affordable Website Solutions for Individuals and Small Businesses.
C H A P T E R 4 Designing Database E-Commerce Hassanin M. Al-Barhamtoshy
PHP and MySQL for Client-Server Database Interaction Chapter 10.
CSCI 6962: Server-side Design and Programming Support Classes and Shopping Carts.
Your Name Here See Page Notes for Info about Hyperlinks.
Creating Databases Uploading Files. Reading & writing files. Homework: Starting planning ‘original’ project.
COMP3121 E-Commerce Technologies Richard Henson University of Worcester November 2011.
My final project was creating an online weapon store. In my store I have two different lists of weapons, melee and fire. I have a registration form where.
CIS 3051 PHP – Chapter 27 Building A Shopping Cart.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
Week seven CIT 354 Internet II. 2 Objectives Database_Driven User Authentication Using Cookies Session Basics Summary Homework and Project 2.
Week 7. Lecture 2 Functions, Arrays, PHP&MySQL. Function with More than one argument and a return statement For a function to return a value, the return.
PHP1-1 PHP Lecture 2 Xingquan (Hill) Zhu
Lecture 8 – Cookies & Sessions SFDV3011 – Advanced Web Development 1.
Cookies & Session Web Technology
Chapter 9 Session Tracking. Session Tracking Basics Accessing the session object associated with the current request: Call request.getSession to get an.
CHAPTER 9 PHP AND MYSQL. A POSSIBLE SITE CONFIGURATION Application Folder index.php includes (folder)header.phpfooter.phpstyle.cssmodel (folder)mysqli_connect.php.
1 אירוע אמאזון. 2 שלבי הפיתוח עם דיאגרמות UML 3 אמאזון תרשים תוכן.
Chapter 12 Cookies and Sessions Part 1. Stateless Protocol Hypertext Transfer Protocol (HTTP) is stateless No shopping cards No logging.
PHP. $_GET / $_POST / $_SESSION PHP uses predefined variables to provide access to important information about the server and requests from a browser.
Sessions in PHP – Page 1 of 13CSCI 2910 – Client/Server-Side Programming CSCI 2910 Client/Server-Side Programming Topic: Sessions in PHP Reading: Williams.
Web Database Programming Week 7 Session Management & Authentication.
Cookies and Sessions IDIA 618 Fall 2014 Bridget M. Blodgett.
Copyright © 2003 Pearson Education, Inc. Slide 7-1 The Web Wizard’s Guide to PHP by David Lash.
PHP-based Authentication
>> PHP: Insert Query & Form Processing. Insert Query Step 1: Define Form Variables Step 2: Make DB Connection Step 3: Error Handling Step 4: Define the.
CSCI 6962: Server-side Design and Programming JSF DataTables and Shopping Carts.
ECMM6018 Enterprise Networking for Electronic Commerce Tutorial 7
CS 149 Advance Perl Final Project Implementing an E-commerce shopping cart using cookies Presented by Dzung Tran.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
June 22, 2002The Winning Way!1 The Winning Way Seattle Orlando.
 Product Recommendations  Managing Product Recommendations  Types of Product Recommendations  Product Out of Stock  Out of Stock Management  Let.
 Shopping Basket  Stages to maintain shopping basket in framework  Viewing Shopping Basket.
Database Access Control IST2101. Why Implementing User Authentication? Remove a lot of redundancies in duplicate inputs of database information – Your.
 Pages within our Framework  Categories within Framework  Products within Framework  Model-View-Controller description of Page, category and products.
PHP Session ISYS 475. Session The web server starts a session when a visitor visiting your web site and assigns a unique id, the session id for the session.
SESSIONS 27/2/12 Lecture 8. ? Operator Similar to the if statement but returns a value derived from one of two expressions by a colon. Syntax: (expression)
Creating Databases for Web Applications 3-Tier. Design vs Function vs Content. More SQL. More php. Homework: work on final projects.
PHP and Sessions. Session – a general definition The GENERAL definition of a session in the “COMPUTER WORLD” is: The interactions (requests and responses)
MySQL MySQL and PHP – interacting with a database.
ITM © Port,Kazman 1 ITM 352 Cookies. ITM © Port,Kazman 2 Problem… r How do you identify a particular user when they visit your site (or any.
1 PHP HTTP After this lecture, you should be able to know: How to create and process web forms with HTML and PHP. How to create and process web forms with.
CSCI 6962: Server-side Design and Programming Shopping Carts and Databases.
Complete Ordering System for Promotional Literature and Samples Quick Reference and Training Guide.
Unit-6 Handling Sessions and Cookies. Concept of Session Session values are store in server side not in user’s machine. A session is available as long.
Adding Reports to a Database. Why do we use Reports? Reports are well-designed printed pages that offer several advantages: Reports are well-designed.
PHP: Login FdSc Module 109 Server side scripting and Database design
Register Account.
iShop Training Module Secured Browsing
Web Design and Development
ITM 352 Cookies.
Cookies BIS1523 – Lecture 23.
Building Web Applications
CustomSource Online Tutorial August, 2017
Grocery Store Outline csc242 – web programming.
Presentation transcript:

SHOPPING CARTS CHAPTER 19

E-COMMERCE Typically, an e-commerce site will have public pages and admin pages.

THE PUBLIC PAGES In an e-commerce setting, a user's session must be maintained across every page. If the session is lost on any particular page, then a new session would begin on subsequent pages, losing the contents of the cart. The best solution is to start the session in the header file.

SESSIONS Remember that session information needs to happen before any HTML is returned to the user: <?php # Script header.html /* This page begins the session, the HTML page, and the layout table.*/ session_start(); // Start a session. ?> …

THE SHOPPING CART Once the product catalog is created, a shopping cart can be implemented using sessions. This example will record the product ID, the price and quantity of each item in a session variable.

THE SHOPPING CART The cart will store values using the $_SESSION['cart'] variable: A multidimensional array whose keys will be productIDs The values of the array elements will themselves be arrays: one element for the quantity and another for the price.

THE SHOPPING CART <?php # Script add_cart.php // This page adds products to the shopping cart. // Set the page title and include the HTML header $page_title = 'Add to Cart'; include ('includes/header.html'); We need to include the header to start or maintain the session.

THE SHOPPING CART // Check if the cart already contains one of these products; // If so, increment the quantity: if (isset($_SESSION['cart'][$pid])) { $_SESSION['cart'][$pid]['quantity']++; // Add another. // Display a message: echo ' Another copy of the print has been added to your shopping cart. ';

THE SHOPPING CART // Check if the cart already contains one of these products; // If so, increment the quantity: if (isset($_SESSION['cart'][$pid])) { $_SESSION['cart'][$pid]['quantity']++; // Add another. // Display a message: echo ' Another copy of the print has been added to your shopping cart. ';

THE SHOPPING CART else { // New product to the cart. // Get the price from the database: require ('../mysqli_connect.php'); // Connect to the database. $q = "SELECT price FROM prints WHERE print_id=$pid"; $r = mysqli_query ($dbc, $q); if (mysqli_num_rows($r) == 1) { // Valid print ID. // Fetch the information. list($price) = mysqli_fetch_array ($r, MYSQLI_NUM); // Add to the cart: $_SESSION['cart'][$pid] = array ('quantity' => 1, 'price' => $price); // Display a message: echo ' The print has been added to your shopping cart. ';

THE SHOPPING CART $_SESSION['cart'] contains the shopping information $_SESSION contains other data like the session ID. The most important thing to store in the cart is the unique product ID (or whatever the PK is for products) and the quantity of that item

VIEWING THE CART Once the cart is created, it can be displayed as a form where quantities can be changed.

CHECKOUT AFTER the money transaction 1.Enter the order into the database using 1.The customer's id 2.The order total 2.Enter the order details into the database 3.Clear the cart