public function execute()
 {
     $type_model = new shopTypeModel();
     $types = $type_model->getAll('id');
     $category_model = new shopCategoryModel();
     $categories = $category_model->getFullTree('id, name, depth', true);
     $features_model = new shopFeatureModel();
     $features = $features_model->getAll('id');
     $data = array();
     $type_values = array();
     foreach ($types as $type_id => $type) {
         $type_values[] = array($type_id, $type['name']);
         $data[$type_id]['price'] = array('feature' => 'price');
         $data[$type_id]['type_id'] = array('feature' => 'type_id');
         $data[$type_id]['tag'] = array('feature' => 'tag');
     }
     $type_features_model = new shopTypeFeaturesModel();
     $rows = $type_features_model->getAll();
     foreach ($rows as $row) {
         if (isset($features[$row['feature_id']])) {
             $code = $features[$row['feature_id']]['code'];
             $data[$row['type_id']][$code] = array('feature' => $code, 'feature_id' => $row['feature_id']);
         }
     }
     $type_upselling_model = new shopTypeUpsellingModel();
     $rows = $type_upselling_model->getAll();
     foreach ($rows as $row) {
         $data[$row['type_id']][$row['feature']] = array('feature_id' => $row['feature_id'], 'feature' => $row['feature'], 'cond' => $row['cond'], 'value' => $row['value']);
     }
     foreach ($data as &$row) {
         $row = array_values($row);
     }
     unset($row);
     foreach ($types as &$type) {
         if ($type['upselling']) {
             $type['upselling_html'] = self::getConditionHTML($data[$type['id']], $features);
         }
     }
     unset($type);
     $fids = array();
     foreach ($features as $f_key => $f) {
         $features[$f_key]['selectable'] = (int) $f['selectable'];
         $features[$f_key]['multiple'] = (int) $f['multiple'];
         if ($f['selectable']) {
             $fids[$f['id']] = $f;
         }
     }
     if ($fids) {
         $fids = $features_model->getValues($fids);
         foreach ($fids as $feature_id => $f) {
             foreach ($f['values'] as $value_id => $value) {
                 $features[$feature_id]['values'][] = array($value_id, $value);
             }
         }
         unset($fids);
     }
     $features['type_id'] = array('name' => _w('Type'), 'type' => 'varchar', 'selectable' => 1, 'values' => $type_values);
     $this->view->assign(array('types' => $types, 'categories' => $categories, 'features' => $features, 'data' => $data));
 }