/home/banprang/domains/plai.go.th/public_html/coremain/module/product/product_show_promotion.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php

// date now
$date=date("d");
$month=date("m");
$year=date("Y");
$yearthai=$year+543;
$datenow=$yearthai.$month.$date;

// $sql for main promotion menu
$result_promotionselect_result_query("*","cms_product","is_promotion","1"," and start_promo<='$datenow' and end_promo>='$datenow' LIMIT 0,4");
$count_promotion select_count("*","cms_product","is_promotion=1 and start_promo<='$datenow' and end_promo>='$datenow'
"
);

// $sql for new product
$result_productselect_result_query("*","cms_product","is_new_product","1"," and start_new<='$datenow' and end_new>='$datenow' LIMIT 0,4");
$count_product select_count("*","cms_product","is_new_product=1 and start_new<='$datenow' and end_new>='$datenow'");


// ****************************** main Link *******************************
if ($count_promotion!=0)
{
bar_header("สินค้าโปรโมชั่น"); // Bar_Header
    
$want_tr=0;
    
$num_promotion 0// initial count
    
echo "<table align='center' border='0' width='100%'>";
    
    while (
$data_promotionmysql_fetch_array ($result_promotion))
    {
        if (
$num_promotion%2==0)
        {
            echo 
"<tr>";
            
$want_tr1;
        }    
            
        echo 
"<td width='50%'>";
        
        echo 
"<table widht='100%' border='0' align='center'>";
            echo 
"<tr>";
                echo 
"<td align='center'>";
                    
picture_frame($_SESSION[web_name]."/module_product/picture/$data_promotion[picture]","index.php?mod=product_sub_detail&path=product&id_product=$data_promotion[id_product]");
                echo 
"</td>";
            echo 
"</tr>";    
        echo 
"<tr>";
            echo 
"<td align='center'>$data_promotion[description]</td>";
        echo 
"<tr/>";
        echo
"</table>";
        
    
        
        if (
$num_promotion%2!=0)
        {
            echo 
"<tr>";
            
$want_tr0;
        }    
        
             
$num_promotion++;
    } 
// end while
    
if($want_tr==1)
    echo 
"</tr>";
    
    echo 
"</table>";
    if (
$count_promotion>4)
    echo 
"<div align=right><a href='index.php?mod=product_view_profull&path=product'><b><font color='blue'>มีต่อ>>></font></b>&nbsp;&nbsp;</div>";
    
}

if (
$count_product!=0)
{
echo 
"<br/>";
bar_header("สินค้าใหม่"); // Bar_Header
    
$want_tr=0;
    
$num_product 0// initial count
    
echo "<table align='center' border='0' width='100%'>";
    
    while (
$data_productmysql_fetch_array ($result_product))
    {
        if (
$num_product%2==0)
        {
            echo 
"<tr>";
            
$want_tr1;
        }    
            
        echo 
"<td width='50%'>";
        
        echo 
"<table widht='100%' border='0' align='center'>";
            echo 
"<tr>";
                echo 
"<td align='center'>";
                    
picture_frame($_SESSION[web_name]."/module_product/picture/$data_product[picture]","index.php?mod=product_sub_detail&path=product&id_product=$data_product[id_product]");
                echo 
"</td>";
            echo 
"</tr>";    
        echo 
"<tr>";
            echo 
"<td align='center'>$data_product[description]</td>";
        echo 
"<tr/>";
        echo
"</table>";
        
    
        
        if (
$num_product%2!=0)
        {
            echo 
"<tr>";
            
$want_tr0;
        }    
        
             
$num_product++;
    } 
// end while
    
if($want_tr==1)
    echo 
"</tr>";
    echo 
"</table>";
    if (
$count_product>4)
    echo 
"<div align=right><a href='index.php?mod=product_view_newfull&path=product'><b><font color='blue'>มีต่อ>>></font></b></a>&nbsp;&nbsp;</div>";
    
    
}
?>
<script language="javascript">
    function del_confirm(){
        return confirm("ต้องการจะลบข้อมูลใช่หรือไม่");
    }
</script>