Yeni Sitemiz Hizmetinizde

Fermaş'a Bilgisayarınızdan ve Kişisel Mobil Cihazlarınızdan Rahatlıkla Ulaşabilirsiniz!

arrow-icon

Fermaş 22. Irantex Fuarı'nda

22. Irantex 2016 Fuarı’na Katılan Fermaş, Fuardan Yeni İş Bağlantıları Yaparak Döndü.

arrow-icon

Fermaş, Kiev Fashion Show 2016'da

Fermaş, tekstil sektörünün önde gelen etkinliklerinde bulunmaya devam ediyor.

arrow-icon
Const CONTENT_PRODUCTS_ID = 155 Dim CatIdT, LangIdT, SortIdT, gProductCountZ Const PAGE_SIZE = 50 Core_Page.Open "app.page.products" Core_Page.ContinueOnClose = True CIdT = Core_Page.GetParam("p_cid") ' content id CatIdT = Core_Page.GetParam("p_catid") ' cat_id SortIdT = Core_Page.GetParam("p_sortid") ' sort_id PageIndexT = Core_Page.GetParam("p_pgi") ' Page Index Dim gStartIndexZ, gEndIndexZ, gPageIndexZ, gPageCountZ If IsEmpty(PageIndexT) = True or IsNumeric(PageIndexT) = False Then gPageIndexZ= 1 Else gPageIndexZ= cint(PageIndexT) End If gStartIndexZ = (gPageIndexZ - 1) * PAGE_SIZE ' Ciddi bir bug MySql limit clause fazladan atanan degerde sorun çıkartmıyor, ' ancak ya baska DB'lerde, baska DB lerde sorun cıkabilir. ' REV: gPageCountZ, Son sayfaya gore RECORDCOUNT'ı hesaba katarak hesaplanmalı. gPageCountZ = PAGE_SIZE ' Son sayfa ise PAGE_SIZE drekt eklenmez. Son sayfadaki kayıt sayısı onemli. gEndIndexZ = gStartIndexZ + PAGE_SIZE If IsEmpty(CatIdT) = True or IsNumeric(CatIdT) = False Then CatIdT = "0" End If If IsEmpty(SortIdT) = True or IsNumeric(SortIdT) = False Then SortIdT = "0" End If LangIdT = GetCurrentLanguageId() Set ParentEl = Session("CURRENT_ELEMENT") BuildPage ParentEl Core_Page.Close '------------------------------------------------------------------------------ Sub BuildPage(aParentEl) Dim Doc aParentEl.ClassName = "page-productcatalog" Set Doc = aParentEl.Node.OwnerDocument Doc.Scripts.Add "res/js/product-catalog.js" BuildHeader aParentEl BuildContextualCatList aParentEl If CatIdT <> "0" Then BuildFilter aParentEl BuildContent aParentEl End If End Sub Sub BuildHeader(aParentEl) Dim ContEl Set ContEl = aParentEl.AddElement("div") BuildHeaderText ContEl End Sub Sub BuildHeaderText(aParentEl) Dim ContEl, CatPathT, PathProductsT, HeaderT If CatIdT = "0" Then CatPathT = "" Else CatPathT = " > " & BuildCatPathWithLink(CatIdT) End If HeaderT = App_Config.GetValue("O_CNT_3_" & CONTENT_PRODUCTS_ID) PathProductsT = "" PathProductsT = PathProductsT & HeaderT PathProductsT = PathProductsT & "" Set ContEl = aParentEl.AddElement("h2") ContEl.InnerHtml = PathProductsT & CatPathT End Sub Sub BuildFilter(aParentEl) Dim ContEl Set ContEl = aParentEl.AddElement("div") 'BuildFilterByCat ContEl BuildSortBy ContEl BuildProductCountIndicator ContEl End Sub Sub BuildFilterByCat(aParentEl) Dim ContEl Set ContEl = aParentEl.AddElement("select") ContEl.Id = "i-filter-by-cat" BuildFilterByCatList ContEl End Sub Sub BuildFilterByCatList(aParentEl) BuildOptionItem aParentEl, "0", App_Config.GetValue("O_CFG_TX_ALL_PRODUCTS"), False BuildCategories aParentEl End Sub Sub BuildContextualCatList(aParentEl) Dim ContEl Set ContEl = aParentEl.AddElement("div") ContEl.ClassName = "product-cat-list" BuildContextualCats ContEl End Sub Sub BuildContextualCats(aParentEl) Dim ContEl, RsO, QT Set ContEl = aParentEl.AddElement("ul") QT = "select CT_ID," QT = QT & "(select NAME from " & DB_GenerateTableName("cat_values") & " where TBL_1.CT_ID=CAT_ID and LANG_ID="&LangIdT&" limit 1)" QT = QT & " from " & DB_GenerateTableName("cat_list") & " as TBL_1" QT = QT & " where CT_STATE=1 and CT_PARENT_ID = " & CatIdT Set RsO = New Data_Sql_Recordset RsO.Open QT, Core_Page.Connection, 3, 1, EMPTY If RsO.EOF = False Then Do While RsO.Eof = False If RsO.EOF = False Then BuildContextualCatItem ContEl, RsO.Fields(0).Value, DB_Read4String(RsO.Fields(1)) RsO.MoveNext End If Loop End If RsO.Close Set RsO = Nothing End Sub Sub BuildContextualCatItem(aParentEl, aIdT, aNameT) Dim ContEl, LinkEl, SpanEl Set ContEl = aParentEl.AddElement("li") Set LinkEl = ContEl.AddElement("a") LinkEl.Attributes.SetValue "title", aNameT LinkEl.Attributes.SetValue "href", "?p_cid=" & CONTENT_PRODUCTS_ID & "&p_catid=" & aIdT 'LinkEl.InnerHtml = aNameT Set SpanEl = LinkEl.AddElement("span") SpanEl.InnerHtml = aNameT If CatIdT = 0 Then BuildCatProductList LinkEl, aIdT End If End Sub Sub BuildCatProductList(aParentEl, aIdT) Dim ContEl Set ContEl = aParentEl.AddElement("ul") ContEl.ClassName = "cat-product-list" BuildCatProducts ContEl, aIdT End Sub Sub BuildCatProducts(aParentEl, aIdT) Dim QT, RsO ' REV: KOD TEKRARI: Aynı kod urun listelemede var. QT = "select ID, CODE," QT = QT & "(select NAME from " & DB_GenerateTableName("product_values") & " where PRODUCT_ID=TBL_1.ID and LANG_ID="&LangIdT&" limit 1)," QT = QT & "(select concat(FL_NAME,'.', FL_EXT) from " & DB_GenerateTableName("file_list") & " where TBL_1.IMG_ID=FL_ID limit 1)" QT = QT & " from " & DB_GenerateTableName("product_s") & " as TBL_1" QT = QT & " where STATE=1" If aIdT <> "0" Then Dim ChildCatS, N, i, BuffT Set ChildCatS = ExtractChildCats(aIdT) N = ChildCatS.Length - 1 BuffT = "" For i = 0 To N BuffT = BuffT & ChildCatS.GetValue(i) If i < N Then BuffT = BuffT & "," End If Next QT = QT & " and CAT_ID in (" & BuffT & ")" End If QT = QT & " limit 8" Set RsO = New Data_Sql_Recordset RsO.Open QT, Core_Page.Connection, 3, 1, EMPTY If RsO.EOF = false Then Do While RsO.Eof = False If RsO.EOF = false Then BuildCatProductItem aParentEl, DB_Read4String(RsO.Fields(1)), DB_Read4String(RsO.Fields(2).Value), DB_Read4String(RsO.Fields(3)) RsO.MoveNext End If Loop End If RsO.Close Set RsO = Nothing End Sub Sub BuildCatProductItem(aParentEl, aCodeT, aNameT, aImgSrcT) Dim ContEl, ImgEl, ImgPartA, ImgPartS, SmallImgSrcT Set ContEl = aParentEl.AddElement("li") ImgPartA = split(aImgSrcT, ".") Set ImgPartS = New Type_Array ImgPartS.Initialize ImgPartA SmallImgSrcT = "is/" & ImgPartS.GetValue(0) & "_sml." & ImgPartS.GetValue(1) & "" Set ImgEl = ContEl.AddElement("img") ImgEl.Attributes.SetValue "alt", aNameT ImgEl.Attributes.SetValue "src", SmallImgSrcT End Sub Function ExtractChildCats(aIdT) Dim Acc Set Acc = New Type_Array Acc.Insert aIdT f aIdT, Acc Set ExtractChildCats = Acc End Function Sub f(aCatIdT, ByRef aAccS) Dim RsO, QT, CatIdT CatIdT = aCatIdT QT = "select CT_ID" QT = QT & " from " & DB_GenerateTableName("cat_list") QT = QT & " where CT_STATE=1 and CT_PARENT_ID = " & CatIdT Set RsO = New Data_Sql_Recordset RsO.Open QT, Core_Page.Connection, 3, 1, EMPTY If RsO.EOF = False Then Do While RsO.Eof = False If RsO.EOF = False Then aAccS.Insert RsO.Fields(0).Value f RsO.Fields(0).Value, aAccS RsO.MoveNext End If Loop End If RsO.Close Set RsO = Nothing End Sub ' REV: BuildCatPATH 'in nerdeyse aynısı bir link için bu kadar kod tekrarı Function BuildCatPathWithLink(aIdT) Dim RsO, QT, CurrentIdT, Acc CurrentIdT = aIdT Set Acc = New Type_Array Do While True QT = "select CT_ID, CT_PARENT_ID," QT = QT & "(select NAME from " & DB_GenerateTableName("cat_values") & " where TBL_1.CT_ID=CAT_ID and LANG_ID="&LangIdT&" limit 1)" QT = QT & " from " & DB_GenerateTableName("cat_list") & " as TBL_1" QT = QT & " where CT_ID="&CurrentIdT&" limit 1" Set RsO = New Data_Sql_Recordset RsO.Open QT, Core_Page.Connection, 3, 1, EMPTY If RsO.EOF = False Then Acc.Insert "" &DB_Read4String(RsO.Fields(2)) & "" CurrentIdT = RsO.Fields(1).Value Else Exit Do End If RsO.Close Set RsO = Nothing Loop Set CatItemS = Acc.Reverse() BuildCatPathWithLink = CatItemS.Join(" > ") End Function Function BuildCatPath(aIdT) Dim RsO, QT, CurrentIdT, Acc CurrentIdT = aIdT Set Acc = New Type_Array Do While True QT = "select CT_ID, CT_PARENT_ID," QT = QT & "(select NAME from " & DB_GenerateTableName("cat_values") & " where TBL_1.CT_ID=CAT_ID and LANG_ID="&LangIdT&" limit 1)" QT = QT & " from " & DB_GenerateTableName("cat_list") & " as TBL_1" QT = QT & " where CT_ID="&CurrentIdT&" limit 1" Set RsO = New Data_Sql_Recordset RsO.Open QT, Core_Page.Connection, 3, 1, EMPTY If RsO.EOF = False Then Acc.Insert DB_Read4String(RsO.Fields(2)) CurrentIdT = RsO.Fields(1).Value Else Exit Do End If RsO.Close Set RsO = Nothing Loop Set CatItemS = Acc.Reverse() BuildCatPath = CatItemS.Join(" > ") End Function Sub BuildCategories(aParentEl) Dim RsO, QT, NameT QT = "select distinct CT_ID" QT = QT & " from " & DB_GenerateTableName("product_s") & " as prods" QT = QT & " left join " & DB_GenerateTableName("cat_list") & " tbl_1 on (tbl_1.CT_ID=prods.CAT_ID)" QT = QT & " where tbl_1.CT_STATE=1" Set RsO = New Data_Sql_Recordset RsO.Open QT, Core_Page.Connection, 3, 1, EMPTY If RsO.EOF = false Then ErrorLogInsert "BuildCategories_FOUND_REC" SelectedB = False Do While RsO.Eof = False If RsO.EOF = false Then NameT = BuildCatPath(RsO.Fields(0).Value) If cint(CatIdT) = RsO.Fields(0).Value Then SelectedB = true Else SelectedB = false End If BuildOptionItem aParentEl, RsO.Fields(0).Value, NameT, SelectedB RsO.MoveNext End If Loop End If RsO.Close Set RsO = Nothing End Sub Sub BuildOptionItem(aParentEl, aValueT, aTextT, aSelectedB) Dim ContEl Set ContEl = aParentEl.AddElement("option") ContEl.Attributes.SetValue "value", aValueT ContEl.InnerHtml = aTextT If aSelectedB = True Then ContEl.Attributes.SetValue "selected", "selected" End If End Sub Sub BuildSortBy(aParentEl) Dim ContEl Set ContEl = aParentEl.AddElement("select") ContEl.Id = "i-sort-by" BuildListSortBy ContEl End Sub Sub BuildListSortBy(aParentEl) Dim SelZeroB, SelOneB If SortIdT = "0" Then SelZeroB = True SelOneB = False Else SelZeroB = False SelOneB = True End If BuildOptionItem aParentEl, "0", App_Config.GetValue("O_CFG_TX_SORTBY_NAME"), SelZeroB BuildOptionItem aParentEl, "1", App_Config.GetValue("O_CFG_TX_SORTBY_CODE"), SelOneB End Sub Function FetchProductCount() Dim QT, RsO, FilterT If CatIdT = "0" Then FilterT = "" Else Dim ChildCatS, N, i, BuffT Set ChildCatS = ExtractChildCats(CatIdT) N = ChildCatS.Length - 1 BuffT = "" For i = 0 To N BuffT = BuffT & ChildCatS.GetValue(i) If i < N Then BuffT = BuffT & "," End If Next FilterT = " and CAT_ID in (" & BuffT & ")" End If QT = "select count(ID)" QT = QT & " from " & DB_GenerateTableName("product_s") QT = QT & " where STATE=1" & FilterT & " limit 1" Set RsO = New Data_Sql_Recordset RsO.Open QT, Core_Page.Connection, 3, 1, EMPTY If RsO.EOF = false Then gProductCountZ = RsO.Fields(0).Value FetchProductCount = gProductCountZ Else gProductCountZ = 0 FetchProductCount = gProductCountZ End If RsO.Close Set RsO = nothing End Function Sub BuildProductCountIndicator(aParentEl) Dim ContEl, ProductCountZ ProductCountZ = FetchProductCount() Set ContEl = aParentEl.AddElement("div") ContEl.ClassName = "count-indicator" ContEl.InnerHtml = ProductCountZ End Sub Sub BuildContent(aParentEl) Dim ContEl Set ContEl = aParentEl.AddElement("div") BuildProductTable ContEl BuildProductPagination ContEl End Sub Sub BuildProductTable(aParentEl) Dim ContEl Set ContEl = aParentEl.AddElement("div") ContEl.ClassName = "product-list" BuildTableRecords ContEl End Sub Sub BuildTableRecords(aParentEl) Dim RsO, QT QT = "select ID, CODE," QT = QT & "(select NAME from " & DB_GenerateTableName("product_values") & " where PRODUCT_ID=TBL_1.ID and LANG_ID="&LangIdT&" limit 1)," QT = QT & "CAT_ID," QT = QT & "(select concat(FL_NAME,'.', FL_EXT) from " & DB_GenerateTableName("file_list") & " where TBL_1.IMG_ID=FL_ID limit 1)" QT = QT & " from " & DB_GenerateTableName("product_s") & " as TBL_1" QT = QT & " where STATE=1" If CatIdT <> "0" Then Dim ChildCatS, N, i, BuffT Set ChildCatS = ExtractChildCats(CatIdT) N = ChildCatS.Length - 1 BuffT = "" For i = 0 To N BuffT = BuffT & ChildCatS.GetValue(i) If i < N Then BuffT = BuffT & "," End If Next QT = QT & " and CAT_ID in (" & BuffT & ")" End If Select Case SortIdT Case "0" QT = QT & " order by (select NAME from " & DB_GenerateTableName("product_values") & " where PRODUCT_ID=TBL_1.ID and LANG_ID="&LangIdT&" limit 1) asc" Case Else QT = QT & " order by Convert(replace(CODE, '#&', """"), UNSIGNED) asc" End Select QT = QT & " limit " & gStartIndexZ & ", "&gPageCountZ&"" 'ErrorLogInsert "res="&QT Set RsO = New Data_Sql_Recordset RsO.Open QT, Core_Page.Connection, 3, 1, EMPTY If RsO.EOF = false Then Do While RsO.Eof = False If RsO.EOF = false Then BuildTableItem aParentEl, DB_Read4String(RsO.Fields(1)), DB_Read4String(RsO.Fields(2).Value), BuildCatPath(RsO.Fields(3).Value), DB_Read4String(RsO.Fields(4)) RsO.MoveNext End If Loop End If RsO.Close Set RsO = Nothing End Sub Sub BuildTableItem(aParentEl, aCodeT, aNameT, aCategoryT, aImgNameT) Dim ContEl, SpanEl, HeaderEl, ImgNameT, SmallImgSrcT Dim ImgPartA, ImgPartS ImgPartA = split(aImgNameT, ".") Set ImgPartS = New Type_Array ImgPartS.Initialize ImgPartA SmallImgSrcT = "is/" & ImgPartS.GetValue(0) & "_sml." & ImgPartS.GetValue(1) & "" Set ContEl = aParentEl.AddElement("a") ContEl.Attributes.SetValue "title", aNameT ContEl.Attributes.SetValue "href", "is/" & aImgNameT & "" ContEl.Attributes.SetValue "target", "_blank" ContEl.ClassName = "product-container" Set ImgEl = ContEl.AddElement("img") ImgEl.Attributes.SetValue "alt", aNameT ImgEl.Attributes.SetValue "src", SmallImgSrcT Set HeaderEl = ContEl.AddElement("h3") HeaderEl.InnerHtml = aNameT & " " & aCodeT & "" Set SpanEl = ContEl.AddElement("span") SpanEl.InnerHtml = aCategoryT End Sub Sub BuildProductPagination(aParentEl) Dim PaginationO Set PaginationO = New Util_Pagination Set PaginationO.Parent = aParentEl PaginationO.FirstText = App_Config.GetValue("O_CFG_TX_PAGINATION_FIRST") PaginationO.PrevText = App_Config.GetValue("O_CFG_TX_PAGINATION_PREV") PaginationO.NextText = App_Config.GetValue("O_CFG_TX_PAGINATION_NEXT") PaginationO.LastText = App_Config.GetValue("O_CFG_TX_PAGINATION_LAST") PaginationO.IndicatorText = App_Config.GetValue("O_CFG_TX_PAGINATION_INDICATOR") PaginationO.FirstTitle = App_Config.GetValue("O_CFG_TX_PAGINATION_FIRST_TITLE") PaginationO.PrevTitle = App_Config.GetValue("O_CFG_TX_PAGINATION_PREV_TITLE") PaginationO.NextTitle = App_Config.GetValue("O_CFG_TX_PAGINATION_NEXT_TITLE") PaginationO.LastTitle = App_Config.GetValue("O_CFG_TX_PAGINATION_LAST_TITLE") PaginationO.ClassName = "pagination" PaginationO.RecordCount = gProductCountZ PaginationO.PageIndex = gPageIndexZ PaginationO.PageRecordCount = PAGE_SIZE PaginationO.MaxLinkCount = 10 PaginationO.BaseUrl = "?p_cid=" & CONTENT_PRODUCTS_ID & "&p_catid=" & CatIdT & "&p_sortid=" & SortIdT & "" PaginationO.Apply End Sub