Selling stuff is a pretty old human activity, and merchants had found ways to distinguish themselves from their competition way before Archimedes had shouted Heúrēka. Trade is a complicated business, and online shopping has not made that simpler, quite the contrary. So when programmers build systems to support online shopping they tend to stumble on their own erroneous, assumptions.
This post is similar to the one I made about geographic assumptions, but about online shopping, again this list is not exhaustive, and some of the falsehoods are disputable.
- A product has a price
- Products sold on auction site do not yet have a price. The moment the price is known is actually the moment the item will not be on sale anymore.
- Except for auctioned items, products have one price
- Products do not have one price, they have many prices: with or without taxes, then there is the sale price, the regular price, the list price, the manufacturer approved price, the mandatory publisher price.
- Products have one final total price
- The total price paid typically depends on a lot of variables: time of the transaction, location of the buyer, shipping methods, memberships, sometimes even the profiling of the buyer.
- A product has a strictly positive price
- Many phones are sold for “free”, there is typically a subscription behind it. Some online shops also add samplers and documentation as free items to their inventory.
- A price is a number
- Without a currency, a price is meaningless on the internet.
- A price is a floating pointer number and a currency
- Using floating points for price is incorrect: no currency is defined for transaction below two decimal points,
3.1415is a valid floating point number value, but USD 3.1415 is not a valid price for a transaction. Some currencies like the Japanese yen don’t accept any decimal position at all (the fraction of the yen, the sen, was removed from circulation in 1953). More generally floating point representation has rounding and approximation behaviour which are bad for monetary values which need to be exact.
- Currencies need to be rounded to some decimal position
- The Swiss franc needs to be rounded to five centimes.
- Currencies symbols uniquely identify a currency.
- The peso and dollar sign
$is used my many countries: USA, Cananda, Australia, Brunei, Namibia. The ¥ sign is used both the Japanese Yen and the Chinese Yuan.
- Currencies have a unicode symbol
- The Swiss franc does not, and until 2010, neither did the India rupee.
- Currencies have zero or one unicode symbol
- The dollar and peso symbol appears three times in unicode:
- Currencies have zero or one unicode symbol after normalisation
- The Japanese yen can be represented by the following symbols: ¥, 円, 圓.
- Currencies can be described by a single three letter code
- The ISO 4216 code for the Russian ruble is
RUB, the three letter code руб is widely used, so is
CA$for the Canadian dollar.
- Each stock keeping unit translates to a product
- Some bulky items have to be kept in the warehouse as two or more boxes, hence two stock keeping units, but can only sold together as one product.
- Each product has a picture
- Many generic, or bulky items are sold online without pictures: pocket books in Japan, but also packs of screws etc.
- You can put all products in database
- Increasingly products can be customised: a shop that sells T-shirts with custom text has an infinite number of products, which won’t fit in a database. Even if you consider some good whose dimensions can be customised, the combinatorial growth of possibilities will quickly go beyond the capacity of a database.
- There is a common keying system for products
- GTINs are the closest thing, but many smaller manufacturer do not participate in the system, some items have multiple keys. The system also does not support custom goods.
- There is a common system for annotating web-pages with products
- There are multiple micro-data and micro-format variants.
- In stock means the item is in the warehouse
- Many online sellers do not have any actual warehouse, they ship directly from their suppliers (Drop shipping)