Subversion Repositories SmartDukaan

Rev

Rev 18759 | Rev 19023 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18759 Rev 18763
Line 77... Line 77...
77
        var globalminprice = 9999999;
77
        var globalminprice = 9999999;
78
        var globalminsku;
78
        var globalminsku;
79
        var globalmincashback = '';     
79
        var globalmincashback = '';     
80
        var globalminoffer = '';        
80
        var globalminoffer = '';        
81
        var calls = [];
81
        var calls = [];
-
 
82
        var priceRange = "";
82
        $('.storeminprice').each(function(){
83
        $('.storeminprice').each(function(){
83
            var temp = {'sort':$(this).data('searchorder'),'val':$(this)};
84
            var temp = {'sort':$(this).data('searchorder'),'val':$(this)};
84
            calls.push(temp);
85
            calls.push(temp);
85
        });
86
        });
86
        calls = sortByKey(calls,'sort');        
87
        calls = sortByKey(calls,'sort');        
Line 109... Line 110...
109
        properties.product_name = String($('#bestpriceproductname').html());
110
        properties.product_name = String($('#bestpriceproductname').html());
110
        pma.send('products','livesprice','fetch',me,properties);
111
        pma.send('products','livesprice','fetch',me,properties);
111
        var that = obj; 
112
        var that = obj; 
112
        var inStock = false;        
113
        var inStock = false;        
113
        var priceToCompare = 0;
114
        var priceToCompare = 0;
114
        var priceRange = "";
-
 
115
        var req = $.ajax({
115
        var req = $.ajax({
116
            url: '/store_products/getliveprice/'+$(that).data('bundle_id')+'/'+$(that).data('id'),
116
            url: '/store_products/getliveprice/'+$(that).data('bundle_id')+'/'+$(that).data('id'),
117
            // Tell jQuery we're expecting JSONP
117
            // Tell jQuery we're expecting JSONP
118
            dataType: "json",
118
            dataType: "json",
119
            // Tell YQL what we want and that we want JSON          
119
            // Tell YQL what we want and that we want JSON          
Line 140... Line 140...
140
                                }else{
140
                                }else{
141
                                    if (response.products[i].source_id == 4 && response.products[i].cheapestBulkPrice != 0) {
141
                                    if (response.products[i].source_id == 4 && response.products[i].cheapestBulkPrice != 0) {
142
                                                priceToCompare = response.products[i].cheapestBulkPrice;
142
                                                priceToCompare = response.products[i].cheapestBulkPrice;
143
                                                if(response.products[i].packQuantity>1){
143
                                                if(response.products[i].packQuantity>1){
144
                                                    priceRange =(Math.round((response.products[i].cheapestBulkPrice/response.products[i].packQuantity) * 100) / 100)    + " - "
144
                                                    priceRange =(Math.round((response.products[i].cheapestBulkPrice/response.products[i].packQuantity) * 100) / 100)    + " - "
145
                                                    + (Math.round((response.products[i].available_price/response.products[i].packQuantity) * 100) / 100) + " -/ per unit";
145
                                                    + (Math.round((response.products[i].available_price/response.products[i].packQuantity) * 100) / 100) + " /- per unit";
146
                                                }
146
                                                }
147
                                                else{
147
                                                else{
148
                                                    priceRange = response.products[i].cheapestBulkPrice
148
                                                    priceRange = response.products[i].cheapestBulkPrice
149
                                                    + " - "
149
                                                    + " - "
150
                                                    + response.products[i].available_price;
150
                                                    + response.products[i].available_price;
Line 215... Line 215...
215
                        $('#sku-'+$(that).data('id')).data('id',response.products[minpriceindex]['_id']).data('source',response.products[minpriceindex]['source_id']).data('price',response.products[minpriceindex]['available_price']).data('url',response.products[minpriceindex]['marketPlaceUrl']).removeClass('hidden');
215
                        $('#sku-'+$(that).data('id')).data('id',response.products[minpriceindex]['_id']).data('source',response.products[minpriceindex]['source_id']).data('price',response.products[minpriceindex]['available_price']).data('url',response.products[minpriceindex]['marketPlaceUrl']).removeClass('hidden');
216
                        if(globalminprice != 9999999) {
216
                        if(globalminprice != 9999999) {
217
                            $('#bestprice').html(globalminprice).siblings('.cashbackamount').html(globalmincashback).siblings('.productoffer').html(globalminoffer);
217
                            $('#bestprice').html(globalminprice).siblings('.cashbackamount').html(globalmincashback).siblings('.productoffer').html(globalminoffer);
218
                            $('#beststorelink').data('id',globalminsku).data('source',globalminsource).data('price',globalminprice).data('url',globalminurl).removeClass('hidden');
218
                            $('#beststorelink').data('id',globalminsku).data('source',globalminsource).data('price',globalminprice).data('url',globalminurl).removeClass('hidden');
219
                            $('#bestpricecontainer').removeClass('hidden');
219
                            $('#bestpricecontainer').removeClass('hidden');
-
 
220
 
220
                            if(typeof globalminsource!= "undefined") {
221
                            if(typeof globalminsource!= "undefined") {
221
                                if (globalminsource==4){
222
                                if (globalminsource==4){
222
                                    if (priceRange != "") {
223
                                    if (priceRange != "") {
223
                                                $('#bestprice').html(priceRange);
224
                                                $('#bestprice').html(priceRange);
224
                                    }
225
                                    }