protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode) { LoadTheme(themecode, siteid, languagecode, pcode); id = Rint_Para("0"); //商品分类 pid = Rint_Para("1"); //品牌 cid = Rstring_Para("2"); //属性 list = Rstring_Para("3"); //列表或网格 sort = Rstring_Para("4"); //排序 tid = Rint_Para("5"); //商品标签 transport = Rint_Para("7"); //配送 0全部 1商城 2商家 stock = Rint_Para("8"); //是否有库存 1只显示有货 pageindex = RequestTool.RequestInt("page", 1); pro_type = B_Lebi_Pro_Type.GetModel(id); if (pro_type == null) { pro_type = new Lebi_Pro_Type(); } if (Lang(pro_type.Url) != "") //如果存在自定义URL 跳转至自定义URL by kingdge 2014-10-30 { Response.Redirect(Lang(pro_type.Url)); Response.End(); return; } property = EX_Product.ProductType_ProPerty(pro_type); if (property == null) { property = new Lebi_Pro_Type(); property.ProPerty132 = "0"; } if (property.ProPerty132 == "") { property.ProPerty132 = "0"; } path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">»</em>"; if (pro_type.id > 0) { CategoryPath = Categorypath(id); for (int i = 0; i <= CategoryPath.GetUpperBound(0); i++) { path += "<a href=\"" + URL("P_ProductCategory", "" + CategoryPath[i, 0] + "", CategoryPath[i, 2]) + "\"><span>" + CategoryPath[i, 1] + "</span></a>"; if (i < CategoryPath.GetUpperBound(0)) { path += "<em>»</em>"; } } } else if (tid == 0) { path += "<a href=\"" + URL("P_ProductCategory", "0") + "\"><span>" + Tag("商品列表") + "</span></a>"; } if (tid > 0) { tag = B_Lebi_Pro_Tag.GetModel(tid); path += "<em>»</em><a href=\"" + URL("P_ProductCategory", "" + id + ",$,$,$,$," + tid + "") + "\"><span>" + Lang(tag.Name) + "</span></a>"; } where = ProductWhere + " and Type_id_ProductType <> 323"; if (pid > 0) { where += " and Brand_id=" + pid + ""; brand = B_Lebi_Brand.GetModel(pid); path += "<em>»</em><a href=\"" + URL("P_ProductCategory", "" + id + "," + pid + ",$,$,$,$") + "\"><span>" + Lang(brand.Name) + "</span></a>"; } if (cid != "") { where += " and " + Categorywhere(cid); string _cidlast = ""; if (cid.IndexOf("$") > -1) { string[] cidarr = cid.Split('$'); for (int i = 0; i < cidarr.Count(); i++) { if (cidarr[i].IndexOf("|") > -1) { string[] _cids = cidarr[i].Split('|'); _cidlast = _cids[1]; Lebi_ProPerty ProPerty = B_Lebi_ProPerty.GetModel(int.Parse(_cidlast)); if (ProPerty != null) { path += "<em>»</em><a href=\"" + URL("P_ProductCategory", "" + id + "," + pid + "," + ProPerty.parentid + "|" + ProPerty.id + ",$,$,$") + "\"><span>" + Lang(ProPerty.Name) + "</span></a>"; } } } } else { if (cid.IndexOf("|") > -1) { string[] _cids = cid.Split('|'); _cidlast = _cids[1]; Lebi_ProPerty ProPerty = B_Lebi_ProPerty.GetModel(int.Parse(_cidlast)); if (ProPerty != null) { path += "<em>»</em><a href=\"" + URL("P_ProductCategory", "" + id + "," + pid + "," + ProPerty.parentid + "|" + ProPerty.id + ",$,$,$") + "\"><span>" + Lang(ProPerty.Name) + "</span></a>"; } } } } if (id > 0) { where += " and " + CategoryWhere(id); //where += " and (Pro_Type_id in (" + Categorywhereforid(id) + ")"; //if (DataBase.DBType == "sqlserver") //{ // where += " or Charindex('," + id + ",',','+Pro_Type_id_other+',')>0)"; //} //if (DataBase.DBType == "access") //{ // where += " or Instr(','+Pro_Type_id_other+',','," + id + ",')>0)"; //} } if (tid > 0) { if (DataBase.DBType == "sqlserver") { where += " and Charindex('," + tid + ",',','+Pro_Tag_id+',')>0"; } if (DataBase.DBType == "access") { where += " and Instr(','+Pro_Tag_id+',','," + tid + ",')>0"; } } if (transport == 1) { where += " and IsSupplierTransport = 0"; } else if (transport == 2) { where += " and IsSupplierTransport = 1"; } if (stock == 1) { where += " and Count_Stock > 0"; } if (sort == "1") { order = " Count_Sales_Show desc"; ordertmp = "a"; } else if (sort == "1a") { order = " Count_Sales_Show asc"; ordertmp = ""; } else if (sort == "2") { order = " Price desc"; ordertmp = "a"; } else if (sort == "2a") { order = " Price asc"; ordertmp = ""; } else if (sort == "3") { order = " Count_Comment desc"; ordertmp = "a"; } else if (sort == "3a") { order = " Count_Comment asc"; ordertmp = ""; } else if (sort == "4") { order = " Time_Add desc"; ordertmp = "a"; } else if (sort == "4a") { order = " Time_Add asc"; ordertmp = ""; } else if (sort == "5") { order = " Count_Views_Show desc"; ordertmp = "a"; } else if (sort == "5a") { order = " Count_Views_Show asc"; ordertmp = ""; } else if (sort == "6") { order = " Count_Stock desc"; ordertmp = "a"; } else if (sort == "6a") { order = " Count_Stock asc"; ordertmp = ""; } else { order = " Sort desc,id desc"; ordertmp = ""; } products = B_Lebi_Product.GetList(where, order, PageSize, pageindex); recordCount = B_Lebi_Product.Counts(where); //id={0}&pid={1}&cid={2}&list={3}&sort={4}&tid={5}&page={6} string url = URL("P_ProductCategory", id + "," + pid + "," + cid + "," + list + "," + sort + "," + tid + ",{0}," + transport + "," + stock + "", Lang(pro_type.Url)); HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple(url, pageindex, PageSize, recordCount, CurrentLanguage); FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb(url, pageindex, PageSize, recordCount, CurrentLanguage); }
protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode) { LoadTheme(themecode, siteid, languagecode, pcode); CurrentPage = B_Lebi_Theme_Page.GetModel("Code='P_Search'"); keyword = Rstring_Para("0"); list = Rstring_Para("1"); sort = Rstring_Para("2"); pageindex = Rint_Para("3"); id = Rint_Para("4"); pid = Rint_Para("5"); path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">»</em><a class=\"text\"><span>" + Tag("商品搜索") + "</span></a><em>»</em><a class=\"text\"><span>“" + keyword + "”</span></a>"; where = ProductWhere + " and Type_id_ProductType <> 323"; if (keyword != "") { //增加空格划词搜索 by kingdge 2013-09-18 string wherekeyword = ""; if (keyword.IndexOf(" ") > -1) { string[] keywordsArr; keywordsArr = keyword.Split(new char[1] { ' ' }); foreach (string keywords in keywordsArr) { if (keywords != "") { if (wherekeyword == "") { wherekeyword = "Name like lbsql{'%" + keywords + "%'}"; } else { wherekeyword += " and Name like lbsql{'%" + keywords + "%'}"; } } } } else { wherekeyword = "Name like lbsql{'%" + keyword + "%'}"; } where += " and ((" + wherekeyword + ") or Number like lbsql{'%" + keyword + "%'} or Code like lbsql{'%" + keyword + "%'})"; } if (id > 0) { where += " and " + CategoryWhere(id); } if (pid > 0) { where += " and Brand_id=" + pid + ""; } if (sort == "1") { order = " Count_Sales_Show desc"; ordertmp = "a"; } else if (sort == "1a") { order = " Count_Sales_Show asc"; ordertmp = ""; } else if (sort == "2") { order = " Price desc"; ordertmp = "a"; } else if (sort == "2a") { order = " Price asc"; ordertmp = ""; } else if (sort == "3") { order = " Count_Comment desc"; ordertmp = "a"; } else if (sort == "3a") { order = " Count_Comment asc"; ordertmp = ""; } else if (sort == "4") { order = " Time_Add desc"; ordertmp = "a"; } else if (sort == "4a") { order = " Time_Add asc"; ordertmp = ""; } else if (sort == "5") { order = " Count_Views_Show desc"; ordertmp = "a"; } else if (sort == "5a") { order = " Count_Views_Show asc"; ordertmp = ""; } else if (sort == "6") { order = " Count_Stock desc"; ordertmp = "a"; } else if (sort == "6a") { order = " Count_Stock asc"; ordertmp = ""; } else { order = " Sort desc,id desc"; ordertmp = ""; } SQLDataAccess.SQLPara sp = new SQLDataAccess.SQLPara(where, order, "*"); products = B_Lebi_Product.GetList(sp, PageSize, pageindex); recordCount = B_Lebi_Product.Counts(sp); string url = URL("P_Search", keyword + "," + list + "," + sort + ",{0}"); HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple(url, pageindex, PageSize, recordCount, CurrentLanguage); FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb(url, pageindex, PageSize, recordCount, CurrentLanguage); }
protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode) { LoadTheme(themecode, siteid, languagecode, pcode); CurrentPage = B_Lebi_Theme_Page.GetModel("Code='P_LimitBuy'"); list = Rstring_Para("0"); sort = Rstring_Para("1"); pageindex = RequestTool.RequestInt("page", 1); path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">»</em><a class=\"text\"><span>" + Tag("限时抢购") + "</span></a>"; where = "Type_id_ProductStatus = 101 and Type_id_ProductType = 321 and Product_id=0"; if (sort == "1") { order = " Count_Sales desc"; ordertmp = "a"; } else if (sort == "1a") { order = " Count_Sales asc"; ordertmp = ""; } else if (sort == "2") { order = " Price desc"; ordertmp = "a"; } else if (sort == "2a") { order = " Price asc"; ordertmp = ""; } else if (sort == "3") { order = " Count_Comment desc"; ordertmp = "a"; } else if (sort == "3a") { order = " Count_Comment asc"; ordertmp = ""; } else if (sort == "4") { order = " Time_Add desc"; ordertmp = "a"; } else if (sort == "4a") { order = " Time_Add asc"; ordertmp = ""; } else if (sort == "5") { order = " Count_Views_Show desc"; ordertmp = "a"; } else if (sort == "5a") { order = " Count_Views_Show asc"; ordertmp = ""; } else if (sort == "6") { order = " Count_Stock desc"; ordertmp = "a"; } else if (sort == "6a") { order = " Count_Stock asc"; ordertmp = ""; } else { order = " Count_Sales desc"; ordertmp = "a"; } products = B_Lebi_Product.GetList(where, order, PageSize, pageindex); recordCount = B_Lebi_Product.Counts(where); HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple("?page={0}&sort=" + sort + "&list=" + list + "", pageindex, PageSize, recordCount, CurrentLanguage); FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb("?page={0}&sort=" + sort + "&list=" + list + "", pageindex, PageSize, recordCount, CurrentLanguage); }
protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode) { pcode = "P_ShopProducts"; LoadTheme(themecode, siteid, languagecode, pcode); id = Rint_Para("0"); //商家ID cid = Rint_Para("1"); //商品分类 list = Rstring_Para("2"); //列表或网格 sort = Rstring_Para("3"); //排序 key = Rstring_Para("5"); //关键词 pageindex = RequestTool.RequestInt("page", 1); parentcid = 0; supplier = B_Lebi_Supplier.GetModel("id = " + id); if (supplier == null) { Response.Redirect(URL("P_404", "")); Response.End(); } int Supplier_id = supplier.User_id; if (cid != 0) { producttype = B_Lebi_Supplier_ProductType.GetModel(cid); if (producttype.parentid > 0) { parentcid = producttype.parentid; } else { parentcid = cid; } } path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">»</em><a href=\"" + URL("P_ShopIndex", id) + "\"><span>" + Lang(supplier.Name) + "</span></a>"; if (key != "") { path += " > " + key; } where = "Type_id_ProductStatus = 101 and Product_id=0 and Supplier_id = " + id + ""; if (cid > 0) { if (DataBase.DBType == "sqlserver") { where += " and Charindex('," + cid + ",',','+Supplier_ProductType_ids+',')>0"; } if (DataBase.DBType == "access") { where += " and Instr(','+Supplier_ProductType_ids+',','," + cid + ",')>0"; } } if (key != "") { where += " and Name like '%" + key + "%'"; } if (sort == "") { sort = "1"; } if (sort == "1") { order = " Count_Sales_Show desc"; ordertmp = "a"; } else if (sort == "1a") { order = " Count_Sales_Show asc"; ordertmp = ""; } else if (sort == "2") { order = " Price desc"; ordertmp = "a"; } else if (sort == "2a") { order = " Price asc"; ordertmp = ""; } else if (sort == "3") { order = " Count_Comment desc"; ordertmp = "a"; } else if (sort == "3a") { order = " Count_Comment asc"; ordertmp = ""; } else if (sort == "4") { order = " Time_Add desc"; ordertmp = "a"; } else if (sort == "4a") { order = " Time_Add asc"; ordertmp = ""; } else if (sort == "5") { order = " Count_Views_Show desc"; ordertmp = "a"; } else if (sort == "5a") { order = " Count_Views_Show asc"; ordertmp = ""; } else { order = " Count_Sales_Show desc"; ordertmp = "a"; } products = B_Lebi_Product.GetList(where, order, PageSize, pageindex); recordCount = B_Lebi_Product.Counts(where); //id={0}&pid={1}&cid={2}&list={3}&sort={4}&tid={5}&page={6} string url = URL("P_ShopProducts", id + "," + cid + "," + list + "," + sort + ",{0}," + key + ""); HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple(url, pageindex, PageSize, recordCount, CurrentLanguage); FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb(url, pageindex, PageSize, recordCount, CurrentLanguage); string supplierservicepannelcon = supplier.ServicePanel; supplierservicepannel = B_ServicePanel.GetModel(supplierservicepannelcon); headcontent = supplier.head; longbar = supplier.longbar; shortbar = supplier.shortbar; }
protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode) { LoadTheme(themecode, siteid, languagecode, pcode); CurrentPage = B_Lebi_Theme_Page.GetModel("Code='P_Brand'"); id = Rint_Para("0"); cid = Rstring_Para("1"); list = Rstring_Para("2"); sort = Rstring_Para("3"); pageindex = RequestTool.RequestInt("page", 1); brand = B_Lebi_Brand.GetModel(id); if (brand == null) { Response.Redirect(URL("P_BrandList", "")); Response.End(); } path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">»</em><a href=\"" + URL("P_BrandList", "") + "\"><span>" + Tag("品牌列表") + "</span></a><em>»</em><a class=\"text\"><span>" + Lang(brand.Name) + "</span></a>"; where = "Type_id_ProductStatus = 101 and Product_id=0 and Type_id_ProductType <> 323"; if (id > 0) { where += " and Brand_id = " + id + ""; } if (cid != "") { where += " and " + Categorywhere(cid); } if (sort == "1") { order = " Count_Sales_Show desc"; ordertmp = "a"; } else if (sort == "1a") { order = " Count_Sales_Show asc"; ordertmp = ""; } else if (sort == "2") { order = " Price desc"; ordertmp = "a"; } else if (sort == "2a") { order = " Price asc"; ordertmp = ""; } else if (sort == "3") { order = " Count_Comment desc"; ordertmp = "a"; } else if (sort == "3a") { order = " Count_Comment asc"; ordertmp = ""; } else if (sort == "4") { order = " Time_Add desc"; ordertmp = "a"; } else if (sort == "4a") { order = " Time_Add asc"; ordertmp = ""; } else if (sort == "5") { order = " Count_Views_Show desc"; ordertmp = "a"; } else if (sort == "5a") { order = " Count_Views_Show asc"; ordertmp = ""; } else if (sort == "6") { order = " Count_Stock desc"; ordertmp = "a"; } else if (sort == "6a") { order = " Count_Stock asc"; ordertmp = ""; } else { order = " Sort desc,id desc"; ordertmp = ""; } products = B_Lebi_Product.GetList(where, order, PageSize, pageindex); recordCount = B_Lebi_Product.Counts(where); HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple("?page={0}&id=" + id + "&cid=" + cid + "&sort=" + sort + "&list=" + list + "", pageindex, PageSize, recordCount, CurrentLanguage); FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb("?page={0}&id=" + id + "&cid=" + cid + "&sort=" + sort + "&list=" + list + "", pageindex, PageSize, recordCount, CurrentLanguage); }
public string Get_guigeforwap(Lebi_Product model) { string res = ""; if (model.ProPerty134 != "") { List <Lebi_ProPerty> ps134 = B_Lebi_ProPerty.GetList("id in (" + model.ProPerty134 + ")", "Sort desc"); string Msige = Language.DefaultCurrency().Msige; if (ps134.Count > 0) { foreach (Lebi_ProPerty p in ps134) { res += "<dd class=\"clearfix\"><em>" + Lang(p.Name) + ":</em><em><input type=\"hidden\" name=\"Property134\" propertyid=\"" + p.id + "\" value=\"" + Lang(p.Name) + Msige + p.Price + ":\" />"; List <Lebi_ProPerty> ps134list = B_Lebi_ProPerty.GetList("parentid = " + p.id + "", "Sort desc"); if (ps134list.Count > 0) { res += "<select id=\"Property134_" + p.id + "\" >"; foreach (Lebi_ProPerty pl in ps134list) { if (pl.Price > 0) { res += "<option propertypriceid=\"" + pl.id + "\" value=\"" + Lang(pl.Name) + Msige + pl.Price + "\">" + Lang(pl.Name) + " " + Msige + pl.Price + "</option>"; } else { res += "<option propertypriceid=\"" + pl.id + "\" value=\"" + Lang(pl.Name) + "\">" + Lang(pl.Name) + "</option>"; } } res += "</select>"; } else { res += "<input type=\"text\" id=\"Property134_" + p.id + "\" class=\"input\" value=\"\" />"; } res += "</em></dd>"; } } } List <ProductProperty> rmodels = new List <ProductProperty>(); if (model.Product_id == 0) { //无同款子商品 return(res); } List <Lebi_Product> pros = B_Lebi_Product.GetList("Product_id=" + model.Product_id + "", ""); if (pros.Count == 0) { return(res); } Lebi_Product pmodel = B_Lebi_Product.GetModel(model.Product_id); if (pmodel == null) { return(res); } string property = EX_Product.ProductType_ProPertystr(model.Pro_Type_id, 131); if (property == "") { return(res); } List <Lebi_ProPerty> pps = B_Lebi_ProPerty.GetList("id in (" + property + ")", "Sort desc"); List <Lebi_ProPerty> ps = B_Lebi_ProPerty.GetList("parentid in (" + property + ")", "Sort desc"); //分析当前商品的规格 //将当前商品的规格与主父规格进行对应 List <Lebi_ProPerty> Currentpps = new List <Lebi_ProPerty>();//保存当前商品的父规则值 string[] temps = model.ProPerty131.Split(','); foreach (string k in temps) { Lebi_ProPerty p = (from m in ps where m.id == Convert.ToInt32(k) select m).ToList().FirstOrDefault(); if (p != null) { Lebi_ProPerty kv = (from m in pps where m.id == p.parentid select m).ToList().FirstOrDefault(); kv.Sort = p.id;//临时征用排序字段,存放规格 Currentpps.Add(kv); } } foreach (Lebi_ProPerty pp in Currentpps) { List <Lebi_ProPerty> cps = (from m in ps where m.parentid == pp.id select m).ToList(); if (cps.Count == 0) { continue; } res += "<dd class=\"cartOption\"><em>" + Lang(pp.Name) + ":</em><em><select name=\"select_same_goods_\" onChange=\"window.location=$(this).val();\">"; foreach (Lebi_ProPerty p in cps) { //计算对应的商品 string propertystr = ("," + model.ProPerty131 + ",").Replace("," + pp.Sort + ",", "," + p.id + ","); Lebi_Product pro = (from m in pros where ("," + m.ProPerty131 + ",") == propertystr select m).ToList().FirstOrDefault(); if (pro == null) { continue; } if (pp.Sort == p.id) { res += " <option value=\"" + URL("P_Product", pro.id) + "\" selected>" + Lang(p.Name) + "</option>"; } else { res += " <option value=\"" + URL("P_Product", pro.id) + "\">" + Lang(p.Name) + "</option>"; } } res += "</select></em><em></em></dd>"; } return(res); }
/// <summary> /// 生成规格选项 /// </summary> /// <param name="model"></param> /// <returns></returns> public string Get_guige(Lebi_Product model) { string res = ""; if (model.ProPerty134 != "") { List <Lebi_ProPerty> ps134 = B_Lebi_ProPerty.GetList("id in (" + model.ProPerty134 + ")", "Sort desc"); string Msige = Language.DefaultCurrency().Msige; foreach (Lebi_ProPerty p in ps134) { res += "<dl class=\"clearfix\"><dt>" + Lang(p.Name) + ":</dt><dd><input type=\"hidden\" name=\"Property134\" propertyid=\"" + p.id + "\" value=\"" + Lang(p.Name) + "\" />"; List <Lebi_ProPerty> ps134list = B_Lebi_ProPerty.GetList("parentid = " + p.id + "", "Sort desc"); if (ps134list.Count > 0) { Lebi_ProPerty ps134listfirst = ps134list.FirstOrDefault(); res += "<select id=\"Property134_" + p.id + "\">"; foreach (Lebi_ProPerty pl in ps134list) { if (pl.Price > 0) { res += "<option propertypriceid=\"" + pl.id + "\" value=\"" + Lang(pl.Name) + Msige + pl.Price + "\">" + Lang(pl.Name) + " " + Msige + pl.Price + "</option>"; } else { res += "<option propertypriceid=\"" + pl.id + "\" value=\"" + Lang(pl.Name) + "\">" + Lang(pl.Name) + "</option>"; } } res += "</select>"; } else { res += "<input type=\"text\" id=\"Property134_" + p.id + "\" class=\"input\" value=\"\" />"; } res += "</dd></dl>"; } } List <ProductProperty> rmodels = new List <ProductProperty>(); if (model.Product_id == 0) { //无同款子商品 return(res); } List <Lebi_Product> pros = B_Lebi_Product.GetList("Product_id=" + model.Product_id + "", ""); if (pros.Count == 0) { return(res); } Lebi_Product pmodel = B_Lebi_Product.GetModel(model.Product_id); if (pmodel == null) { return(res); } string property = EX_Product.ProductType_ProPertystr(model.Pro_Type_id, 131); if (property == "") { return(res); } List <Lebi_ProPerty> pps = B_Lebi_ProPerty.GetList("id in (" + property + ")", "Sort desc"); List <Lebi_ProPerty> ps = B_Lebi_ProPerty.GetList("parentid in (" + property + ")", "Sort desc"); //分析当前商品的规格 //将当前商品的规格与主父规格进行对应 List <Lebi_ProPerty> Currentpps = new List <Lebi_ProPerty>();//保存当时商品的父规则值 string[] temps = model.ProPerty131.Split(','); foreach (string k in temps) { Lebi_ProPerty p = (from m in ps where m.id == Convert.ToInt32(k) select m).ToList().FirstOrDefault(); if (p != null) { Lebi_ProPerty kv = (from m in pps where m.id == p.parentid select m).ToList().FirstOrDefault(); kv.Sort = p.id;//临时征用排序字段,存放规格 Currentpps.Add(kv); } } foreach (Lebi_ProPerty pp in Currentpps) { List <Lebi_ProPerty> cps = (from m in ps where m.parentid == pp.id select m).ToList(); if (cps.Count == 0) { continue; } if (pp.id == model.ProPertyMain) { res += "<dl class=\"choose-image clearfix\"><dt>" + Lang(pp.Name) + ":</dt><dd>"; foreach (Lebi_ProPerty p in cps) { //计算对应的商品 string propertystr = ("," + model.ProPerty131 + ",").Replace("," + pp.Sort + ",", "," + p.id + ","); Lebi_Product pro = (from m in pros where ("," + m.ProPerty131 + ",") == propertystr select m).ToList().FirstOrDefault(); if (pro == null) { continue; } if (pro.Type_id_ProductStatus == 100 || EX_Product.ProductStock(pro) < 1)//下架 无库存 { if (pp.Sort == p.id) { res += "<div><a class=\"spva-imgonout\"><img src=\"" + WebPath + model.ImageSmall + "\" width=\"50\" title=\"" + Lang(p.Name) + "\" alt=\"" + Lang(p.Name) + "\"/><span></span></a></div>"; } else { res += "<div><a class=\"spva-imgout\" href=\"" + URL("P_Product", pro.id) + "\"><img src=\"" + WebPath + pro.ImageSmall + "\" width=\"50\" title=\"" + Lang(p.Name) + "\" alt=\"" + Lang(p.Name) + "\"/><span></span></a></div>"; } continue; } if (pp.Sort == p.id) { res += "<div><a class=\"spva-imgon\" href=\"" + URL("P_Product", model.id) + "\"><img src=\"" + WebPath + model.ImageSmall + "\" width=\"50\" title=\"" + Lang(p.Name) + "\" alt=\"" + Lang(p.Name) + "\"/><span></span></a></div>"; } else { res += "<div><a class=\"spva-img\" href=\"" + URL("P_Product", pro.id) + "\"><img src=\"" + WebPath + pro.ImageSmall + "\" width=\"50\" title=\"" + Lang(p.Name) + "\" alt=\"" + Lang(p.Name) + "\"/><span></span></a></div>"; } } } else { if (cps.FirstOrDefault().ImageUrl == "") { res += "<dl class=\"choose-text clearfix\"><dt>" + Lang(pp.Name) + ":</dt><dd>"; } else { res += "<dl class=\"choose-image clearfix\"><dt>" + Lang(pp.Name) + ":</dt><dd>"; } foreach (Lebi_ProPerty p in cps) { //计算对应的商品 string propertystr = ("," + model.ProPerty131 + ",").Replace("," + pp.Sort + ",", "," + p.id + ","); Lebi_Product pro = (from m in pros where ("," + m.ProPerty131 + ",") == propertystr select m).ToList().FirstOrDefault(); if (pro == null) { continue; } string tt = ""; string aclass = ""; if (p.ImageUrl == "") { tt = Lang(p.Name); } else { tt = "<img src=\"" + p.ImageUrl + "\" width=\"50\"\" />"; } if (pro.Type_id_ProductStatus == 100 || EX_Product.ProductStock(pro) < 1)//下架 无库存 { if (pp.Sort == p.id) { if (cps.FirstOrDefault().ImageUrl == "") { aclass = "spvaonout"; } else { aclass = "spva-imgonout"; } res += "<div><a class=\"" + aclass + "\" title=\"" + Lang(p.Name) + "\">" + tt + "<span></span></a></div>"; } else { if (cps.FirstOrDefault().ImageUrl == "") { aclass = "spvaout"; } else { aclass = "spva-imgout"; } res += "<div><a class=\"" + aclass + "\" href=\"" + URL("P_Product", pro.id) + "\" title=\"" + Lang(p.Name) + "\">" + tt + "<span></span></a></div>"; } continue; } if (pp.Sort == p.id) { if (cps.FirstOrDefault().ImageUrl == "") { aclass = "spvaon"; } else { aclass = "spva-imgon"; } res += "<div><a class=\"" + aclass + "\" href=\"" + URL("P_Product", model.id) + "\" title=\"" + Lang(p.Name) + "\">" + tt + "<span></span></a></div>"; } else { if (cps.FirstOrDefault().ImageUrl == "") { aclass = "spva"; } else { aclass = "spva-img"; } res += "<div><a class=\"" + aclass + "\" href=\"" + URL("P_Product", pro.id) + "\" title=\"" + Lang(p.Name) + "\">" + tt + "<span></span></a></div>"; } } } res += "</dd></dl>"; } return(res); }