开发者

Creating a customizable, made-to-order Product Catalog in Document Database

开发者 https://www.devze.com 2023-04-11 08:43 出处:网络
My original intent was to ask this question for MongoDB, but I quickly realized this question probably applies to other document oriented databases like CouchDB and others. I\'m having a hard time wra

My original intent was to ask this question for MongoDB, but I quickly realized this question probably applies to other document oriented databases like CouchDB and others. I'm having a hard time wrapping my head around building a product catalog that supports made-to-order products. Here is a basic set of objectives for the catalog:

  1. Every product has a configurable set of options. Things like materials used to produce the product, or the colors that are printed on them. Certain options make other options available, why certain options restrict other options from being available.
  2. The pricing varies from option to option, for some options it's a percent on top of a base price, and for others it's a flat amount.
  3. There is also the aspect of special prices. We may have contracts with various other companies that give specialized prices across a range of products. We often offer promo codes and discounts both at the line and order header.

Ultimately, the hardest part to figure out, is the general schema for a product entry. Should I be doing something along the lines of:

    {
        "Product_Name": "Test Product 1",
        "Product_Number": "P00001",
        "BasePrice":"10",
        "AvailableSize":
        [
            {
               "Length":"1","Width":"1",
               "PriceType":"PercentOnBase",
               "Price":"5"
            },
            {
               "Length":"1","Width":"2",
               "PriceType":"PercentOnBase",
               "Price":"6"
            },
            {
               "Length":"2","Width":"2",
               "PriceType":"PercentOnBase",
               "Price":"7.5"
            },
            {
               "Length":"2","Width":"3",
               "PriceType":"PercentOnBase",
               "Price":"10"
            },
            {
               "Length":"3","Width":"3",
               "PriceType":"PercentOnBase",
               "Price":"15"
            }
        ],
        "AvailableNumberImprints":
        [
            {
               "ImprintNumber":"1",
               "PriceType":"PercentOnBase",
               "Price":"10"
            },
            {
               "ImprintNumber":"2",
               "PriceType":"PercentOnBase",
               "Price":"12"
            },
            {
               "ImprintNumber":"3",
               "PriceType":"PercentOnBase",
               "Price":"14"
            },
            {
               "ImprintNumber":"4",
               "PriceType":"PercentOnBase",
               "Price":"16"
            },
            {
               "ImprintNumber":"5",
               "PriceType":"PercentOnBase",
               "Price":"17"
            },
            {
    开发者_运维知识库           "ImprintNumber":"6",
               "PriceType":"PercentOnBase",
               "Price":"20"
            },                      
        ],
            "AvailableMaterials":
        [
            {
               "MaterialName" : "Black",
               "MaterialNumber": "M00001",
               "PriceType":"PercentageOnBase",
               "Price":"5"
            }
            {
               "MaterialName" : "White",
               "MaterialNumber": "M00002",
               "PriceType":"PercentageOnBase",
               "Price":"5"
            }
            {
               "MaterialName" : "Pearl",
               "MaterialNumber": "M00003",
               "PriceType":"PercentageOnBase",
               "Price":"5"
            }
            {
               "MaterialName" : "Green",
               "MaterialNumber": "M00004",
               "PriceType":"PercentageOnBase",
               "Price":"5"
            }
        ]
    }

The issue I run into quickly is that this makes it somewhat awkward to restrict other options without being extremely redundant. Any thoughts?

0

精彩评论

暂无评论...
验证码 换一张
取 消