-
Notifications
You must be signed in to change notification settings - Fork 0
/
categories.php
77 lines (71 loc) · 2.32 KB
/
categories.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
<?php include("securearea.php"); ?>
<?php
class Categories extends Securearea
{
function __construct()
{
parent::__construct();
$this->load->helper("url");
}
public function viewCategoryProducts($category_name)
{
//load header
//echo "<pre>";print_r($this->categoryData);die;
$catName = removehyphens(urldecode($category_name));
$catdisc = $this->categoryData[$catName]["category_description"];
$this->loadHeader($this,"",$this->categoryData[$catName]["category_title"],$catdisc);
//load sidebar
$this->loadSidebar($this);
//load middle content
$view["totalProducts"] = $this->categoryData[$catName]["prod_cnt"];
if(!$view["totalProducts"])
{
$this->session->set_flashdata("alert",json_encode(array("type"=>"block","msg"=>"<strong>Category Not Found.</strong>")));
redirect(base_url(),"refresh");
}
//echo $view['totalProducts'];die;
//$view["more_products_url"] = base_url()."categories/ajax_CategoriesProducts/";
$category_id = $this->categoryData[$catName]["category_id"];
$where = " AND
(
category_id ='".$category_id."' OR
category_id LIKE '".$category_id.",%' OR
category_id LIKE '%,".$category_id.",%' OR
category_id LIKE '%,".$category_id."'
)
";
$view['more_products'] = $this->product_model->getProduct("","",$where,$offset,$order);
$viewp['obj'] = $this;
//$view["addtourl"] = "&category_id=".$category_id;
$this->load->view('product_show_view',$view);
//load footer
$this->loadFooter($this);
}
public function ajax_CategoriesProducts($offset = "9")
{
if(!$this->checkifajax())redirect(base_url(),"refresh");
if(isset($_GET["category_id"]))
{
$category_id = $_GET["category_id"];
unset($_GET["category_id"]);
$order = "";
foreach($_GET as $cols=>$orders){$order .= $cols." ".$orders.", ";}
$where = " AND
(
category_id ='".$category_id."' OR
category_id LIKE '".$category_id.",%' OR
category_id LIKE '%,".$category_id.",%' OR
category_id LIKE '%,".$category_id."'
)
";
$more_products = $this->product_model->getProduct("","",$where,$offset,"9",$order);
if($more_products)
{
echo json_encode(array("status"=>"success","data"=>$more_products));
die;
}
}
echo json_encode(array("status"=>"fail","last"=>$offset));
}
}
?>