Skip to content

Commit

Permalink
PT-14471: Include Product Images
Browse files Browse the repository at this point in the history
feat: Add a Store Setting to Include Product Images.
faet: Update VC references to stable v6
feat: Update package-lock.json.
  • Loading branch information
OlegoO committed Nov 14, 2023
1 parent 5447fa6 commit 1ab59df
Show file tree
Hide file tree
Showing 8 changed files with 250 additions and 319 deletions.
6 changes: 3 additions & 3 deletions VirtoCommerce.SitemapsModule.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VirtoCommerce.SitemapsModul
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VirtoCommerce.SitemapsModule.Tests", "tests\VirtoCommerce.SitemapsModule.Tests\VirtoCommerce.SitemapsModule.Tests.csproj", "{605F0F47-F54B-4E73-A773-6F83BF04655E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VirtoCommerce.SitemapsModule.Data.SqlServer", "src\VirtoCommerce.SitemapsModule.Data.SqlServer\VirtoCommerce.SitemapsModule.Data.SqlServer.csproj", "{A38E681B-6284-4513-9744-26DBB2995B17}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VirtoCommerce.SitemapsModule.Data.SqlServer", "src\VirtoCommerce.SitemapsModule.Data.SqlServer\VirtoCommerce.SitemapsModule.Data.SqlServer.csproj", "{A38E681B-6284-4513-9744-26DBB2995B17}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VirtoCommerce.SitemapsModule.Data.MySql", "src\VirtoCommerce.SitemapsModule.Data.MySql\VirtoCommerce.SitemapsModule.Data.MySql.csproj", "{26B459FA-2646-44CE-B8C4-95F354962E73}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VirtoCommerce.SitemapsModule.Data.MySql", "src\VirtoCommerce.SitemapsModule.Data.MySql\VirtoCommerce.SitemapsModule.Data.MySql.csproj", "{26B459FA-2646-44CE-B8C4-95F354962E73}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VirtoCommerce.SitemapsModule.Data.PostgreSql", "src\VirtoCommerce.SitemapsModule.Data.PostgreSql\VirtoCommerce.SitemapsModule.Data.PostgreSql.csproj", "{B86F9860-5EEE-47AE-9608-96DCEB332DCB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VirtoCommerce.SitemapsModule.Data.PostgreSql", "src\VirtoCommerce.SitemapsModule.Data.PostgreSql\VirtoCommerce.SitemapsModule.Data.PostgreSql.csproj", "{B86F9860-5EEE-47AE-9608-96DCEB332DCB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
155 changes: 44 additions & 111 deletions src/VirtoCommerce.SitemapsModule.Core/ModuleConstants.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using VirtoCommerce.Platform.Core.Settings;

namespace VirtoCommerce.SitemapsModule.Core
Expand Down Expand Up @@ -31,62 +30,42 @@ public static class General
public static readonly SettingDescriptor RecordsLimitPerFile = new SettingDescriptor
{
Name = "Sitemap.RecordsLimitPerFile",
GroupName = "Sitemap|General",
GroupName = "Sitemap",
ValueType = SettingValueType.PositiveInteger,
DefaultValue = 10000
};

public static readonly SettingDescriptor FilenameSeparator = new SettingDescriptor
{
Name = "Sitemap.FilenameSeparator",
GroupName = "Sitemap|General",
GroupName = "Sitemap",
ValueType = SettingValueType.ShortText,
DefaultValue = "--"
};

public static readonly SettingDescriptor SearchBunchSize = new SettingDescriptor
{
Name = "Sitemap.SearchBunchSize",
GroupName = "Sitemap|General",
GroupName = "Sitemap",
ValueType = SettingValueType.PositiveInteger,
DefaultValue = 500
};

public static readonly SettingDescriptor AcceptedFilenameExtensions = new SettingDescriptor
{
Name = "Sitemap.AcceptedFilenameExtensions",
GroupName = "Sitemap|General",
GroupName = "Sitemap",
ValueType = SettingValueType.ShortText,
DefaultValue = ".md,.html"
};

public static readonly SettingDescriptor IncludeImages = new SettingDescriptor
{
Name = "Sitemap.IncludeImages",
GroupName = "Sitemap|General",
ValueType = SettingValueType.Boolean,
DefaultValue = false
};

public static IEnumerable<SettingDescriptor> AllSettings
{
get
{
yield return RecordsLimitPerFile;
yield return FilenameSeparator;
yield return SearchBunchSize;
yield return AcceptedFilenameExtensions;
yield return IncludeImages;
}
}
}

public static class ProductLinks
{
public static readonly SettingDescriptor ProductPageUpdateFrequency = new SettingDescriptor
{
Name = "Sitemap.ProductPageUpdateFrequency",
GroupName = "Sitemap|Product Links",
GroupName = "Sitemap",
ValueType = SettingValueType.ShortText,
IsDictionary = true,
AllowedValues = new object[]
Expand All @@ -105,28 +84,27 @@ public static class ProductLinks
public static readonly SettingDescriptor ProductPagePriority = new SettingDescriptor
{
Name = "Sitemap.ProductPagePriority",
GroupName = "Sitemap|Product Links",
GroupName = "Sitemap",
ValueType = SettingValueType.Decimal,
DefaultValue = 1.0m,
IsRequired = true,
};

public static IEnumerable<SettingDescriptor> AllSettings
public static readonly SettingDescriptor IncludeImages = new SettingDescriptor
{
get
{
yield return ProductPageUpdateFrequency;
yield return ProductPagePriority;
}
}
Name = "Sitemap.IncludeImages",
GroupName = "Sitemap",
ValueType = SettingValueType.Boolean,
DefaultValue = false
};
}

public static class CategoryLinks
{
public static readonly SettingDescriptor CategoryPageUpdateFrequency = new SettingDescriptor
{
Name = "Sitemap.CategoryPageUpdateFrequency",
GroupName = "Sitemap|Category Links",
GroupName = "Sitemap",
ValueType = SettingValueType.ShortText,
IsDictionary = true,
AllowedValues = new object[]
Expand All @@ -145,28 +123,19 @@ public static class CategoryLinks
public static readonly SettingDescriptor CategoryPagePriority = new SettingDescriptor
{
Name = "Sitemap.CategoryPagePriority",
GroupName = "Sitemap|Category Links",
GroupName = "Sitemap",
ValueType = SettingValueType.Decimal,
DefaultValue = 0.7m,
IsRequired = true,
};

public static IEnumerable<SettingDescriptor> AllSettings
{
get
{
yield return CategoryPageUpdateFrequency;
yield return CategoryPagePriority;
}
}
}

public static class BlogLinks
{
public static readonly SettingDescriptor BlogPageUpdateFrequency = new SettingDescriptor
{
Name = "Sitemap.BlogPageUpdateFrequency",
GroupName = "Sitemap|Sitemaps",
GroupName = "Sitemap",
ValueType = SettingValueType.ShortText,
AllowedValues = new object[]
{
Expand All @@ -184,82 +153,46 @@ public static class BlogLinks
public static readonly SettingDescriptor BlogPagePriority = new SettingDescriptor
{
Name = "Sitemap.BlogPagePriority",
GroupName = "Sitemap|Sitemaps",
GroupName = "Sitemap",
ValueType = SettingValueType.Decimal,
DefaultValue = 0.5m,
IsRequired = true,
};
}

public static readonly SettingDescriptor CategoryPageUpdateFrequency = new SettingDescriptor
{
Name = "Sitemap.CategoryPageUpdateFrequency",
GroupName = "Sitemap|Sitemaps",
ValueType = SettingValueType.ShortText,
AllowedValues = new object[]
{
"always",
"hourly",
"daily",
"weekly",
"monthly",
"yearly",
"never"
},
};

public static readonly SettingDescriptor CategoryPagePriority = new SettingDescriptor
{
Name = "Sitemap.CategoryPagePriority",
GroupName = "Sitemap|Sitemaps",
ValueType = SettingValueType.Decimal,
DefaultValue = 0.7m,
IsRequired = true,
};

public static readonly SettingDescriptor ProductPageUpdateFrequency = new SettingDescriptor
{
Name = "Sitemap.ProductPageUpdateFrequency",
GroupName = "Sitemap|Sitemaps",
ValueType = SettingValueType.ShortText,
AllowedValues = new object[]
{
"always",
"hourly",
"daily",
"weekly",
"monthly",
"yearly",
"never"
},
};
public static IEnumerable<SettingDescriptor> AllSettings
{
get
{
yield return General.RecordsLimitPerFile;
yield return General.FilenameSeparator;
yield return General.SearchBunchSize;
yield return General.AcceptedFilenameExtensions;
yield return CategoryLinks.CategoryPageUpdateFrequency;
yield return CategoryLinks.CategoryPagePriority;
yield return ProductLinks.ProductPageUpdateFrequency;
yield return ProductLinks.ProductPagePriority;
yield return ProductLinks.IncludeImages;
yield return BlogLinks.BlogPageUpdateFrequency;
yield return BlogLinks.BlogPagePriority;
}
}

public static readonly SettingDescriptor ProductPagePriority = new SettingDescriptor
public static IEnumerable<SettingDescriptor> StoreLevelSettings
{
get
{
Name = "Sitemap.ProductPagePriority",
GroupName = "Sitemap|Sitemaps",
ValueType = SettingValueType.Decimal,
DefaultValue = 1.0m,
IsRequired = true,
};
yield return CategoryLinks.CategoryPageUpdateFrequency;
yield return CategoryLinks.CategoryPagePriority;
yield return ProductLinks.ProductPageUpdateFrequency;
yield return ProductLinks.ProductPagePriority;
yield return ProductLinks.IncludeImages;
yield return BlogLinks.BlogPageUpdateFrequency;
yield return BlogLinks.BlogPagePriority;

public static IEnumerable<SettingDescriptor> AllSettings
{
get
{
yield return CategoryPageUpdateFrequency;
yield return CategoryPagePriority;
yield return ProductPageUpdateFrequency;
yield return ProductPagePriority;
yield return BlogPageUpdateFrequency;
yield return BlogPagePriority;
}
}
}

public static IEnumerable<SettingDescriptor> AllSettings => General.AllSettings.Concat(ProductLinks.AllSettings).Concat(CategoryLinks.AllSettings).Concat(BlogLinks.AllSettings);

public static IEnumerable<SettingDescriptor> StoreLevelSettings => BlogLinks.AllSettings;

#pragma warning restore S3218
}
}
Expand Down
Loading

0 comments on commit 1ab59df

Please sign in to comment.