private void BuildPriceGroupSections(TemplateBuilder builder, int sortorder) { // Assumption: Price groups are the same for all the products. // So all products should have entries for all the price groups. var priceGroups = PriceGroup.Find(x => !x.Deleted).ToList(); BuildPriceGroupSectionForSpecificPriceGroups(builder, priceGroups, sortorder); }
// Price groups private void BuildPriceGroupItems() { var priceGroups = PriceGroup.Find(x => !x.Deleted).ToList(); foreach (var pg in priceGroups) { var id = pg.SitecoreId(); var item = new SystemItem(id, GetPriceGroupName(pg)); item.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/money-coin.png"); _priceGroups.AddItem(item); } _priceGroups.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/money.png"); _priceGroups.SetRevision(Guid.NewGuid()); }
private void AddPriceGroupFieldsForProduct(Product product, FieldList list) { var priceGroups = PriceGroup.Find(x => !x.Deleted).ToList(); var productPriceRepository = ObjectFactory.Instance.Resolve <IRepository <ProductPrice> >(); var userServie = ObjectFactory.Instance.Resolve <IUserService>(); var productPrices = productPriceRepository.Select(x => x.Product == product && x.MinimumQuantity == 1); foreach (var priceGroup in priceGroups) { var singlePriceForProductAndPriceGroup = productPrices.FirstOrDefault(x => x.Price.PriceGroup == priceGroup); AddProductPriceFieldAndValue(list, singlePriceForProductAndPriceGroup, userServie.GetCurrentUserCulture().NumberFormat); } }
private void BuildAllowedPriceGroupsSection(TemplateBuilder builder, int sortOrder) { builder.CreateSection("Allowed Price Groups", FieldIds.Catalog.SectionAllowedPriceGroupsId, sortOrder); var priceGroups = PriceGroup.Find(x => !x.Deleted).OrderBy(x => x.Name).ToList(); _priceGroupIdToFieldIdMap.Clear(); int priceGroupSortOrder = 10; foreach (var priceGroup in priceGroups) { ID priceGroupFieldId = priceGroup.GetOrCreateAllowedPriceGroupFieldId(FieldIds.Catalog.SectionAllowedPriceGroupsId); _priceGroupIdToFieldIdMap[priceGroup.PriceGroupId] = priceGroupFieldId; AddPriceGroupSpecificField(builder, priceGroup, priceGroupSortOrder, priceGroupFieldId); priceGroupSortOrder += 10; } }