Web Product SKU (specification) selection

Source: Internet
Author: User

What is SKU

Wikipedia , the smallest inventory unit (keeping), is sometimes called items as a SKU in a chain retail store, defined as the smallest available unit for holding inventory control, such as
For example: the iphone has specifications: Color "red, gold, black", Memory Size "32g, 64g, 128g" Red +32g is a SKU, of course, can also be divided into a more detailed

background data is as follows: (table 1)

Color Memory Screen Size Stock
Red-A1 16g-b1 4.7-c1 100
Golden-A2 32g-b2 5.1-c2 110
Black-a3 64g-b3 4.7 120
Blue-A4 128g-b4 4.7 130

For the above data permutation combination gets, all the inventory SKU

The tabs are: (Table 2)

Color Select Item
Color Red Golden Black Blue
Memory 16G 32G 64G 128G
Screen 4.7 5.1



Product Requirements Show optional styles only with inventory buttons


Tab

Store the selected SKU in an array such as: SELECTSKU=[A1,B1,C1]

Programme 1:

Generate a map of all the specification permutations, such as:

skumap={
    a1:100,
    b1:100,
    c1:220,

}

The advantage is that only one operation is required, the latter only need to search through the key, but the initialization of the operation is relatively large

Programme 2:

Each time you choose to recalculate the inventory for the current option, such as:

selectsku=[a1,b1,c1];//has selected the specification
//If you want to know if C2 can choose, you need to obtain the inventory
/other analogy of KEY=A1B1C2 this SKU

Here thank you very much for a piece of article, write a very carefully. Interested can refer to the
Http://git.shepherdwind.com/sku-search-algorithm.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.