| Server IP : 104.21.37.246 / Your IP : 104.23.243.33 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home2/cp648411/public_html/simded.com/shop/control/themes/ |
Upload File : |
<?php
$sql_s = 'id_shop = "'.$id_shop.'"';
$orderby = '';
if($row_ss['sort_ber'] == 'update_DESC')
{
$orderby = 'ORDER BY id DESC';
}
else if($row_ss['sort_ber'] == 'random')
{
$orderby = 'ORDER BY RAND()';
}
else if($row_ss['sort_ber'] == 'price_max')
{
$orderby = 'ORDER BY price DESC';
}
else if($row_ss['sort_ber'] == 'price_min')
{
$orderby = 'ORDER BY price ASC';
}
else if($row_ss['sort_ber'] == 'sum_min')
{
$orderby = 'ORDER BY total ASC';
}
else if($row_ss['sort_ber'] == 'sum_max')
{
$orderby = 'ORDER BY total DESC';
}
/*else if($row_ss['sort_ber'] == 'number_min')
{
$orderby = 'ORDER BY id DESC';
}
else if($row_ss['sort_ber'] == 'number_max')
{
$orderby = 'ORDER BY id DESC';
}*/
//print_r($row_ss);
$max_rows = $row_ss['limits'];
//$max_rows = 10; // แสดงจำนวนแถวต่อหน้า
$page_number = 0;
if(isset($_GET['page_number']))
{
$page_number = $_GET['page_number'];
}
$all_array = array('table'=>'phonenumber','where'=>$sql_s);
$start_row = $page_number * $max_rows;
$all_sql = $view_db->view($all_array);
$all_result = $view_db->q_re($all_sql);
$total_rows = $view_db->q_nr($all_result);
$total_rows_num = mysqli_num_rows($all_result);
$list_pd = array('table'=>'package_detail','where'=> 'id_shop = "'.$id_shop.'"');
$result_pd = $view_db->view($list_pd);
$row_pd = $view_db->q($result_pd);
if($row_pd['bermax'] <> 'unlimited')
{
if($total_rows > $row_pd['bermax'])
{
//$total_rows = $row_pd['bermax'];
$total_pages = ceil($total_rows/$max_rows)-1;
if($max_rows > $row_pd['bermax'])
{
$max_rows = $row_pd['bermax'];
}
else
{
if($_GET['page_number'] == $total_pages)
{
if($max_rows > $total_rows)
{
$max_rows = $max_rows - $total_rows;
}
elseif($max_rows < $total_rows)
{
$max_rows = $total_rows - $max_rows;
}else{
$max_rows =$max_rows;
}
}
}
}
else
{
$total_pages = ceil($total_rows/$max_rows)-1;
}
}
else
{
$total_pages = ceil($total_rows/$max_rows)-1;
}
////////////////////////////////////////
$list = array('table'=>'phonenumber', 'where'=>$sql_s, 'limit'=> "$start_row,$max_rows", 'order'=> $orderby );
$view = $view_db->view($list);
$result = $view_db->q_re($view);
$num_tr = 1;
$num = 1+($page_number*$max_rows);
?>
<div class="row">
<div class="col-md-12 py-3" >
<div>
<div class="row">
<div class="col-md-6" style="margin-bottom:5px;">
<p class="HeadTextL mb-0 text-spacing-md fw-bold text-light">เบอร์เด็ดประจำร้าน</p>
</div>
</div>
<div class="row">
<?php
$num=1;
while($row = $view_db->q_ro($result)){
$phonenumber = $Phone_class->format_phonenumber($row['phonenumber'],$row['format']);
$row_mobilenetwork = $actiondata_db->q_one('mobilenetwork','id = "'.$row['mobilenetwork'].'"','image');
$row_totalnumber = $actiondata_db->q_one('totalnumber','number = "'.$row['total'].'"','title');
if($row_totalnumber==2){$row_totalnumber = '';}
$list_shr = array('table'=>'shop','where'=>'id = "'.$row['id_shop'].'" ');
$view_shr = $view_db->view($list_shr);
$row_shr = $view_db->q($view_shr);
$countber = $util_class->countber($row_shr['id']);
$txt_phonenumber = $Phone_class->phonecomma($row_shr['phone']);
if($row_shr['image_profile']){ $image_profile = $row_shr['image_profile']; }
else { $image_profile = ''; }
$phonenumber = $Phone_class->format_phonenumber($row['phonenumber'],$row['format']);
$price = $row['price']-1;
?>
<div class="col-12 col-md-4">
<div class="BoxRecom rounded-sim2 box-s1 text-spacing-md fw-bold">
<div class="pt-3 d-flex justify-content-center" align="center" style="cursor:pointer"
onclick="like(<?php echo $_SESSION["simDed_login"];?>,<?php echo $row['id'] ;?>)">
<span id="hidefavorite"></span>
<i class="fa fa-heart" style="font-size:18px;color:gray; "></i>
<span class="text-danger-sim ps-2" tabindex="-1" aria-disabled="true">เบอร์โปรด</span>
</div>
<div class="" align="center">
<span class="BerDedToday-ber fs-2" role="button" tabindex="0"><?php echo $phonenumber; ?></span>
</div>
<div class="px-0"><div class="borber-bottom-sim "></div></div>
<div class="row align-items-center text-spacing-md text-spacing-md fw-bold" style="height: 60px;">
<?php $css_size=''; if(strlen($row_totalnumber)>= 60){$css_size = 'font-size: 13px;';} ?>
<div class="col-8 ps-4 text-start">
<div class="col-xs-12 BerDedToday-sum fw-bold text-success-sim" role="button" tabindex="0"> ผลรวม <?php echo $row['total']?> </div>
<div class="col-xs-12 BerDedToday-price fw-bold text-primary-sim" style="<?php echo $css_size; ?>"> <?php echo $row_totalnumber;?> </div>
</div>
<div class="col-4">
<img src="<?php echo $upload ?>mobilenetwork/<?php echo $row_mobilenetwork ?>" width="60" class="img-fluid" role="button" tabindex="0">
</div>
</div>
<div class="px-0"><div class="borber-bottom-sim "></div></div>
<div class="" align="center">
<div class="col-12 fw-bold fs-3 " role="button" tabindex="0"> ราคา <?php echo number_format($row['price'])?> บาท </div>
</div>
<div class="row justify-content-center">
<div class="col-9 col-md-9 mb-3">
<!--
<a href="../cart/index.php?p=<?php echo $row['phonenumber'] ;?>"
class="btn btn-danger-sim fs-5 fw-bold rounded-sim w-100 box-sim1 lh-sim">สั่งซื้อเบอร์</a>
-->
<button type="button" name="button" class="btn btn-danger-sim fs-4 text-spacing-md fw-bold rounded-sim w-100 box-sim1 lh-sim"
onclick="cart('<?php echo $row['id'] ;?>')">สั่งซื้อเบอร์</button>
</div>
</div>
</div>
</div>
<?php $num++; } ?>
</div>
<?php
if($total_rows == 0)
{
?>
<div align="center" class=" text-spacing-md fw-bold" style="padding-top:20px;color:#F00;font-size:18px;">--- ไม่พบข้อมูล ---</div>
<?php } ?>
<div class="row">
<div class="col-12 mt-3">
<?php if($total_rows_num > 0){ ?>
<div class="btn-toolbar justify-content-center" role="toolbar" aria-label="Toolbar with button groups">
<div class="btn-group me-2 text-spacing-md fw-bold" role="group" aria-label="Second group">
<button type="button" class="btn btn-secondary rounded-circle me-1 <?php if($page_number == 0){?>active<?php }?>"
onclick="window.location.href='index.php?page_number=0'" style="min-width: 38px;">1
</button>
<?php
if($total_pages >= 7)
{
$n = $page_number-1;
if($n < 0){$n = 0;}
?>
<button type="button" class="btn btn-secondary rounded-pill me-1" onclick="window.location.href='index.php?page_number=<?php echo $n ?>'"> << </button>
<?php
}
if($total_pages >= 7)
{
$p_end = $total_pages - 3;
if($page_number > 3 && $page_number >= $p_end)
{
$lop_p = $total_pages-1;
$start_p = $p_end-1;
}else{
if($page_number == 0){
$start_p = 1;
$lop_p = 4;
}
else{
$start_p = $page_number;
$lop_p = $page_number+3;
}
}
}
else
{ $lop_p = $total_pages - 1; $start_p = 1;}
for($a=$start_p;$a<=$lop_p;++$a)
{
$b = $a + 1 ;
if($a==$page_number)
{
?>
<button type="button" class="btn btn-secondary <?php echo ($b>9)?'rounded-pill':'rounded-circle'; ?> me-1 active"
onclick="window.location.href='index.php?page_number=<?php echo $a?>'" style="min-width: 38px;"> <?php echo $b; ?></button>
<?php
}
else
{
?>
<button type="button" class="btn btn-secondary <?php echo ($b>9)?'rounded-pill':'rounded-circle'; ?> me-1"
onclick="window.location.href='index.php?page_number=<?php echo $a?>'" style="min-width: 38px;"><?php echo $b; ?></button>
<?php
}
}
if($total_pages >= 7)
{
$p = $page_number+1;
if($p >= $total_pages){$p = $total_pages;}
?>
<button type="button" class="btn btn-secondary rounded-pill me-1" onclick="window.location.href='index.php?page_number=<?php echo $p ?>'"> >> </button>
<?php
}
if($total_pages > 0)
{
$total_pages_x = $total_pages+1;
?>
<button type="button" class="btn btn-secondary <?php echo ($total_pages_x>9)?'rounded-pill':'rounded-circle'; ?> me-1 <?php if($page_number == $total_pages){?>active<?php }?>"
onclick="window.location.href='index.php?page_number=<?php echo $total_pages ?>'" style="min-width: 38px;"><?php echo $total_pages+1 ?></button>
<?php } ?>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
<script>
/*
function cart(var1)
{
swal(
'สั่งซื้อสินค้า!',
'เพิ่มสินค้าในตะกร้าเรียบร้อยแล้วค่ะ',
'success'
)
$.ajax({
url: "../../control/include/ajax_cart.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: 'id='+var1,
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
//testHoldon_cl('sk-circle');
$("#alert_cart").html(data);
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById('alert_cart_ok').innerHTML = this.responseText;
$('#alert_cart_ok').dropdown('toggle');
}
};
xmlhttp.open("GET", "../../control/include/ajax_cartlist.php", true);
xmlhttp.send();
}
});
}
*/
function cart(var1)
{
swal(
'สั่งซื้อสินค้า!',
'เพิ่มสินค้าในตะกร้าเรียบร้อยแล้วค่ะ',
'success'
)
$.ajax({
url: "../../control/include/ajax_cart.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: 'id='+var1,
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
//testHoldon_cl('sk-circle');
var some = screen.width;
if(some<789){
$("#alert_cart2").html(data);
}else{
$("#alert_cart").html(data);
}
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById('alert_cart_ok').focus();
$('.dropdown-toggle').dropdown('update');
if(some<789){
document.getElementById('alert_cart_ok2').innerHTML = this.responseText;
}else{
document.getElementById('alert_cart_ok').innerHTML = this.responseText;
}
}
};
xmlhttp.open("GET", "../../control/include/ajax_cartlist.php", true);
xmlhttp.send();
}
});
}
function cart2(var1)
{
swal(
'สั่งซื้อสินค้า!',
'เพิ่มสินค้าในตะกร้าเรียบร้อยแล้วค่ะ',
'success'
)
$.ajax({
url: "../../control/include/ajax_cart.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: 'id='+var1,
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
//testHoldon_cl('sk-circle');
$("#alert_cart2").html(data);
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById('alert_cart_ok2').innerHTML = this.responseText;
$('#alert_cart_ok2').dropdown('toggle');
document.getElementById('alert_cart_ok').innerHTML = this.responseText;
$('#alert_cart_ok').dropdown('toggle');
}
};
xmlhttp.open("GET", "../../control/include/ajax_cartlist.php", true);
xmlhttp.send();
}
});
}
</script>