Now do the website to do shopping cart here I will not write!! Please master write code to reference under!! Thanks, man.
Reply to discussion (solution)
The user can not put cookies, the next time users to find the collection in the shopping cart in the product once it is gone
The ajax+ database stores content.
I also need the shopping cart information, 2 floor said ajax+ database is how to realize, have the source word share under ... Thanks, man.
"; Print_r ($cars _id);//echo "
";//exit;foreach ($cars _id as $pr _id) {if ($pr _id== $product _id) {echo" "; Exit }}if (Empty ($_cookie[buypro])) {Setcookie ("Buypro", $product _id,time () +3600); Setcookie ("Buycount", "1", Time () +3600 );} else{$newpro =$_cookie[buypro]. ",". $product _id; $newcount =$_cookie[buycount]. ",". " 1 "; Setcookie (" Buypro ", $newpro, Time () +3600), Setcookie (" Buycount ", $newcount, Time () +3600);}} Delete if ($act = = "Del") {$buy =$_cookie[buypro]; $cars _id=explode (",", $buy); $buycountary =explode (",", $_cookie[ Buycount]); $newid =array (); $carcount =array (); for ($i =0; $i
In learning
For you to share a full set of points, not enough
index.php
"Width=" 123 "height=" 121 "border=" 0 "/> |
Name of Goods: |
Price of Goods: |
&pname= "> Buy |
conn.php
car.php
Product ID |
Number of goods |
Commodity price |
Total Merchandise |
Delete |
|
|
|
|
The > Delete |
|
|
Price |
|
S |
Submit Order//Return to home//buy.php
$pid, "price" = = $price, "num" =>1); }}else{$arr [$pid]=array ("pid" = + $pid, "price" = = $price, "num" =>1);} $_session["Mycar"]= $arr; After the purchase, the array is re-placed in the session, you can see this sessionob_clean () on each page,//Empty the cache header ("location:car.php");//jump to the Shopping Cart interface (car.php)?>
It may not be very powerful, but being a basic function is OK. In accordance with their own requirements can be modified
thinkphp Shopping Cart How to write code
In learning
Not logged in user shopping cart product store to cookie, logged in user to database