Example #1
0
    private void AddCategories(GoogleXmlSitemaps sitemap)
    {
        int howMayItems;

        sitemap.AddCategories(
            DataAccessContext.CategoryRepository.GetByRootID(
                StoreContext.Culture,
                DataAccessContext.Configurations.GetValue("RootCategory", CurrentStore),
                "CategoryID",
                BoolFilter.ShowAll,
                ConvertUtilities.ToInt32(uxCategoryStartText.Text.Trim()) - 1,
                ConvertUtilities.ToInt32(uxCategoryEndText.Text.Trim()) - 1,
                out howMayItems));
    }
Example #2
0
    private void Generate()
    {
        string    saveFileName         = "Export/" + (_fileName + _fileExtension);
        string    filePhysicalPathName = Server.MapPath("../" + saveFileName);
        XmlWriter xmlWriter            = CreateXmlWriter(filePhysicalPathName);

        GoogleXmlSitemaps sitemap = new GoogleXmlSitemaps();

        sitemap.Changefreq = DataAccessContext.Configurations.GetValue("GoogleSitemapsChangeFrequency", CurrentStore);
        sitemap.Priority   = DataAccessContext.Configurations.GetValue("GoogleSitemapsURLPriority", CurrentStore);

        if (!KeyUtilities.IsMultistoreLicense())
        {
            sitemap.StorefrontUrl = UrlPath.StorefrontUrl;
        }
        else
        {
            sitemap.StorefrontUrl = "http://" + CurrentStore.UrlName + "/";
        }

        string message = String.Empty;

        if (DataAccessContext.Configurations.GetBoolValue("GoogleSitemapsIsIncludesCategories", CurrentStore))
        {
            AddCategories(sitemap);
        }

        if (DataAccessContext.Configurations.GetBoolValue("GoogleSitemapsIsIncludesProducts", CurrentStore))
        {
            AddProducts(sitemap);
        }

        if (DataAccessContext.Configurations.GetBoolValue("GoogleSitemapsIsIncludesContents", CurrentStore))
        {
            AddContentPages(sitemap);
        }

        if (sitemap.GenerateSitemap(xmlWriter, out message))
        {
            uxFileNameLink.Text        = Path.GetFileName(saveFileName);
            uxFileNameLink.NavigateUrl = "../DownloadFile.aspx?FilePath=../" + saveFileName;
            uxFileNameLink.Target      = "_blank";

            uxMessage.DisplayMessage(Resources.GoogleXMLSitemapsMessages.CreateSuccess);
        }
        else
        {
            uxMessage.DisplayMessage(message);
        }
    }
Example #3
0
    private void AddContentPages(GoogleXmlSitemaps sitemap)
    {
        IList <Content> allList = GetAllContentsInCurrentStore();

        IList <Content> resultList = new List <Content>();

        int startIndex = ConvertUtilities.ToInt32(uxContentStartText.Text.Trim()) - 1;
        int endIndex   = ConvertUtilities.ToInt32(uxContentEndText.Text.Trim()) - 1;

        for (int i = startIndex; i <= endIndex && i < allList.Count; i++)
        {
            resultList.Add(allList[i]);
        }

        sitemap.AddContentPages(resultList);
    }
Example #4
0
    private void AddProducts(GoogleXmlSitemaps sitemap)
    {
        SearchFilter searchFilterObj = SearchFilter.GetFactory().Create();
        int          howMayItems;

        sitemap.AddProducts(
            DataAccessContext.ProductRepository.SearchProduct(
                StoreContext.Culture,
                "",
                "ProductID",
                searchFilterObj,
                ConvertUtilities.ToInt32(uxProductStartText.Text.Trim()) - 1,
                ConvertUtilities.ToInt32(uxProductEndText.Text.Trim()) - 1,
                out howMayItems,
                CurrentStore.StoreID,
                DataAccessContext.Configurations.GetValue("RootCategory", CurrentStore)));
    }