Product structure

every product in Ordering Stack system is build based on tree data structure, meaning that each group type can be implemented inside the other group. Stacking group onto each other without any other configurations allows us to build more advance and flexible product builds.

Group types

  • looking on the structure of the product we can see that there is a few different kinds of groups:
    • product - main strucuture in which we can describe properties for a products
    • options - this group can hold more than one product and a special values which for example indicates how many products in this specific option can be choose
    • config - additional layer for the extra options
    • ref - reference to already created product

Meaning of selected and filter in product’s state

  • each product type can have it’s own state in which two objects are stored: selected and filter
  • selected holds a selCtx property as a key to an object of the id’s of the items which are selected in the specific selCtx range, this way we can easily indicate if the given item is selected for a product or not,
  • the main product also holds the main state of the entire set so if only the main state of the product is then manipulated while someone configures the meal
  • on the other hand filter can holds a fltCtx of the groups, this way the system knows if the given group should be display or hidden in the view component,

selCtx and fltCtx

  • selCtx allows us easily indicate which products belong to which group, works like a connector between the container and a single value, this way when we pick the specific sub-product system knows to which group in state.selected the sub-product should be added
  • on the other hand fltCtx is used for checking with state.filter if the specific fltCtx of the group is included in the filter state, this way the system knows if the given group or product should be visible

How the sub-products are stored

  • all of the sub-products are stored in the items array, for instance if there is a group options which holds with a few products inside, every product will be inside of items array of that group. The group will have his own unique selCtx and every single product inside of the items array will also consists this same selCtx as an indicator that they belong to this group options. Also the group options can hold the attributes like selMin or selMax which indicates how many of the products in the items array can be picked in this specific group

Other Attributes

Name Description Value Type Required
allowMultiples Only appearing on the group level, if it is set to true then we are able to change quantity of the products inside of that group Boolean False
selMin/selMax Only appearing on the group level, it sets the amount of product which can be selected in that group, e.g. if the group has the following products: ham, olives, cheese and the selMax is set to 2 then we can only pick two out of three of these products and that could be in this case ham and olives, so the cheese would not be able to be picked as long as we already selected two other products. String or Number False
qtyMin/qtyMax Appearing on the group as well as product level. In case of product level it indicates the quantity of that item we can pick for e.g there is a burger which has qtyMin set to 1 and qtyMax set to 3, meaning that it is required to get one burger but maximum we can get only three of them for this specific meal. On the other hand in the group level the qtyMin and qtyMax is a sum of all of the items quantity selected in this group, so for example if we selected a ham and olives and the group of these items has a property qtyMax set to 5, we could choose to pic maximum of 3 x ham and 2 x olives so their sum will be 5. String or Number False
isVoucher If value is “true” then this product is considered as voucher You should set a webhook orderChangeWebhook-CloseOrderEventCommand for ‘loyalty-voucher-buy-webhook/webhook’ which will process vouchers Boolean False
voucherAmount Indicates how many points this voucher will add to wallet when redeemed Number False
voucherExpireInDays Indicates after how many days this voucher will expire Number False
disallowPayment By using this attribute it is possible to disallow payment for a product with specified payment form. Example value “WALLET,COUPON,COD” It is usefull for buying vouchers when you want to force user to pay online and disallow payments types like cash on delivery (COD) or using points from wallet. String False
LK 09/07/2021