示例#1
0
if (isset($_REQUEST['logout'])) {
    session_destroy();
    header("Location: login.php");
}
function currenturl()
{
    $pageURL = 'http';
    $pageURL .= "://";
    if ($_SERVER["SERVER_PORT"] != "80") {
        $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
    } else {
        $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
    }
    return $pageURL;
}
$_SESSION['storeurl'] = currenturl();
$shoppinglist = $_SESSION['shoppinglist'];
$inventory = $_SESSION['inventory'];
$victory_check = array_diff($shoppinglist, $inventory);
if ($victory_check == array()) {
    header("Location: success.php");
}
echo '<h1 class="storeitemtext">Items Needed:';
foreach ($_SESSION['shoppinglist'] as $item) {
    $image = $_SESSION['items'][$item]['name'];
    echo '<img src="images/items/' . $image . '.png" class="storeitem">';
}
echo "</h1>";
echo "<br/><br/>";
echo '<h1 class="storeitemtext">Inventory:';
foreach ($_SESSION['inventory'] as $item) {
示例#2
0
?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>    
<meta name="description" content="<?php 
echo !empty($desc) ? $desc : TITLE_DEFAULT;
?>
"/>
<meta name="keywords" content="<?php 
echo !empty($keyword) ? $keyword : TITLE_DEFAULT;
?>
"/>
<meta name="revisit-after" content="1 days"/>
<meta name="dc.title" content="<?php 
echo !empty($title) ? $title : TITLE_DEFAULT;
?>
"/>
<meta name="geo.placename" content="Vietnamese"/>
<meta name="geo.position" content="106.69428, 10.78563"/>
<meta name="geo.region" content="Vietnamese"/>
<meta name="ICBM" content="106.69428, 10.78563"/>
<meta name="language" content="VN"/>
<meta http-equiv="Content-Language" content="vi"/>
<meta name="google-site-verification" content="Rg9Fx2NcJCZ_0D2rWCZh0FNVParQ-qMStL2uJbVZ4v0"/>

<meta name="author" content="Canhosaigon.com.vn"/>

<meta name="robots" content="NOODP, index, follow"/>
<link rel="canonical" href="<?php 
echo currenturl();
?>
"/>
    function productview($pid)
    {
        function currenturl()
        {
            $_SESSION['curr_url'] = $_SERVER["REQUEST_URI"];
        }
        ?>
		<script type="text/javascript" src="components/com_dealcatalog/js/jquery1.7.js"></script>
		<script type="text/javascript" src="components/com_dealcatalog/js/jquery.fancybox.js"></script>		
		<link rel="stylesheet" type="text/css" href="components/com_dealcatalog/js/jquery.fancybox.css" media="screen" />
		<script type="text/javascript">
			$(document).ready(function() {
				$(".fancybox").fancybox();
			});
		</script>
		<script language="javascript" type="text/javascript">
			function sent_coupon()
			{
				document.coupon.submit();
			}
			function current_url()
			{
				b = "<?php 
        currenturl();
        ?>
";
			}
		</script>
		<?php 
        $user =& JFactory::getUser();
        $userid = $user->id;
        $username = $user->name;
        $useremail = $user->email;
        $db =& JFactory::getDBO();
        $today_date = date('Y-m-d');
        $query = "select a.*,b.product_name,b.product_code,b.product_image1,b.product_thumbimage1,b.product_desc,c.category_name,d.manufacturer_name,e.company_name,e.address1,e.address2,e.email_id,e.Contact_number,e.city,e.states,e.location_map from #__deal_productslisting_deals as a,#__deal_products as b,#__deal_productcategories as c,#__deal_manufacturer as d,#__deal_merchants as e where a.id='{$pid}' and a.stock_in='1' and a.product_id=b.id and b.category_id=c.id and b.manufacturer_id=d.id and a.vendor_id=e.id and a.listingstart_date <= '{$today_date}' and a.listingend_date >= '{$today_date}'";
        $db->setQuery($query);
        $product = $db->loadAssocList();
        foreach ($product as $row) {
            //values of product list
            $productlistid = $row['id'];
            $product_id = $row['product_id'];
            $vendor_id = $row['vendor_id'];
            $product_name = $row['product_name'];
            $product_code = $row['product_code'];
            $category = $row['category_name'];
            $manufacturer = $row['manufacturer_name'];
            $company = $row['company_name'];
            $address = $row['address1'] . " " . $row['address2'] . " , " . $row['city'] . " " . $row['states'];
            $contact_number = $row['Contact_number'];
            $email = $row['email_id'];
            $location = $row['location_map'];
            $price = $row['price'];
            $discount_price = $row['discount_price'];
            $product_close = $row['listingend_date'];
            $isdeal = $row['is_deal'];
            $deal_price = $row['deal_price'];
            $dealstart = $row['dealstart_date'];
            $dealclose = $row['dealend_date'];
            $product_desc = $row['product_desc'];
            $merchant_desc = $row['merchantproduct_desc'];
            $pimage = $row['product_image1'];
            $pimage1 = $row['product_thumbimage1'];
            $merchantimage = $row['merchantproduct_image1'];
            $merchantimage1 = $row['merchantproduct_thumbimage1'];
            //Product Image
            if ($merchantimage != '') {
                $image = substr($merchantimage, 3);
                $thumb_image = substr($merchantimage1, 3);
            } else {
                $image = substr($pimage, 3);
                $thumb_image = substr($pimage1, 3);
            }
            //Product Description
            if ($merchant_desc != '') {
                $desc = $merchant_desc;
            } else {
                $desc = $product_desc;
            }
            //Price difference
            if ($deal_price != 0.0) {
                $deal = $price - $deal_price;
            } else {
                $deal = 0.0;
            }
            if ($discount_price != 0.0) {
                $discount = $price - $discount_price;
            } else {
                $discount = 0.0;
            }
            //Deal and Discount percentage
            if ($deal_price != 0.0) {
                $per = $price - $deal_price;
                $per = $per / $price * 100;
                $per = round($per, 2);
                $per = $per . "%";
            } else {
                $per = "0%";
            }
            if ($discount_price != 0.0) {
                $per1 = $price - $discount_price;
                $per1 = $per1 / $price * 100;
                $per1 = round($per1, 2);
                $per1 = $per1 . "%";
            } else {
                $per1 = "0%";
            }
            //date comparison
            $today = strtotime($today_date);
            $dealstarts = strtotime($dealstart);
            $dealends = strtotime($dealclose);
            //Facebook Code
            function getPostURL()
            {
                $postURL = 'http';
                if ($_SERVER["HTTPS"] == "on") {
                    $postURL .= "s";
                }
                $postURL .= "://";
                if ($_SERVER["SERVER_PORT"] != "80") {
                    $postURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
                } else {
                    $postURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
                }
                return $postURL;
            }
            $postURL = getPostURL();
            //Coupon code
            $query = "select coupon_code from #__deal_coupons where users_userid='{$userid}' and product_id='{$product_id}'";
            $db->setQuery($query);
            $copon = $db->loadRow();
            $codes = $copon[0];
            if ($codes != '') {
                $coupon = $codes;
            } else {
                $characters = '5';
                $possible = '23456789bcdfghjkmnpqrstvwxyzBCDEFGHIJKLMNPQURSTUVWXYZ';
                $code = '';
                $i = 0;
                while ($i < $characters) {
                    $code .= substr($possible, mt_rand(0, strlen($possible) - 1), 1);
                    $i++;
                }
                $coupon = $code;
            }
            //product count
            $query = "select product_viewcount from #__deal_productcounts where product_id='{$product_id}' and vendor_id='{$vendor_id}'";
            $db->setQuery($query);
            $ct = $db->loadRow();
            $cts = $ct[0];
            if ($cts == 0) {
                $cts = $cts + 1;
                $query = "insert into #__deal_productcounts (`product_id`, `vendor_id`, `product_viewcount`, `product_couponcount`) values ('{$product_id}', '{$vendor_id}', '{$cts}', '')";
                $db->setQuery($query);
                $db->query();
            } else {
                $cts = $cts + 1;
                $query = "update #__deal_productcounts set `product_viewcount`='{$cts}' where product_id='{$product_id}' and vendor_id='{$vendor_id}'";
                $db->setQuery($query);
                $db->query();
            }
            ?>
			<div id="single_product">
				<div id="product_head">
					<div class="head1">
						<div class="head_text"> Customer Choice </div>
						<div class="choice"> <img src="components/com_dealcatalog/icon_7.png"> </div> 
						<div class="choice_image"> <img src="<?php 
            echo $thumb_image;
            ?>
">  </div> 
					</div>
					<div class="head2">
						<div> <b> <h2> <?php 
            echo $product_name;
            ?>
 </h2> </b> </div>
						<div> Checkout this product with  <b> Deal </b> or <b> Discount </b> price and signup to get if Deal Coupon code exits</div>
					</div>
				</div>
				<div class="back1">
					<a href="javascript:history.back()">Go back</a> 
				</div>
				<div class="back">
					<a href='index.php?option=com_dealcatalog&task=productslisting&Itemid=<?php 
            echo $_REQUEST['Itemid'];
            ?>
'> View Product Listings </a>
				</div>
				<div class="phead">
					<?php 
            if ($isdeal == 1 && ($dealstarts <= $today && $dealends >= $today) && $deal > $discount) {
                ?>
						<h2> <?php 
                echo $product_name;
                ?>
  <?php 
                echo $per;
                ?>
 Deal off from <?php 
                echo $company;
                ?>
 </h2>
					<?php 
            } else {
                if ($deal == 0 && $discount == 0.0) {
                    ?>
							<h2> <?php 
                    echo $product_name;
                    ?>
  from <?php 
                    echo $company;
                    ?>
 </h2>
						<?php 
                } else {
                    ?>
							<h2> <?php 
                    echo $product_name;
                    ?>
  <?php 
                    echo $per1;
                    ?>
 Discount off from <?php 
                    echo $company;
                    ?>
 </h2>
						<?php 
                }
            }
            ?>
				</div>
				<div id="image_fb">
					<div class="big_image">
						<a class="fancybox" href="<?php 
            echo $image;
            ?>
" title="<?php 
            echo $product_name;
            ?>
">
							<img src="<?php 
            echo $thumb_image;
            ?>
" />
						</a>
					</div>
					<div class="fb_like">
						<?php 
            echo '<iframe src="http://www.facebook.com/widgets/like.php?href=' . $postURL . '"
								scrolling="no" frameborder="0"
								style="border:none; width:450px; height:40px"></iframe>';
            ?>
					</div>
					<?php 
            if ($isdeal == 1 && ($dealstarts <= $today && $dealends >= $today)) {
                ?>
						<div id="coupon">
							<?php 
                if ($userid == 0) {
                    ?>
									Coupon Code &nbsp;&nbsp; <a class="fancybox" href="#customerlogin" title="Customer Login"> Login </a>&nbsp; / &nbsp;&nbsp;&nbsp;<a href="index.php?option=com_dealcatalog&task=customerregister&Itemid=<?php 
                    echo $_REQUEST['Itemid'];
                    ?>
" onClick="current_url();"> Register </a>
									<div id="customerlogin" style="display:none;">
										<?php 
                    $document =& JFactory::getDocument();
                    $renderer = $document->loadRenderer('modules');
                    $options = array('style' => 'xhtml');
                    $position = 'customerlogin';
                    echo $renderer->render($position, $options, null);
                    ?>
									 </div>
									<?php 
                } else {
                    ?>
									<form name="coupon" action="index.php?option=com_dealcatalog&task=coupon_email&Itemid=<?php 
                    echo $_REQUEST['Itemid'];
                    ?>
" method="post">
										<?php 
                    if ($codes != '') {
                        ?>
											<span class="coupon_text" onClick="sent_coupon();"> Sent the Coupon code again </span>
											<?php 
                    } else {
                        ?>
											<span class="coupon_text" onClick="sent_coupon();"> Email the Coupon Code </span>
											<?php 
                    }
                    ?>
										<input type="hidden" name="action" value="<?php 
                    echo $_SERVER["REQUEST_URI"];
                    ?>
">
										<input type="hidden" name="customername" value="<?php 
                    echo $username;
                    ?>
">
										<input type="hidden" name="customeremail" value="<?php 
                    echo $useremail;
                    ?>
">
										<input type="hidden" name="couponcode" value="<?php 
                    echo $coupon;
                    ?>
">
										<input type="hidden" name="vendorcompany" value="<?php 
                    echo $company;
                    ?>
">
										<input type="hidden" name="vendoremail" value="<?php 
                    echo $email;
                    ?>
">
										<input type="hidden" name="productname" value="<?php 
                    echo $product_name;
                    ?>
">
										<input type="hidden" name="vendor_id" value="<?php 
                    echo $vendor_id;
                    ?>
">
										<input type="hidden" name="product_id" value="<?php 
                    echo $product_id;
                    ?>
">
										<input type="hidden" name="users_userid" value="<?php 
                    echo $userid;
                    ?>
">
									</form>
									<?php 
                }
                ?>
						</div>
					<?php 
            }
            ?>
				</div>
				<div id="product_details">
					<div class="details_view">
						<div class="details_title">
							Merchant Name
						</div>
						<div class="details_names">
							<?php 
            echo $company;
            ?>
						</div>
						<div class="details_title1">
							Product Name
						</div>
						<div class="details_names1">
							<?php 
            echo $product_name;
            ?>
						</div>
						<div class="details_title">
							Category Name
						</div>
						<div class="details_names">
							<?php 
            echo $category;
            ?>
						</div>
						<div class="details_title1">
							Manufacturer Name
						</div>
						<div class="details_names1">
							<?php 
            echo $manufacturer;
            ?>
						</div>
						<div class="details_title">
							Price
						</div>
						<div class="details_names">
							<?php 
            echo $price;
            ?>
						</div>
						<?php 
            if ($deal > $discount && ($dealstarts <= $today && $dealends >= $today) && $isdeal == 1) {
                ?>
							<div class="details_title1">
								Deal Price
							</div>
							<div class="details_names12">
								<?php 
                echo $deal_price;
                ?>
							</div>
							<?php 
            } else {
                if ($deal == 0 && $discount == 0.0) {
                    ?>
								<div class="details_title1">
									Offers
								</div>
								<div class="details_names12">
									<?php 
                    echo "---";
                    ?>
								</div>
								<?php 
                } else {
                    ?>
								<div class="details_title1">
									Discount Price
								</div>
								<div class="details_names12">
									<?php 
                    echo $discount_price;
                    ?>
								</div>
								<?php 
                }
            }
            ?>
						<div class="details_title">
							Address
						</div>
						<div class="details_names">
							<?php 
            echo $address;
            ?>
						</div>
						<div class="details_title1">
							Contact Number
						</div>
						<div class="details_names1">
							<?php 
            echo $contact_number;
            ?>
						</div>
						<div class="details_title">
							Purchase Mode
						</div>
						<div class="details_names">
							Instore Online
						</div>
						<div class="details_title1">
							Product Description
						</div>
						<div class="details_names1">
							<?php 
            echo $desc;
            ?>
						</div>
					</div>
					<div class="location">
						<?php 
            echo $row['location_map'];
            ?>
					</div>
				</div>
			</div>
			<?php 
        }
    }