select("packages","*"," where id=$id ","","",0,1); $package_task->select("package_tasks","*"," where package_id=$id ","id","ASC",0,0); if(isset($_SESSION['customer_id'])) $customer_id = $_SESSION['customer_id'] ; else{ header("location:login-registration.php?msg=Login or Register Yourself to buy or book any SEO, SMO, Digital Marketing or Web Services packages.#loginfirst"); die; } $dt = date("Y-m-d H:i:s"); if($_SESSION['order_id']>0){ $order_id = $_SESSION['order_id']; $order->select("order_items","*"," where package_id='".$id."' and order_id = '".$order_id."' " , "","",0,1); if($order->n_result == 1){ $message = "Already addedd in cart"; $order->insert("order_items", array('order_id','package_id','package_title','short_description','complete_description','actual_price','offer_price','completion_days'), array($order_id,$id,$package->result_set[0]['package_title'],$package->result_set[0]['short_description'], $package->result_set[0]['complete_description'],$package->result_set[0]['actual_price'],$package->result_set[0]['offer_price'],$package->result_set[0]['completion_days']) ); $order_item_id = $order->insert_id; for($i=0;$i<$package_task->n_result;$i++){ $order->insert( "order_tasks", array( 'order_id','order_item_id','customer_id','task','is_complete'), array( $order_id,$order_item_id, $_SESSION['customer_id'] , $package_task->result_set[$i]['task'] , '0' ) ); } } else{ $order->insert("order_items", array('order_id','package_id','package_title','short_description','complete_description','actual_price','offer_price','completion_days'), array($order_id,$id,$package->result_set[0]['package_title'],$package->result_set[0]['short_description'], $package->result_set[0]['complete_description'],$package->result_set[0]['actual_price'],$package->result_set[0]['offer_price'],$package->result_set[0]['completion_days']) ); $order_item_id = $order->insert_id; for($i=0;$i<$package_task->n_result;$i++){ $order->insert( "order_tasks", array( 'order_id','order_item_id','customer_id','task','is_complete'), array( $order_id,$order_item_id, $_SESSION['customer_id'] , $package_task->result_set[$i]['task'] , '0' ) ); } } } else{ $order->insert("orders",array('order_date','order_status','customer_id'),array($dt,'pending',$customer_id)); $order_id = $order->insert_id; $_SESSION['order_id'] = $order_id; $order->insert("order_items", array('order_id','package_id','package_title','short_description','complete_description','actual_price','offer_price','completion_days'), array($order_id,$id,$package->result_set[0]['package_title'],$package->result_set[0]['short_description'], $package->result_set[0]['complete_description'],$package->result_set[0]['actual_price'],$package->result_set[0]['offer_price'],$package->result_set[0]['completion_days']) ); $order_item_id = $order->insert_id; for($i=0;$i<$package_task->n_result;$i++){ $order->insert( "order_tasks", array( 'order_id','order_item_id','customer_id','task','is_complete'), array( $order_id,$order_item_id, $_SESSION['customer_id'] , $package_task->result_set[$i]['task'] , '0' ) ); } } $referral = $_SERVER["HTTP_REFERER"]; header("location:pack_viewcart.php?ref=$referral"); die; ?>