예제 #1
0
        public PipelineExecutionResult Execute(InstallationPipelineArgs subject)
        {
            var sharedFieldRepository = ObjectFactory.Instance.Resolve <IRepository <SharedField> >();
            var sharedFieldsToSave    = new List <SharedField>();
            var productDefinitions    = ProductDefinition.All().ToList();
            var categoryDefinitions   = Definition.All().Where(x => x.DefinitionType == DefinitionType.Get(1)).ToList();

            foreach (var productDefinition in productDefinitions)
            {
                sharedFieldsToSave.Add(new SharedField()
                {
                    FieldValue = GetXmlLayoutValueForProduct(),
                    FieldId    = FieldIDs.LayoutField.Guid,
                    ItemId     = productDefinition.Guid.Derived("__Standard Values") // This must be set on the Standard Values item. Not the template item directly.
                });
            }

            foreach (var categoryDefinition in categoryDefinitions)
            {
                sharedFieldsToSave.Add(new SharedField()
                {
                    FieldValue = GetXmlLayoutValueForCategory(),
                    FieldId    = FieldIDs.LayoutField.Guid,
                    ItemId     = categoryDefinition.Guid.Derived("__Standard Values") // This must be set on the Standard Values item. Not the template item directly.
                });
            }

            sharedFieldRepository.Save(sharedFieldsToSave);

            return(PipelineExecutionResult.Success);
        }
예제 #2
0
        public string GetCommaSeperatedProductVariantTemplatesList()
        {
            var productDefinitions = ProductDefinition.All().Select(x => x.Name).ToList();

            return(productDefinitions.Any()
                                ? productDefinitions.Aggregate((x, y) => x + " Variant," + y + " Variant")
                                : "");
        }