Sign In Register

How can we help you today?

Start a new topic
Answered

How do I utilize tags on virtual goods?

Ideally, I'd like to filter the list of virtual goods I get back when I call SparkPlayer.getVirtualGoods(), but it looks like that's not an option.  Where do the tags get used, anyway?


Best Answer

 Hey Rich,

You can get the tag from your VG list as you loop through them. They are an attribute of the VG.


 

var vGoods = config.getVirtualGoods();
var vGoodsTypeA = [];
            for( var i = 0; i < vGoods.length; i++)
            {
                var tags = vGoods[i].tags;
                if(tags.indexOf("A") > -1)
                {
                     vGoodsTypeA.push(vGoods[i]);
                }

            }

 

Does that make sense?

Sean


Makes sense.  I was hoping it could be used as a filter without pulling the whole collection first.  I may submit a feature request, but it's no big deal.  Thanks!

Answer

 Hey Rich,

You can get the tag from your VG list as you loop through them. They are an attribute of the VG.


 

var vGoods = config.getVirtualGoods();
var vGoodsTypeA = [];
            for( var i = 0; i < vGoods.length; i++)
            {
                var tags = vGoods[i].tags;
                if(tags.indexOf("A") > -1)
                {
                     vGoodsTypeA.push(vGoods[i]);
                }

            }

 

Does that make sense?

Sean

Login to post a comment