1 | <?php |
---|
2 | defined('MPS_PATH') or die('Hacking attempt!'); |
---|
3 | |
---|
4 | //change product check |
---|
5 | if(isset($_POST['imgid'])) { |
---|
6 | $imgid = $_POST['imgid']; |
---|
7 | $imgen = array($imgid); |
---|
8 | |
---|
9 | if (!isset($_POST['productcheck'])) { |
---|
10 | delet_Allproduct_Thisimage($imgid); |
---|
11 | } else { |
---|
12 | $product_id = $_POST['productcheck']; |
---|
13 | add_product_Thisimage($product_id, $imgen); |
---|
14 | } |
---|
15 | } |
---|
16 | |
---|
17 | //set batch manager unit |
---|
18 | global $template, $element_ids; |
---|
19 | |
---|
20 | $query=' |
---|
21 | SELECT `id`, `product`, `noteAdmin`, `price` |
---|
22 | FROM '.MPS_PRODUCT_TABLE.' |
---|
23 | ORDER BY `order` |
---|
24 | ;'; |
---|
25 | $result = pwg_query($query); |
---|
26 | |
---|
27 | while($row = pwg_db_fetch_assoc($result)){ |
---|
28 | $products[]= $row; |
---|
29 | } |
---|
30 | |
---|
31 | $query=' |
---|
32 | SELECT * |
---|
33 | FROM '.MPS_CONF_TABLE.';'; |
---|
34 | $result = pwg_query($query); |
---|
35 | |
---|
36 | while($row = pwg_db_fetch_assoc($result)){ |
---|
37 | $config = $row ; |
---|
38 | } |
---|
39 | |
---|
40 | $query=' |
---|
41 | SELECT i.id, pi.image_id, pi.product_id |
---|
42 | FROM '.IMAGES_TABLE.' AS i |
---|
43 | LEFT JOIN '.MPS_PROD_IMG_TABLE.' AS pi ON pi.image_id = i.id |
---|
44 | WHERE id IN ('.implode(',', $element_ids).') |
---|
45 | ;'; |
---|
46 | $result = pwg_query($query); |
---|
47 | |
---|
48 | while($row = pwg_db_fetch_assoc($result)){ |
---|
49 | $productcheck[] = $row; |
---|
50 | } |
---|
51 | |
---|
52 | //template assign |
---|
53 | $template->assign(array( |
---|
54 | 'mps_products' => $products, |
---|
55 | 'mps_conf' => $config, |
---|
56 | 'mps_productcheck' => $productcheck, |
---|
57 | )); |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | |
---|