PageSourceSearch

https://www.kateeldevi.in/Content/js/recommended.products.js?v=161

js kateeldevi.in collected 2026-10-02 21:06:20 UTC 10,496 bytes, 263 lines download raw bytes

1$(document).ready(function () {
2
3    _showRecentlyViewedproducts();
4
5});
6
7function removeAnItem(productId, list) {
8    for (var i = list.length - 1; i--;) {
9        if (parseInt(list[i].ProductID) === productId) list.splice(i, 1);
10    }
11    return list;
12}
13
14function _showRecentlyViewedproducts() {
15    var productId = $("#ProductID").val();
16
17
18    var cart = new irethink.RecentProduct();
19    var html = '';
20
21    var items = cart.getAllItems();
22    if (items != null && items.length > 0) {
23
24        //Check for the items in stock..
25        //Product/ProductsInStock
26
27        var _urlProductInStock = '/Product/ProductsInStock';
28        var itemsInStock = [];
29        $.ajax({
30            type: "GET",
31            url: _urlProductInStock,
32            // The key needs to match your method's input parameter (case-sensitive).
33            async: false,
34            contentType: "application/json; charset=utf-8",
35            dataType: "json",
36            success: function (result) {
37                itemsInStock = result;
38            }
39        });
40
41        $("#panelRecommened").show();
42
43        var itemsLength = 4;
44
45       
46
47        if (productId != undefined && parseInt(productId) > 0) {
48            items = removeAnItem(parseInt(productId), items);
49        }
50
51        var deviceWidth = $(window).width();
52        if (deviceWidth > 767 && deviceWidth < 1024) {
53            itemsLength = 2;
54            items = items.slice(0, 4);
55        }
56        else if (deviceWidth > 767) {
57            itemsLength = 4;
58            items = items.slice(0, 8);
59        } else {
60            itemsLength = 1;
61            items = items.slice(0, 4);
62        }
63
64        var activeItems = items.slice(0, itemsLength);
65        var doWeHaveSecondLine = items.length > itemsLength;
66
67        if (activeItems != null && activeItems.length > 0) {
68
69            html += '<div class="item active ">';
70            for (var i = 0; i < activeItems.length; i++) {
71                var product = activeItems[i];
72                if (product.ProductID != productId) {
73                    var isAddToCartEnable = isItemInStock(itemsInStock, product.ProductID);
74                    html += _getRecommenedProducts(product, isAddToCartEnable);
75                    anyItem = true;
76                }
77            }
78            html += '</div>';
79        }
80
81        if (doWeHaveSecondLine) {
82            if (deviceWidth > 767) {
83                html += '<div class="item">';
84                for (var i = itemsLength; i < items.length; i++) {
85                    var product = items[i];
86
87                    if (product != undefined && product.ProductID != undefined && product.ProductID != productId) {
88                        var isAddToCartEnable = isItemInStock(itemsInStock, product.ProductID);
89                        html += _getRecommenedProducts(product, isAddToCartEnable);
90                    }
91
92                }
93                html += '</div>';
94            }
95            else {
96
97                for (var i = itemsLength; i < items.length; i++) {
98                    var product = items[i];
99
100                    if (product != undefined && product.ProductID != undefined && product.ProductID != productId) {
101                        var isAddToCartEnable = isItemInStock(itemsInStock, product.ProductID);
102                        html += '<div class="item">';
103                        html += _getRecommenedProducts(product, isAddToCartEnable);
104                        html += '</div>';
105                    }
106
107                }
108
109            }
110        }
111
112        if (items.length > itemsLength) {
113            $('#slPrev').show();
114            $('#slNext').show();
115        }
116        else {
117            $('#slPrev').hide();
118            $('#slNext').hide();
119        }
120
121        $("#dvRecommenedProducts").empty();
122        $("#dvRecommenedProducts").append(html);
123
124    }
125    else {
126        $("#panelRecommened").hide();
127        $('#slPrev').hide();
128        $('#slNext').hide();
129    }
130
131}
132
133function isItemInStock(itemsInStock, productId) {
134    if (itemsInStock != null && itemsInStock.length > 0) {
135        for (var i = 0; i < itemsInStock.length; i++) {
136            if (itemsInStock[i] == productId)
137                return true;
138        }
139    }
140    return false;
141}
142
143
144(function (window) {
145    window.htmlentities = {
146        /**
147         * Converts a string to its html characters completely.
148         *
149         * @param {String} str String with unescaped HTML characters
150         **/
151        encode: function (str) {
152            var buf = [];
153
154            for (var i = str.length - 1; i >= 0; i--) {
155                buf.unshift(['&#', str[i].charCodeAt(), ';'].join(''));
156            }
157
158            return buf.join('');
159        },
160        /**
161         * Converts an html characterSet into its original character.
162         *
163         * @param {String} str htmlSet entities
164         **/
165        decode: function (str) {
166            return str.replace(/&#(\d+);/g, function (match, dec) {
167                return String.fromCharCode(dec);
168            });
169        }
170    };
171})(window);
172
173
174function _getRecommenedProducts(product, isAddToCartEnable) {
175
176    var isInfo = product.IsInfo.toString().toLowerCase();
177
178    var html = '';
179    html += '<div class="col-md-3 col-sm-6 col-xs-12">';
180    html += '<div class="product-image-wrapper">';
181    html += '<div class="single-products">';
182
183    if (isShoppingCartModuleConfigured.toLowerCase() == 'true') {
184        html += '<div class="productinfo text-center">';
185    }
186    else {
187        html += '<div class="productinfo text-center no-btn">';
188    }
189    html += '<div class="image-holder"><span><img itemprop="image" src="' + product.Url + '" alt="' + product.Title + '" /></span></div><meta itemprop="price" content="' + product.Price + '"><meta itemprop="priceCurrency" content="INR">';
190
191    if (isInfo != 'true') {
192        if (parseFloat(product.Price) > 0) {
193            html += '<div class="product"><h2><a itemprop="url" href="' + _urlProductDetail + '?Product=' + product.Title.trim().replace(/\s+/g, '-').toLowerCase() + '&Pid=' + product.ProductID + '"><span itemprop="name" class="custom-tooltip"  data-content="' + decodeURIComponent(product.Title) + '">' + text_title(product.Title, 45, '...') + '</span> </a></h2> <small class="custom-tooltip" data-content="' + product.Description + '">' + text_description(product.Description, 80, '...') + '</small>';
194        }
195        else {
196            html += '<div class="product"><h2><a itemprop="url" href="' + _urlProductDetail + '?Product=' + product.Title.trim().replace(/\s+/g, '-').toLowerCase() + '&Pid=' + product.ProductID + '"><span itemprop="name" class="custom-tooltip"  data-content="' + decodeURIComponent(product.Title) + '">' + text_title(product.Title, 45, '...') + '</span> </a></h2> <small class="custom-tooltip" data-content="' + product.Description + '">' + text_description(product.Description, 230, '...') + '</small>';
197        }
198
199    }
200    else {
201        html += '<div class="product"><h2><a itemprop="url" href="' + _urlProductDetail + '?Product=' + product.Title.trim().replace(/\s+/g, '-').toLowerCase() + '&Pid=' + product.ProductID + '"><span itemprop="name" class="custom-tooltip"  data-content="' + decodeURIComponent(product.Title) + '">' + text_title(product.Title, 45, '...') + '</span> </a></h2> <small class="custom-tooltip" data-content="' + product.Description + '">' + text_description(product.Description, 230, '...') + '</small>';
202    }
203
204
205
206    if (isInfo != 'true') {
207
208        if (product.AnyDiscount != undefined && product.AnyDiscount != null && product.AnyDiscount.toString().toLowerCase() == "true") {
209            html += '<div class="price">';
210
211            html += '<span class="mrkCulture">' + massagePrice(product.DiscountPrice) + '</span>';
212
213            html += '<div class="price-offer-line">';
214
215            html += '<span class="mrkCulture original-price">' + massagePrice(product.Price) + '</span>';
216            if (product.ByPercentage.toString().toLowerCase() == "true") {
217                html += '<span class="price-offer-percentage">' + product.DiscountTypeValue + '% Off</span>';
218            }
219            else {
220                html += '<span class="price-offer-value">You save ' + massagePrice(product.DiscountTypeValue) + '</span>';
221            }
222
223            html += '</div>';
224
225            html += '</div>';//price
226        }
227        else {
228            if (parseFloat(product.Price) > 0) {
229                html += '<div class="price">';
230                html += '<span class="mrkCulture">' + massagePrice(product.Price) + '</span>';
231                html += '</div>';
232            }
233        }
234    }
235
236
237    html += '</div>';
238
239
240    if (isInfo != 'true') {
241
242        if (isShoppingCartModuleConfigured.toLowerCase() == 'true') {
243            if (isAddToCartEnable) {
244                if (product.DiscountPrice != undefined) {
245                    html += '<div class="button-section"><a data-url="' + product.Url + '" href="#" class="btn btn-default add-to-cart" data-title="' + product.Title + '" data-room-type="' + product.IsRoomType + '" data-vat="' + product.VAT + '" data-id="' + product.ProductID + '" data-price="' + product.DiscountPrice + '"><i class="fa fa-shopping-cart"></i>Add to ' + _ShoppingCartMessage + '</a></div>';
246                }
247                else {
248                    html += '<div class="button-section"><a data-url="' + product.Url + '" href="#" class="btn btn-default add-to-cart" data-title="' + product.Title + '" data-room-type="' + product.IsRoomType + '" data-vat="' + product.VAT + '" data-id="' + product.ProductID + '" data-price="' + product.Price + '"><i class="fa fa-shopping-cart"></i>Add to ' + _ShoppingCartMessage + '</a></div>';
249                }
250            }
251            else {
252                html += '<div class="button-section"><a data-url="' + product.Url + '" disabled href="#" class="btn btn-default add-to-cart" data-title="' + product.Title + '" data-vat="' + product.VAT + '" data-id="' + product.ProductID + '" data-price="' + product.DiscountPrice + '"><i class="fa fa-shopping-cart"></i>Add to ' + _ShoppingCartMessage + '</a></div>';
253            }
254        }
255    }
256    html += '</div>';
257    html += '</div>';
258    html += '</div>';
259    html += '</div>';
260    return html;
261}
262
263

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.