function show($widget)
 {
     $map['token'] = get_token();
     if ($widget['data_from'] == 2) {
         // 部分商品 cate_id=1,2,3&search_key=[search_key]&shopping_list=1
         $condition = str_replace(array('[cate_id]', '[search_key]'), array($_REQUEST['cate_id'], $_REQUEST['search_key']), $widget['data_condition']);
         parse_str($condition, $output);
         if (!empty($output['cate_id'])) {
             $map = getIdsForMap($output['cate_id'], $map, 'cate_id_1');
         }
         if (!empty($output['search_key'])) {
             $key = safe($output['search_key']);
             $map['title'] = array('like', "%{$key}%");
         }
         if (isset($output['shopping_list'])) {
             // 购物清单 TODO
         }
     } elseif ($widget['data_from'] == 1) {
         // 指定商品
         $map = getIdsForMap($widget['data_ids'], $map);
     }
     if (isset($_REQUEST['cate_id'])) {
         $cid = intval($_REQUEST['cate_id']);
         $map['_string'] = ' (cate_id_1=' . $cid . ' or cate_id_2=' . $cid . ') ';
     }
     $list = M('shop_product')->where($map)->order($widget['order'])->selectPage($widget['list_row']);
     // dump ( $list );
     $this->assign('list', $list);
     // dump ( $widget );
     return $this->getWidgetHtml($widget);
 }
 function show($widget)
 {
     $map['module'] = 'shop_category';
     $map['token'] = get_token();
     if ($widget['data_from'] == 0) {
         // 全部分类
         $map['pid'] = intval($_REQUEST['cate_id']);
     } elseif ($widget['data_from'] == 1) {
         // 指定分类
         $map = getIdsForMap($widget['data_ids'], $map);
     }
     $list = M('common_category')->where($map)->order('sort asc')->select();
     $this->assign('category_list', $list);
     // dump ( $widget );
     return $this->getWidgetHtml($widget);
 }