Reputation: 183
I have an object. But i don't know how to get the ID because it change for each page. So if make:
var obj = bundle.config.options
I get this result: https://i.sstatic.net/XHSPP.jpg
Then, i want to get in a var the number of the object -> '42' in this case
And then, i want to insert into the selection, and i hope it was like:
bundle.config.options[42].selections[314]
And then change the fields. Am i confused?
How could get this value?
UPDATE
I have associate by loop of other objets, the minQty of products for each product.
$minimumQty = $_selection->getStockItem()->getMinSaleQty();
echo("<script>
var obj = bundle.config.options ;
var a = Object.keys(obj);
var keys = [];
for(var k in obj[a].selections) keys.push(k);
obj[a].selections[keys[d]].minQty = ".$minimumQty."
</script><br>");
The result -> each selection have the field: minQty with their number.
Upvotes: 2
Views: 57