Example #1
0
 public function category($id)
 {
     $category_model = new shopCategoryModel();
     $category = $category_model->getById($id);
     $route = $this->getRoute();
     if (!$route) {
         $category['subcategories'] = array();
     } else {
         $category['subcategories'] = $category_model->getSubcategories($category, $route['domain'] . '/' . $route['url']);
         $category_url = wa()->getRouteUrl('shop/frontend/category', array('category_url' => '%CATEGORY_URL%'));
         foreach ($category['subcategories'] as &$sc) {
             $sc['url'] = str_replace('%CATEGORY_URL%', isset($route['url_type']) && $route['url_type'] == 1 ? $sc['url'] : $sc['full_url'], $category_url);
         }
         unset($sc);
     }
     $category_params_model = new shopCategoryParamsModel();
     $category['params'] = $category_params_model->get($category['id']);
     if ($this->wa->getConfig()->getOption('can_use_smarty') && $category['description']) {
         $category['description'] = wa()->getView()->fetch('string:' . $category['description']);
     }
     return $category;
 }