Ejemplo n.º 1
0
    public void GetTopSearchTerms()
    {
        int            count         = 5;
        AspxCommonInfo aspxCommonObj = new AspxCommonInfo();

        aspxCommonObj.StoreID     = StoreID;
        aspxCommonObj.PortalID    = PortalID;
        aspxCommonObj.UserName    = UserName;
        aspxCommonObj.CultureName = CultureName;
        string modulePath    = this.AppRelativeTemplateSourceDirectory;
        string pageExtension = SageFrameSettingKeys.PageExtension;
        List <SearchTermList> lstSearchTerm = AspxSearchController.GetTopSearchTerms(aspxCommonObj, count);

        if (lstSearchTerm != null && lstSearchTerm.Count > 0)
        {
            StringBuilder Elements = new StringBuilder();
            Elements.Append("<div id=\"topSearch\" class=\"cssClassTopSearch\" style=\"display: none\">");
            Elements.Append("<span>");
            Elements.Append(getLocale("Popular:"));
            Elements.Append("</span>");
            Elements.Append("<ul id=\"topSearchNew\">");
            foreach (SearchTermList item in lstSearchTerm)
            {
                Elements.Append("<li><a href=\"");
                Elements.Append(aspxRedirectPath);
                Elements.Append("search/simplesearch");
                Elements.Append(pageExtension);
                Elements.Append("?cid=0&amp;isgiftcard=false&amp;q=");
                Elements.Append(item.SearchTerm);
                Elements.Append("\">");
                Elements.Append(item.SearchTerm);
                Elements.Append("</a></li>");
            }
            Elements.Append("</ul>");
            Elements.Append("</div>");
            litTopSearch.Text = Elements.ToString();
        }
    }