query($sql); $row = $d->fetch_array(); return $row['ten']; } function get_product_hinh($pid){ global $d, $row; $sql = "select thumb from #_product where id=$pid"; $d->query($sql); $row = $d->fetch_array(); return $row['thumb']; } function get_size_name($sid){ global $d, $row; $sql = "select ten from #_product_size where id=$sid"; $d->query($sql); $row = $d->fetch_array(); return $row['ten']; } function get_price($pid){ global $d, $row; $sql = "select gia,giakm from table_product where id=$pid "; $d->query($sql); $row = $d->fetch_array(); if($row['giakm']!='' && $row['giakm']<$row['gia']) return $row['giakm']; else 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']; $sid=$_SESSION['cart'][$i]['sizeid']; $q=$_SESSION['cart'][$i]['qty']; $price=get_price($pid,$sid); $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(is_array($_SESSION['cart'])){ if(product_exists($pid,$sid)) return; $max=count($_SESSION['cart']); $_SESSION['cart'][$max]['productid']=$pid; $_SESSION['cart'][$max]['qty']=$q; $_SESSION['cart'][$max]['sizeid']=$sid; } else{ $_SESSION['cart']=array(); $_SESSION['cart'][0]['productid']=$pid; $_SESSION['cart'][0]['qty']=$q; $_SESSION['cart'][0]['sizeid']=$sid; } } function product_exists($pid,$sid){ $pid=intval($pid); $sid=intval($sid); $max=count($_SESSION['cart']); $flag=0; for($i=0;$i<$max;$i++){ if(($pid==$_SESSION['cart'][$i]['productid']) && ($sid==$_SESSION['cart'][$i]['sizeid'])){ $flag=1; break; } } return $flag; } ?> Áo Vest Nam, Vest Nam, vest nam đẹp, vest cưới, vest chú rể, vest công sở

vest nam, ao vest nam, vest cuoi, vest chu re, vest cong so, vest han quoc

Vest Việt

  • Vest Việt
  • Vest Việt