add to cart function in php which is call on add to cart button.

<?php

function addtocart($pid,$q,$psize,$blouse,$sizeee,$petticot,$petticotsize,$presttiched){
if($pid<1 or $q<1) return;

if(is_array($_SESSION['cart'])){
if(product_exists($pid)) return;
$max=count($_SESSION['cart']);
$_SESSION['cart'][$max]['productid']=$pid;
$_SESSION['cart'][$max]['qty']=$q;
$_SESSION['cart'][$max]['size']=$psize;
$_SESSION['cart'][$max]['blouse']=$blouse;
$_SESSION['cart'][$max]['sizeee']=$sizeee;
$_SESSION['cart'][$max]['petticot']=$petticot;
$_SESSION['cart'][$max]['petticotsize']=$petticotsize;
$_SESSION['cart'][$max]['presttiched']=$presttiched;
}
else{
$_SESSION['cart']=array();
$_SESSION['cart'][0]['productid']=$pid;
$_SESSION['cart'][0]['qty']=$q;
$_SESSION['cart'][0]['size']=$psize;
$_SESSION['cart'][0]['blouse']=$blouse;
$_SESSION['cart'][0]['sizeee']=$sizeee;
$_SESSION['cart'][0]['petticot']=$petticot;
$_SESSION['cart'][0]['petticotsize']=$petticotsize;
$_SESSION['cart'][0]['presttiched']=$presttiched;
}
}

?>

Popular posts from this blog

Simple Sign up design. Android.

Cart page design in android.

Set Date on jDateChooser and retrieve record from database.