Hướng dẫn checkout php


#readme.txt


B1. Tạo database (CSDL)
- create database BT2290

create table products (
	id int primary key auto_increment,
	title varchar(250) not null,
	thumbnail varchar(500),
	content longtext,
	price float,
	created_at datetime,
	updated_at datetime
);

create table orders (
	id int primary key auto_increment,
	fullname varchar(100),
	phone_number varchar(20),
	email varchar(200),
	address varchar(200),
	order_date datetime
);

create table order_details (
	id int primary key auto_increment,
	order_id int references orders (id),
	product_id int references products (id),
	num int,
	price float
);

B2. Fake data -> DONE
B3. Xay khung du an
	- db:
		- config.php
		- dbhelper.php
	- utils
		- utility.php
B4. Phát triển các chức năng của dự án
1) products.php
2) detail.php
3) cart.php
	Yeu cau: add to cart -> cart -> quan ly dc san pham + so luong trong cart do la nhu the nao
	Giai phap: Session
		$_SESSION['cart'] => [
			[
				object product,
				'num' => ???
			],
			[
				object product,
				'num' => ???
			]
		]
	Phuong phap lam nhu the nao???
4) checkout.php
5) complete.php -> sau khi hoàn thành thanh toán.

#cart.php




'; } ?>
No Thumbnail Title Price Num Total
'.(++$count).' '.$item['title'].' '.number_format($item['price'], 0, '', '.').' VND '.$item['num'].' '.number_format($item['num'] * $item['price'], 0, '', '.').' VND

VND

#complete.php




Complete Checkout

#checkout.php




'; } ?>
No Thumbnail Title Price Num Total
'.(++$count).' '.$item['title'].' '.number_format($item['price'], 0, '', '.').' VND '.$item['num'].' '.number_format($item['num'] * $item['price'], 0, '', '.').' VND

VND

#detail.php




VND

#products.php




'.$item['title'].'

'.number_format($item['price'], 0, '', '.').' VND

'; } ?>

#api-product.php


#form-checkout.php



	

Copyright © 2019 All rights reserved

#header.php





	<?=$title?>
	
	

	
	

	
	

	
	

	


	
	
	
	

	

#config.php


#dbhelper.php


#utility.php