Example #1
0
        protected override void AttachChildControls()
        {
            int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId);
            this.keyWord       = this.Page.Request.QueryString["keyWord"];
            this.imgUrl        = (HiImage)this.FindControl("imgUrl");
            this.litContent    = (Literal)this.FindControl("litContent");
            this.rptProducts   = (VshopTemplatedRepeater)this.FindControl("rptProducts");
            this.rptCategories = (VshopTemplatedRepeater)this.FindControl("rptCategories");
            this.Page.Session["stylestatus"] = "4";
            switch (Hidistro.Core.SettingsManager.GetMasterSettings(true).VTheme.ToLower())
            {
            case "common":
                DataTable dt = CategoryBrowser.GetCategoriesRange(ProductInfo.ProductRanage.NormalSelect);
                this.rptCategories.DataSource = dt;
                this.rptCategories.DataBind();
                int total = 0;
                if (categoryId == 0)
                {
                    if (dt.Rows.Count > 0)
                    {
                        int FirstCategoryID = Convert.ToInt32(dt.Rows[0]["categoryId"]);
                        this.rptProducts.DataSource = ProductBrowser.GetProducts(MemberProcessor.GetCurrentMember(), null, 0, FirstCategoryID, this.keyWord, 1, 200, out total, "ShowSaleCounts", "desc");
                        this.rptProducts.DataBind();
                    }
                }
                else
                {
                    this.rptProducts.DataSource = ProductBrowser.GetProducts(MemberProcessor.GetCurrentMember(), null, 0, categoryId, this.keyWord, 1, 200, out total, "ShowSaleCounts", "desc");
                    this.rptProducts.DataBind();
                }
                break;

            default:
                this.rptCategories.ItemDataBound += new RepeaterItemEventHandler(this.rptCategories_ItemDataBound);
                if (this.Page.Request.QueryString["TypeId"] != null)
                {
                    this.rptCategories.DataSource = CategoryBrowser.GetCategoriesByPruductType(100, Convert.ToInt32(this.Page.Request.QueryString["TypeId"]));
                    this.rptCategories.DataBind();
                }
                else
                {
                    IList <CategoryInfo> maxSubCategories = CategoryBrowser.GetMaxSubCategoriesRange(this.categoryId, 0x3e8, DistributorsBrower.GetCurrStoreProductRange());
                    this.rptCategories.DataSource = maxSubCategories;
                    this.rptCategories.DataBind();
                }

                PageTitle.AddSiteNameTitle("分类搜索页");
                break;
            }
        }