# Further restriction on price lists

**URL:** <https://forum.litium.com/t/further-restriction-on-price-lists/1313>\
**Category:** Questions\
**Tags:** litium-7\
**Created:** [February 5, 2020, 7:27am UTC](https://forum.litium.com/t/further-restriction-on-price-lists/1313 "2020-02-05T07:27:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![victaxel](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/victaxel/32/159_2.png) [@victaxel](https://forum.litium.com/u/victaxel)\
**Post date:** [February 5, 2020, 7:27am UTC](https://forum.litium.com/t/further-restriction-on-price-lists/1313/1 "2020-02-05T07:27:29Z")

</div>

Hi,

We have a case where price lists with no organisation links remain on products. When a price list is present on a product and has no organisations, it seems that it can be chosen as the price for a product where the customer’s price list is not present.

Our solution is to simply delete the price lists with no organisation links, but the client feels that a stricter solution is in order.

What is the best practice for preventing a price list with no organisations to be selected as price for a product?

Litium version: 7

---

<div class="post-metadata">

**Author:** ![NilsN](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/nilsn/32/302_2.png) [@NilsN](https://forum.litium.com/u/NilsN)\
**Post date:** [February 5, 2020, 3:32pm UTC](https://forum.litium.com/t/further-restriction-on-price-lists/1313/2 "2020-02-05T15:32:28Z")

</div>

You could try adding a decorator that filters out pricelists without a organization link. With Litium 7.4 you could instead use permissions to control this (visitor wouldn’t have read access to a pricelist).

Something like this, tested with Litium 7.2.3.

```auto
using Litium.Products;
using Litium.Products.PriceCalculator;
using Litium.Runtime.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Litium.Accelerator.Services
{
	[ServiceDecorator(typeof(IPriceCalculator))]
	public class OrganizationPriceCalculatorDecorator : IPriceCalculator
	{
		private readonly IPriceCalculator _parentResolver;
		private readonly PriceListService _priceListService;

		public OrganizationPriceCalculatorDecorator(IPriceCalculator parentResolver, PriceListService priceListService)
		{
			_parentResolver = parentResolver;
			_priceListService = priceListService;
		}

		public IDictionary<Guid, PriceCalculatorResult> GetListPrices(PriceCalculatorArgs calculatorArgs, params PriceCalculatorItemArgs[] itemArgs)
		{
			LimitPricelists(calculatorArgs);

			return _parentResolver.GetListPrices(calculatorArgs, itemArgs);
		}

		public ICollection<PriceList> GetPriceLists(PriceCalculatorArgs calculatorArgs)
		{
			LimitPricelists(calculatorArgs);

			return _parentResolver.GetPriceLists(calculatorArgs);
		}

		private void LimitPricelists(PriceCalculatorArgs calculatorArgs)
		{
			var allowedPriceLists = _priceListService.GetAll().Where(list => list.OrganizationLinks.Count > 0).Select(x => x.SystemId).ToList();
			calculatorArgs.PriceListSystemIds = allowedPriceLists;
		}
	}
}

```

---

<div class="post-metadata">

**Author:** ![victaxel](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/victaxel/32/159_2.png) [@victaxel](https://forum.litium.com/u/victaxel)\
**Post date:** [February 6, 2020, 1:48pm UTC](https://forum.litium.com/t/further-restriction-on-price-lists/1313/3 "2020-02-06T13:48:55Z")

</div>

Thanks Nils! This works like a charm 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [March 5, 2020, 1:49pm UTC](https://forum.litium.com/t/further-restriction-on-price-lists/1313/4 "2020-03-05T13:49:05Z")

</div>

Closed on March 5, 2020, 1:49pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
