Alright, so I've now got a variable called productPrice that is passed
into Javascript with a jsonencode function.

function updateQuantity(input){
        i = $(input);
        var qiv = parseInt(i.attr('value'));
        // && i.attr('value') < ListGetAt(productPrice.DATA['PRICEBREAKS'][1],
(index+1) )
        for(var index=0;index<(1+ListLen(productPrice.DATA['PRICEBREAKS']
[0])); index++) {
                        var pb = 
parseInt(ListGetAt(productPrice.DATA['PRICEBREAKS']
[0],index-1));
                        var pbnext = 
parseInt(ListGetAt(productPrice.DATA['PRICEBREAKS']
[0],index));
                        var tilePrice = 
ListGetAt(productPrice.DATA['PRICELEVELS']
[0],ListLen(productPrice.DATA['PRICEBREAKS'][1]));
                        if ( qiv >= pb && qiv < pbnext  )
                        {
                                var tilePrice = 
ListGetAt(productPrice.DATA['PRICELEVELS'][0],
(index-1));
                        }

        }
        var dollars = i.attr('value')*tilePrice;
        $(tilep).empty().append(DollarFormat(tilePrice));
        var tp = "#totalPrice";
        $(tp).empty().append(DollarFormat(dollars));
}

Now, the prices are dynamically generated, but only for 1 size of
product.
I'm hardcoding the size of the product where you see the 0.
However, I'm not sure how to take this to the next step and to take
into account the size.
Do I need a more complicated variable structure?
Any examples out there like this that I can take a look at?

Reply via email to