Developer forum

Forum » Ecommerce - Standard features » Quantity Prices

Quantity Prices

Lara Arsénio
Reply

- Hello I am building a intervaled price list table using Product.prices

When i have more than one price defined to a same quantity, it is necessary to Filter the loop, to avoid inconsistent data in Output (like in the attached image of test Product )
 - I resolved that problem by ordering the loop by value and qty, ending with a distinctby to remove the duplicate qty
 GetLoop("Product.Prices").OrderBy(x => x.GetInteger("Ecom:Product.Prices.Quantity")).ThenBy(x => x.GetInteger("Ecom:Product.Prices.AmountWithVATFormatted")).DistinctBy(x=> x.GetInteger("Ecom:Product.Prices.Quantity")).ToList();

This apparently resolves my problem, but i am assuming that when having multiple prices, the lowest is prioritary. 
Is that a correct assumption? 

Another question - does this the prices table reflect on "Ecom:Product.Price" tag? I added a few different prices assigned to qty=1, and none of them equal to the main product price.

Should we allow/show display of this data to a qty ==1, if that will not match the Main price presented in the PDP / PDL?

Best regards

Price-table-setup.PNG Price_Tables_Output_without_distinct.PNG

Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Lara

When a product price is shown, all price records for the product (ProductID) are loaded - ordered by the column PriceID. Then all prices are checked against their conditions (current Currency, date, user, customer no etc.) to see if it is a valid price - this includes quantity, but when showing a product quantity is always 1. If all conditions pass, the price is a 'candidate'. If the next price also pass conditions, that will then become the 'candiate' overwriting the one found previously.

If a candidate is found, the price from that is used - otherwise it falls back to the price from the product record, price column.

So if you have 2 prices for the same quanitity, the one found last wins.

When a product is added to the cart, the cart will retrieve the price for the orderline unitprice the same way - except using the quantity specified on the orderline.

It is possible, using a secret hack, to change the order of how the prices from the database are ordered:

In globalsettings, set /Globalsettings/Ecom/Price/List/UseCustomOrder = True and then set the /Globalsettings/Ecom/Price/List/CustomOrder to a list of fields in the order of which you want to sort the prices, i.e set /Globalsettings/Ecom/Price/List/CustomOrder to : 'Quantity,Amount,Id'

These are possible values in the CustomOrder:

  • Id
  • Amount
  • CurrencyCode
  • VariantId
  • UserId
  • UserGroupId
  • UserCustomerNumber
  • ValidFrom
  • ValidTo
  • PeriodId
  • UnitId
  • StockLocationId
  • LanguageId
  • CountryCode
  • ShopId
  • Quantity
  • IsInformative

BR Nicolai

Votes for this answer: 1
 
Lara Arsénio
Reply

Hi Nicolai.

This was very helpfull.

In this case I needed to show a full Table List of Price vs Quantity, so, in order for the ''Ecom:Product.Price ' to match the value(s) In that list, It is necessary to limi tthe display to products that have

- Ecom :Product.PriceType'  == '1' (Fixed Price type)

- 'Ecom:Product.Type'  ==  '0' (Stock Item)

Otherwise, if having calculated prices, the output values will not match

 

You must be logged in to post in the forum