-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetproduct_type.php
60 lines (44 loc) · 1.15 KB
/
getproduct_type.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
<?php
/**
* @author alok dubey
* @2018
*/
require_once 'config.php';
$s_id=$_REQUEST['s_id'];
if(!$s_id)
{
$message = array('sucess'=>'false','message'=>'Parameter missing');
echo json_encode($message);
exit;
}
Mage::app();
Mage::app()->getTranslator()->init('frontend');
Mage::getSingleton('core/session', array('name' => 'frontend'));
$products = Mage::getModel('catalog/product')
->getCollection()
->distinct(true)
->addAttributeToSelect('product_type')
->addAttributeToFilter('find_a_medvacation',$s_id)
->load();
//print_r($products->getSelect()->__toString());exit;
foreach($products as $product){
$id=$product->getId();
//$ret[$id]['id']=$id;
$ret[]=$product->getProductType();
}
$ret=array_unique($ret);
$ret=array_values($ret);
if (empty($ret))
{
$ret="";
echo json_encode(array('sucess'=>"false",'data'=>$ret),JSON_PRETTY_PRINT);
}
else
{
echo json_encode(array('sucess'=>"true",'data'=>$ret),JSON_PRETTY_PRINT);
}
// print_r($ret);exit;
//$ret=array_values($ret);
//$result=json_encode($ret,JSON_PRETTY_PRINT) ;
//echo $result;
?>