コード例 #1
0
ファイル: CKeywordSearch.php プロジェクト: kingsj/zeuscart
 /**
  * This function is used to get  the featureList
  * @return string
  */
 function featureList()
 {
     if (empty($_POST['subcatsel'])) {
         $id = $_SESSION['category'];
     } else {
         $id = $_SESSION['subcategory'];
     }
     //$sql="select count(*)as cnt,b.attrib_value,a.product_id from product_attrib_values_table a inner join attribute_value_table b on a.attrib_value_id=b.attrib_value_id inner join products_table c on c.product_id=a.product_id inner join category_table d on c.category_id=d.category_id where d.category_id=".$id." group by attrib_value";
     //$sql="select count(*)as cnt,b.attrib_value,a.product_id,e.attrib_name,e.attrib_id from product_attrib_values_table a inner join attribute_value_table b on a.attrib_value_id=b.attrib_value_id inner join products_table c on c.product_id=a.product_id inner join category_table d on c.category_id=d.category_id inner join attribute_table e on b.attrib_id=e.attrib_id where d.category_id=".$id."  group by attrib_value order by e.attrib_name";
     //$sql='select a.*,b.attrib_name from category_attrib_table a inner join attribute_table b on a.attrib_id=b.attrib_id where subcategory_id='.$id;
     $sql = "select b.attrib_name,a.attrib_id,a.subcategory_id from category_attrib_table a inner join attribute_table b on a.attrib_id=b.attrib_id where a.subcategory_id=" . $id;
     $obj = new Bin_Query();
     $obj->executeQuery($sql);
     $res = $obj->records;
     $i = 0;
     if (count($res) > 0) {
         foreach ($res as $row) {
             $attrib_id = $row['attrib_id'];
             $sql1 = "select b.attrib_value,count(*) as cnt,b.attrib_value_id from product_attrib_values_table a inner join attribute_value_table b on a.attrib_value_id=b.attrib_value_id inner join products_table c on c.product_id=a.product_id where c.category_id=" . $id . " and b.attrib_id=" . $attrib_id . " and c.intro_date <= '" . date('Y-m-d') . "' and c.status=1 group by b.attrib_value";
             $obj1 = new Bin_Query();
             $obj1->executeQuery($sql1);
             $res1 = $obj1->records;
             $j = 0;
             if ($obj1->totrows > 0) {
                 $att1_name = $row['attrib_name'];
                 $kk[$i] = $att1_name;
                 foreach ($res1 as $row1) {
                     $attrib_value1 = $row1['attrib_value'];
                     $cnt1 = $row1['cnt'];
                     $ss[$i][$j] = $attrib_value1 . "(" . $row1['cnt'] . ")";
                     if ($_GET['attribute_value_id'] != $row1['attrib_value_id']) {
                         $att[$i][$j] = $row1['attrib_value_id'];
                     }
                     $j++;
                 }
             }
             $i++;
         }
     }
     return Display_DKeywordSearch::featureList($kk, $ss, $att, $id);
 }
コード例 #2
0
ファイル: CKeywordSearch.php プロジェクト: kingsj/zeuscart
 /**
  * Function returns the feature list of products
  * 
  * 
  * @return string
  */
 function featureList()
 {
     $id = $_POST['id'];
     $id = 2;
     $sql1 = 'select distinct a.attrib_name,a.attrib_id from attribute_table a join attribute_value_table b on a.attrib_id=b.attrib_id inner join category_attrib_table c on c.attrib_id=b.attrib_id inner join category_table d on c.subcategory_id=d.category_id where d.category_id=' . $id;
     $obj1 = new Bin_Query();
     $obj1->executeQuery($sql1);
     $sql = 'select a.attrib_id,a.attrib_name,b.attrib_value_id,b.attrib_value,d.category_name,d.category_id from attribute_table a inner join attribute_value_table b on a.attrib_id=b.attrib_id inner join category_attrib_table c on c.attrib_id=b.attrib_id inner join category_table d on c.subcategory_id=d.category_id where d.category_id=' . $id;
     $obj = new Bin_Query();
     $obj->executeQuery($sql);
     for ($i = 0; $i < $obj->totrows; $i++) {
         if ($obj->records[$i]['attrib_value_id'] != 0) {
             $obj->records[$i]['productCnt'] = Core_CKeywordSearch::getProductCount($obj->records[$i]['attrib_value_id']);
         }
     }
     return Display_DKeywordSearch::featureList($obj1->records, $obj->records);
 }