This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Serializable] | |
[PropertyDefinitionTypePlugIn(DisplayName = "PropertyCategoryList")] | |
public class PropertyCategoryListPropertyDefinition : PropertyData | |
{ | |
private EPiServer.Core.CategoryList _inner; | |
public PropertyCategoryListPropertyDefinition() | |
: this(new EPiServer.Core.CategoryList()) { } | |
public PropertyCategoryListPropertyDefinition(EPiServer.Core.CategoryList inner) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Registration of Content goes here | |
public class BaseProductType : ProductContent | |
{ | |
[Display(Name = "Category", Order = 0, GroupName = "EPiServerCMS_SettingsPanel")] | |
[BackingType(typeof(PropertyCategoryListPropertyDefinition))] | |
public virtual CategoryList Category { get; set; } | |
//Additional Properties | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[InitializableModule] | |
[ModuleDependency(typeof(ServiceContainerInitialization))] | |
public class SetDefaultAssetGroupInitialization : IInitializableModule | |
{ | |
public void Initialize(InitializationEngine context) | |
{ | |
AssetUrlConventions assetUrlConventions = context.Locate.Advanced.GetInstance<AssetUrlConventions>(); | |
//Add the default group to be Image | |
assetUrlConventions.AddDefaultGroup<BaseProductType>("Image"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[InitializableModule] | |
[ModuleDependency(typeof(EPiServer.Commerce.Initialization.InitializationModule))] | |
public class AccessoryTypeRegistrationInitialization : IInitializableModule | |
{ | |
public void Initialize(InitializationEngine context) | |
{ | |
var associationDefinitionRepository = context.Locate.Advanced.GetInstance<GroupDefinitionRepository<AssociationGroupDefinition>>(); | |
associationDefinitionRepository.Add(new AssociationGroupDefinition { Name = RelatedTypeConstants.Accessory }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SectionHierachicalCatalogRouter : HierarchicalCatalogPartialRouter | |
{ | |
public const string SectionRouteValue = "section"; | |
//Predefined segments that will not be resolved to content | |
private IEnumerable<string> _segments = new string[] { "specifications", "specifications/", "interior", "interior/", "quote", "quote/", "technology", "technology/", "accessories", "accessories/", "design", "design/" }; | |
private readonly IContentLoader _contentLoader; | |
public TabHierachicalCatalogRouter(CatalogContentBase commerceRoot, Func<ContentReference> func) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override PartialRouteData GetPartialVirtualPath(CatalogContentBase content, string language, RouteValueDictionary routeValues, | |
RequestContext requestContext) | |
{ | |
//Ensure that we don't include the section segment in our Commrece route lookup | |
object value; | |
bool found = routeValues.TryGetValue(SectionRouteValue, out value); | |
//Let's remove our section route value | |
routeValues.Remove(SectionRouteValue); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this._urlResolver.GetUrl(product.ContentLink, ContentLanguage.PreferredCulture.Name, | |
new VirtualPathArguments() | |
{ | |
RouteValues = new RouteValueDictionary(new { section = "specifications" }) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override object RoutePartial(PageData content, SegmentContext segmentContext) | |
{ | |
//Ask Episerver to resolve the object for requested URL | |
object ob = base.RoutePartial(content, segmentContext); | |
if (ob != null) | |
{ | |
SegmentPair segment = segmentContext.GetNextValue(segmentContext.RemainingPath); | |
if (!String.IsNullOrWhiteSpace(segment.Next)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override CatalogContentBase FindNextContentInSegmentPair(CatalogContentBase catalogContent, SegmentPair segmentPair, SegmentContext segmentContext, CultureInfo cultureInfo) | |
{ | |
CatalogContentBase currentCatalog = base.FindNextContentInSegmentPair(catalogContent, segmentPair, segmentContext, cultureInfo); | |
if (_segments.Contains(segmentPair.Next, StringComparer.InvariantCultureIgnoreCase)) | |
{ | |
//Let's tell Episerver to route to parent product | |
var parentProduct = this._contentLoader.GetBySegment(catalogContent.ParentLink, segmentContext.LastConsumedFragment, cultureInfo) as CatalogContentBase; | |
return parentProduct; |