private function _get_children($category_id)
 {
     $children = array();
     $cat_details = ProductCategory::whereRaw('parent_category_id = ?', array($category_id))->orderBy('category_left', 'ASC')->get(array('id', 'category_name', 'category_left', 'category_right', 'parent_category_id', 'category_level', 'display_order'));
     if (count($cat_details) > 0) {
         foreach ($cat_details as $cat) {
             $children[$cat->id] = $cat;
         }
     }
     return $children;
 }
示例#2
0
 public function populateProductCategoryList($cat_id = '')
 {
     $catList = array();
     $cat_id = $cat_id == '' || $cat_id == 0 ? $this->root_category_id : $cat_id;
     $cat_details = ProductCategory::whereRaw('parent_category_id = ?', array($cat_id))->orderBy('category_left', 'ASC')->get(array('id', 'category_name', 'seo_category_name'));
     if (count($cat_details) > 0) {
         foreach ($cat_details as $catkey => $cat) {
             $catList[$catkey] = $cat;
             $count = isset($this->prod_cat_count_arr[$cat['id']]) ? $this->prod_cat_count_arr[$cat['id']] : 0;
             $catList[$catkey]['cat_id'] = $cat['id'];
             $catList[$catkey]['product_count'] = $count;
             $catList[$catkey]['cat_link'] = $this->urlLink($cat['seo_category_name']);
         }
     }
     return $catList;
 }
 public function deleteCategoryImage($id, $filename, $ext, $folder_name)
 {
     $data_arr = array('image_name' => '', 'image_ext' => '', 'image_height' => '', 'image_width' => '');
     $affectedRows = ProductCategory::whereRaw('id = ?', array($id))->update($data_arr);
     if ($affectedRows) {
         $this->deleteImageFiles($filename, $ext, $folder_name);
         return true;
     }
     return false;
 }
 public function isCategoryExists($category_id)
 {
     $category_count = ProductCategory::whereRaw('id = ?', array($category_id))->count();
     return $category_count;
 }