This question has been flagged
1 Reply
5022 Views

I'd like the POS to show only products from the current category, not subcategories. The reason is because we are selling made-to-order food products, and I'd like to use subcategories to create a succession of selections at checkout: first sandwich type, then bread type, then meat type, then cheese type, etc, with each selection represented by a separate subcategory.

I'm not very good at programming, but I think I've traced the fuction in question down to get_product_by_category in the db.js file.

Here's the code:

get_product_by_category: function(category_id){
    var product_ids  = this.product_by_category_id[category_id];
    var list = [];
    if (product_ids) {
        for (var i = 0, len = Math.min(product_ids.length, this.limit); i < len; i++) {
            list.push(this.product_by_id[product_ids[i]]);
        }
    }
    return list;
},

I'm not sure how to alter this to show only products from the currently selected POS category, excluding products from sub-categories. Any help would be appreciated!

Avatar
Discard
Author Best Answer

OK, I figured this out.

Change line 179 in db.js from this:

            var ancestors = this.get_category_ancestors_ids(categ_id) || [];

To this:

            var ancestors = [];

I'd love to have this added as a configurable option in the future!

Avatar
Discard