query($sql); $row = $d->fetch_array(); return $row["ten_vi"]; //alert("asdasd"); } function get_product_img($pid){ global $d, $row; $sql = "select photo from #_product where id=$pid"; $d->query($sql); $row = $d->fetch_array(); return $row['photo']; } function get_price($pid){ global $d, $row; $sql = "select gia from table_product where id=$pid"; $d->query($sql); $row = $d->fetch_array(); return $row['gia']; } function remove_product($pid){ $pid=intval($pid); $max=count($_SESSION['cart']); for($i=0;$i<$max;$i++){ if($pid==$_SESSION['cart'][$i]['productid']){ unset($_SESSION['cart'][$i]); break; } } $_SESSION['cart']=array_values($_SESSION['cart']); } function get_order_total(){ $max=count($_SESSION['cart']); $sum=0; for($i=0;$i<$max;$i++){ $pid=$_SESSION['cart'][$i]['productid']; $q=$_SESSION['cart'][$i]['qty']; $price=get_price($pid); $sum+=$price*$q; } return $sum; } function get_total(){ $max=count($_SESSION['cart']); $sum=0; for($i=0;$i<$max;$i++){ $pid=$_SESSION['cart'][$i]['productid']; $q=$_SESSION['cart'][$i]['qty']; $sum+=$q; } return $sum; } function addtocart($pid,$q){ if($pid<1 or $q<1) return; if(isset($_SESSION['cart'])){ $i=product_exists($pid); if($i!=-1) { $_SESSION['cart'][$i]['qty']=$q+$_SESSION['cart'][$i]['qty']; return; } else{ $max=count($_SESSION['cart']); $_SESSION['cart'][$max]['productid']=$pid; $_SESSION['cart'][$max]['qty']=$q; } } else{ $_SESSION['cart']=array(); $_SESSION['cart'][0]['productid']=$pid; $_SESSION['cart'][0]['qty']=$q; } } function q_addtocart($pid,$a,$b,$q){ if($pid<1 or $q<1) return; $max=count($_SESSION['cart']); if(is_array($_SESSION['cart'])){ if(product_exists($pid)) return; $max=count($_SESSION['cart']); $_SESSION['cart'][$max]['productid']=$pid; $_SESSION['cart'][$max]['qty']=$q; } else{ $_SESSION['cart']=array(); $_SESSION['cart'][0]['productid']=$pid; $_SESSION['cart'][0]['qty']=$q; } } function product_exists($pid){ $pid=intval($pid); $max=count($_SESSION['cart']); $flag=-1; for($i=0;$i<$max;$i++){ if($pid==$_SESSION['cart'][$i]['productid'] ){ $flag=$i; break; } } return $flag; } function update_slmua($pid, $q){ global $d, $row; $sql = "UPDATE #_product SET slmua=slmua+$q WHERE id=$pid"; $d->query($sql); } ?> Product

Hotel Docking

Hotel Docking

Phone: 0888440808
Email: info@hoteldocking.com
Search

Product

Contact us
Contact us
Contact us
Contact us
Contact us
Contact us
Contact us
Contact us
Contact us
Contact us
Contact us
Contact us
Contact us
Contact us
Contact us
Contact us