Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie

I am trying to get products by id in Pos javascript.

Here is my code

***.js**

     get_promotional_products: function(options){

     var self = this;

     var offer_lines = this.pos.promo_running_configs.offer_line;

     var promo_product = [];

    _.each(offer_lines, function(line){

       _.each(line.offer_product_id, function(offer_product){

        var offer_product= 41;// It works

         promo_product.push(self.pos.db.get_product_by_id(offer_product));

         });

    });

    console.log('promo_product',promo_product);

    return promo_product;

    },

When pass `product_id` as variable i getting below error:

` TypeError: cur is undefined`

When I hard code a value it works fine.

How can I solve this?

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
lip 19
9753
3
lip 25
17042
0
lut 24
1500
1
paź 18
6239
1
lis 24
1449