$order_total = $price;
 $order_subtotal = $price;
 $order_shipping = 0;
 $order_tax = 0;
 $coupon_discount = 0;
 $coupon_code = '';
 $order_discount = 0;
 $usermessage = $_SESSION['shoopin_cart']['usermessage'];
 $ip = getRealIpAddr();
 $sql = "INSERT INTO `" . $prefix . "orders` (`user_id`,`order_total`,`order_subtotal`,`order_tax`,`order_shipping`,`coupon_discount`, `coupon_code`,`order_discount`, `order_currency`, `order_status`, `cdate`, `mdate`, `ip_address`, `gateway_name`, `usermessage`) VALUES ('{$user_id}', '{$order_total}', '{$order_subtotal}', '{$order_tax}', '{$order_shipping}', '{$coupon_discount}','{$coupon_code}', '{$order_discount}', '{$currency}', 'P', now(), now(), '{$ip}', '{$gateway_name}','{$usermessage}')";
 $result = $wpdb->query($sql);
 $order_id = $wpdb->insert_id;
 $cnt = 1;
 for ($i = 0; $i < count($_SESSION['shoopin_cart']['temple_id']); $i++) {
     $temple = templedetail($_SESSION['shoopin_cart']['temple_id'][$i]);
     $package = packagedetail($_SESSION['shoopin_cart']['package_id'][$i]);
     $package_date = $_SESSION['shoopin_cart']['poojadate'][$i];
     $product_item_price = $_SESSION['shoopin_cart']['price'][$i];
     $temple_id = $_SESSION['shoopin_cart']['temple_id'][$i];
     $product_quantity = 1;
     $product_final_price = $_SESSION['shoopin_cart']['price'][$i] * $product_quantity;
     $order_item_name = $temple[0]->name . ' (' . $package[0]->title . ')';
     $package_name = $package[0]->title;
     $temple_name = $temple[0]->name;
     $package_type_id = $package[0]->package_type_id;
     $package_id = $package[0]->id;
     $packagetypes = packagetypedetail($package_type_id);
     $package_type_name = $packagetypes[0]->package_type;
     $commission2 = $product_quantity * $patr->marketer_commission;
     $commission3 = $product_quantity * $patr->bc_commission;
     $totalbccommission = $totalbccommission + $commission3;
<?php

global $wpdb;
$prefix = $wpdb->base_prefix;
$id = $_REQUEST['id'];
$pack = packagedetail($id);
$package_type_id = $pack[0]->package_type_id;
$link = '&ho=listpackages&id=' . $package_type_id;
$result = $wpdb->query("DELETE FROM `" . $prefix . "temple_package_price` where package_id='{$id}'");
$result = $wpdb->query("DELETE FROM `" . $prefix . "temple_packages` where id='{$id}'");
if ($result == 1) {
    $url = get_option('home') . '/wp-admin/admin.php?page=ManagePackages&del=succ' . $link;
    echo "<script>window.location='" . $url . "'</script>";
}
$urchavar = Templeoption($temple_id, 'urchavar');
$mother = Templeoption($temple_id, 'mother');
$sacredtree = Templeoption($temple_id, 'sacredtree');
$tirtha = Templeoption($temple_id, 'tirtha');
$ecclesiasticus_pooja = Templeoption($temple_id, 'ecclesiasticus_pooja');
$creepy = Templeoption($temple_id, 'creepy');
$legendary_name = Templeoption($temple_id, 'legendary_name');
$trail = Templeoption($temple_id, 'trail');
$querystr = "SELECT * FROM " . $prefix . "temple_state";
$states = $wpdb->get_results($querystr, OBJECT);
$querystr1 = "SELECT * FROM " . $prefix . "temple_city";
$cities = $wpdb->get_results($querystr1, OBJECT);
$querystr2 = "SELECT * FROM " . $prefix . "temple_god";
$gods = $wpdb->get_results($querystr2, OBJECT);
$packagetypes = packagetypedetail();
$packages = packagedetail("", " order by package_type_id asc");
$templeprices = templeprices($temple_id);
$package_type_id = $templeprices[0]->package_type_id;
if (isset($_POST['registration'])) {
    $name = $_POST['name'];
    if (trim($name) == '') {
        array($error, 'Please enter temple name.');
    }
    $god_id = $_POST['god_id'];
    if (count($god_id) <= 0) {
        array($error, 'Please select atleast one God.');
    }
    $state_id = $_POST['stateid'];
    $city_id = $_POST['city'];
    $googleaddress = trim($_POST['googleaddress']);
    $district_id = $_POST['district_id'];
        ?>
" />
				  </div>
				 <?php 
    }
    ?>
				 <p><?php 
    echo $temple->inthetemple;
    ?>
</p>
				 <div class="clr"></div>
				 
				 <?php 
    foreach ($templeprices as $templeprice) {
        $packagetype = packagetypedetail($templeprice->package_type_id);
        $package = packagedetail($templeprice->package_id);
        ?>
<div class="addtocartform">
			<form name="shopping" class="shoppingcart" method="post" action="">
				<input type="hidden" name="temple_id" value="<?php 
        echo $temple_id;
        ?>
" />
				
				<p class="price"><?php 
        _e($package[0]->title);
        ?>
 <span><?php 
        _e($currency_symbal . $templeprice->price);
        ?>
</span></p>