I have upgrade my web site from nop 1.9 to nop 2.2. Now I'm not more able to have the products price linked to the customer role. In nop 1.9 was easy using produts variant-> tier prices Is ti possible in nop2.2?
I have upgrade my web site from nop 1.9 to nop 2.2. Now I'm not more able to have the products price linked to the customer role. In nop 1.9 was easy using produts variant-> tier prices Is ti possible in nop2.2?
Thanks, Giorgio
In 1.9 when creating/editing product variants you had two differnent tabs: Tiered Prices and Prices by Customer Role. In 2.x you can handle BOTH in Tier Prices which can be assigned to all/specific customer role. So you can now define a single price or better tier prices for customer roles :)
I have define tier price for customer role but it does not work. I have a product with 3 customer role prices, quantity 0 (the fild is mandatory) and price. The global price is 0. In the store I always see 0 price indipendently of the customer. Also I try to modify the tier price configuration enabling it and disabling it. The result it's always the same.
It does not work. Also I'm not able to see this "decison" inside the C# code. I try locally to update the GetFinalPrice function in priceCalculationService.cs with this if case:
//tier prices off -> check for customer price list if (_catalogSettings.IgnoreTierPrices && productVariant.TierPrices.Count > 0) { decimal tierPrice =0;
foreach (var tierPrice_ in productVariant.TierPrices) { foreach (var customerRol in customer.CustomerRoles) { if (customerRol.Id == (tierPrice_.CustomerRoleId.HasValue ? tierPrice_.CustomerRoleId : 0)) if (tierPrice>tierPrice_.Price) // Apply the lower price list tierPrice = tierPrice_.Price; } } initialPrice = Math.Min(initialPrice, tierPrice); }
And apparently work fine. Do I need to upload all the bin directory or Nop.Services.dll is ok?
I try this code locally: if (_catalogSettings.IgnoreTierPrices && productVariant.TierPrices.Count > 0) { decimal tierPrice = -1;
foreach (var tierPrice_ in productVariant.TierPrices) { foreach (var customerRol in customer.CustomerRoles) { if (customerRol.Id == (tierPrice_.CustomerRoleId.HasValue ? tierPrice_.CustomerRoleId : 0)) // if ((tierPrice==-1) || ((tierPrice>tierPrice_.Price)&&(tierPrice_.Price!=0))) // Apply the lower price list tierPrice = tierPrice_.Price; } } initialPrice = Math.Min(initialPrice, tierPrice); }
and it work. The same code on my remote server does not work. I try to restore original code locally and I it work!!!! Probably something is wrong on the remote configuration. Maybe the productVariant.TierPrices structure is empty or the customer.CustomerRoles structure is empty. Any idea?
I have find the solution. I don't know why but if the product price is 0 or less of the customer price list, then it does not work. In order to get it working I need to insert 9999 in product price.
nopCommerce finds and uses the smallest price. In your case it's 0 (default product variant price). So just set the price to any number that is larger than the configured tier prices.