1/*! 2 * RB JavaScript Library 3 * 4 * Copyright 2015, rb-shop 5 */ 6 7// Basket - Start 8function RB_Basket_ResponseRefresh(response, basketajaxid, basketminiajaxid, basketcheckoutajaxid, showinfo, showbasket, closebasket, popupBasket) { 9 if (response) { 10 if (response.Status) { 11 var ajaxdiv = $('#' + basketajaxid); 12 if (ajaxdiv) 13 ajaxdiv.html(response.Result); 14 var ajaxminidiv = $('#' + basketminiajaxid); 15 if (ajaxminidiv) 16 ajaxminidiv.html(response.Result2); 17 var ajaxcheckoutdiv = $('#' + basketcheckoutajaxid); 18 if (ajaxcheckoutdiv) 19 ajaxcheckoutdiv.html(response.Result3); 20 if (showinfo == 1) { 21 if (response.PopupDivData && (response.PopupDivData != '')) { 22 RBLoadPopupData("extranew", response.PopupDivData, "", ""); 23 } 24 else { 25 var buttonOnClick = ""; 26 if (showbasket == 1) 27 buttonOnClick = ".popup-popupbasket_full_button_on"; 28 if (response.MessageDivData && (response.MessageDivData != '')) { 29 var waitTime = 2000; 30 if (response.MessageDivWaitTime > 0) 31 waitTime = response.MessageDivWaitTime; 32 RBMessageDiv(response.MessageDiv, response.MessageDivData, buttonOnClick, true, waitTime); 33 } 34 else { 35 if (response.Message && (response.Message != '')) { 36 RBMessage(response.Message, "", "", true, buttonOnClick); 37 } 38 else { 39 if (buttonOnClick && (buttonOnClick != '')) 40 RBOnClick(buttonOnClick); 41 } 42 } 43 } 44 } 45 else { 46 if (popupBasket == 1) 47 RBOnClick(".popup-popupbasket_full_button_on"); 48 } 49 RBSetValue('#CheckoutSumma', response.Data); 50 if (response.total) 51 RBSetValue('#Total', response.total); 52 if (response.Action) { 53 eval(response.Action); 54 } 55 CheckOutFormReset(); 56 if (closebasket == 1) { 57 setTimeout(function () { 58 RBBodyOverlayClick(); 59 }, 2000); // <-- time in milliseconds 60 } 61 } 62 else { 63 RBMessage(response.Message); 64 } 65 } 66} 67 68function RB_Basket_AddItem(url, productidvalue, quantityvalue, inputFields, inputFieldsError, productname, productdetails, basketajaxid, basketminiajaxid, 69 basketcheckoutajaxid, showinfo, showbasket, closebasket, numberField, numberInputField, listitemid, popupruleid, itemid, offerid, newsid, productPackage, creditprice, 70 buttonClassName, tempOrderItemId) { 71 if (inputFields) { 72 productdetails = ""; 73 var ca = inputFields.split(';'); 74 for (var i = 0; i < ca.length; i++) { 75 var c = ca[i]; 76 var inputvalue = RBGetValue("#" + c); 77 var okvalue = false; 78 if (inputvalue) 79 if (inputvalue != "") 80 if (inputvalue != "0") 81 okvalue = true; 82 if (!okvalue) { 83 if (!inputFieldsError) 84 inputFieldsError = "Válassz!"; 85 RBMessage(inputFieldsError); 86 return; 87 } 88 if (i > 0) 89 productdetails += ";"; 90 productdetails += inputvalue; 91 } 92 } 93 if (numberField) 94 quantityvalue = parseInt($(numberField).html()); 95 if (numberInputField) { 96 quantityvalue = parseInt($(numberInputField).val()); 97 if (quantityvalue <= 0) { 98 RBMessage(inputFieldsError); 99 return; 100 } 101 } 102 if (buttonClassName) 103 if (buttonClassName != '') 104 $('.' + buttonClassName).addClass("addbasket-working"); 105 $.post(url, { 106 productid: productidvalue, quantity: quantityvalue, productname: productname, productdetails: productdetails, listitemid: listitemid, popupruleid: popupruleid, itemid: itemid, 107 offerid: offerid, newsid: newsid, showinfo: showinfo, showbasket: showbasket, productPackage: productPackage, creditprice: creditprice, tempOrderItemId: tempOrderItemId 108 }, function (response) { 109 if (buttonClassName) 110 $('.' + buttonClassName).removeClass("addbasket-working"); 111 $('body').removeClass("body_landingpage"); 112 RB_Basket_ResponseRefresh(response, basketajaxid, basketminiajaxid, basketcheckoutajaxid, showinfo, showbasket, closebasket, 0); 113 }).fail(function (response) { 114 if (buttonClassName) 115 if (buttonClassName != '') 116 $('.' + buttonClassName).removeClass("addbasket-working"); 117 $('body').removeClass("body_landingpage"); 118 RBAjaxPostError(); 119 });
120}; 121 122function RB_Basket_ResponsePackagePanel(response, closebasket) { 123 if (response) { 124 if (response.Status) { 125 var div = $('.productpackagepanelfull'); 126 if (response.Result) 127 if (response.Result != '') 128 div.html(response.Result); 129 if (response.Message && (response.Message != '')) { 130 RBMessage(response.Message, "", "", true, ""); 131 } 132 133 if (response.Action) { 134 eval(response.Action); 135 } 136 if (closebasket == 1) 137 RBBodyOverlayClick(); 138 } 139 else { 140 RBMessage(response.Message); 141 } 142 } 143} 144 145function RB_Basket_AddPackagePanelItem(url, productcode, isdelete) { 146 $.post(url, { 147 productcode: productcode, isdelete: isdelete 148 }, function (response) { 149 RB_Basket_ResponsePackagePanel(response, 0); 150 }).fail(function (response) { 151 RBAjaxPostError(); 152 }); 153}; 154 155function RB_Basket_GetBasketPackagePanelItem(url, itemid) { 156 $.post(url, { 157 shopitemid: itemid 158 }, function (response) { 159 RB_Basket_ResponsePackagePanel(response, 1); 160 }).fail(function (response) { 161 RBAjaxPostError(); 162 }); 163}; 164 165function RB_Basket_AddPackageToBasket(url, productcode, basketajaxid, basketminiajaxid, basketcheckoutajaxid, closebasket, popupBasket) { 166 $.post(url, { 167 productcode: productcode 168 }, function (response) { 169 RB_Basket_ResponseRefresh(response, basketajaxid, basketminiajaxid, basketcheckoutajaxid, 1, 1, closebasket, popupBasket); 170 }).fail(function (response) { 171 RBAjaxPostError(); 172 }); 173}; 174 175function RB_Basket_Refresh(url, basketid, basketajaxid, basketminiajaxid, basketcheckoutajaxid, closebasket, popupBasket) { 176 $.post(url, { 177 basketid: basketid 178 }, function (response) { 179 RB_Basket_ResponseRefresh(response, basketajaxid, basketminiajaxid, basketcheckoutajaxid, 0, 0, closebasket, popupBasket); 180 }); 181}; 182 183function RB_ChangeBasket(url, basketselectclass, basketid, reload) { 184 $('.basketchoice_item').removeClass("basketchoice_item_selected"); 185 $('.' + basketselectclass).addClass("basketchoice_item_selected"); 186 setTimeout(function () { 187 $.post(url, { 188 basketid: basketid 189 }, function (response) { 190 RBBodyOverlayClick(); 191 if (response) { 192 if (response.error) { 193 RBMessage(response.error, "", "", true); 194 return; 195 } 196 if (reload) { 197 RBReLoad(); 198 return; 199 } 200 RBOnClick(".basket_refresh_button"); 201 } 202 }); 203 }, 1000); 204} 205 206function RB_DeleteBasket(url, basketid, confirm) { 207 if (!RBConfirm(confirm)) 208 return; 209 $.post(url, { 210 basketid: basketid 211 }, function (response) { 212 if (response) { 213 if (response.error) { 214 RBMessage(response.error, "", "", true); 215 return; 216 } 217 RBReLoad(); 218 } 219 }).fail(function (response) { 220 RBAjaxPostError(); 221 }); 222} 223 224function RB_ClearBasket(url, confirm) { 225 if (!RBConfirm(confirm)) 226 return; 227 $.post(url, { 228 }, function (response) { 229 if (response) { 230 if (response.error) { 231 RBMessage(response.error, "", "", true); 232 return; 233 } 234 RBReLoad(); 235 } 236 }).fail(function (response) { 237 RBAjaxPostError(); 238 }); 239} 240// Basket - End 241 242function RBLoadWebDataShopItems(url, webdatashopid) { 243 RBBodyOverlayClick(); 244 var divid = "allwebshop_item_child-" + webdatashopid; 245 var $origdiv = $('.' + divid); 246 $origdiv.html(""); 247 var $ajaxloading = $origdiv;
248 RBAjax_AjaxLoadingItemStart($ajaxloading, true); 249 $.post(url, { 250 webdatashopid: webdatashopid 251 }, function (response) { 252 RBAjax_AjaxLoadingItemEnd($ajaxloading, true); 253 if (response) { 254 if (response.error) { 255 RBMessage(response.error, "", "", true); 256 return; 257 } 258 // RBBodyOverlayOn(); 259 var ajaxdiv = $('.' + divid); 260 ajaxdiv.html(response.result); 261 } 262 }).fail(function (response) { 263 RBAjax_AjaxLoadingItemEnd($ajaxloading, true); 264 RBAjaxPostError(); 265 }); 266} 267 268function RBLoadOldOrdersAdd(azon, url, masterclass, buttonAzon, buttonClass, loadingClass) { 269 RBBodyOverlayClick(); 270 var rootDiv = "." + azon; 271 var div = " ." + buttonAzon; 272 var $origdiv = $(" ."+buttonClass); 273 var $ajaxloading = $(" ." + loadingClass); 274 RBAjax_AjaxLoadingItemStart($ajaxloading, true); 275 $.post(url, { 276 }, function (response) { 277 RBAjax_AjaxLoadingItemEnd($ajaxloading, true); 278 if (response) { 279 if (response.error) { 280 RBMessage(response.error, "", "", true); 281 return; 282 } 283 // RBBodyOverlayOn(); 284 RBAddData("." + masterclass, response.result) 285 SetDisable(div); 286 } 287 }).fail(function (response) { 288 RBAjax_AjaxLoadingItemEnd($ajaxloading, true); 289 RBAjaxPostError(); 290 }); 291} 292 293function RBLoadOldOrders(azon, url) { 294 RBBodyOverlayClick(); 295 var rootDiv = "." + azon; 296 var div = rootDiv + " .allwebshop_oldorders_button"; 297 var $origdiv = $(div); 298 var $ajaxloading = $origdiv;
299 RBAjax_AjaxLoadingItemStart($ajaxloading, true); 300 $.post(url, { 301 }, function (response) { 302 RBAjax_AjaxLoadingItemEnd($ajaxloading, true); 303 if (response) { 304 if (response.error) { 305 RBMessage(response.error, "", "", true); 306 return; 307 } 308 // RBBodyOverlayOn(); 309 var maindiv = $(rootDiv + " .allwebshop_oldorders_main"); 310 maindiv.html(response.result); 311 SetDisable(div); 312 } 313 }).fail(function (response) { 314 RBAjax_AjaxLoadingItemEnd($ajaxloading, true); 315 RBAjaxPostError(); 316 }); 317} 318 319function RBShopBasketOpen() { 320 RBOnClick(".popup-popupbasket_full_button_on"); 321} 322 323function RBShopBasketClose() { 324 RBBodyOverlayClick(); 325} 326 327function RBAbortWebShopGroup(confirm, masterpersonid, personid) { 328 if (!RBConfirm(confirm)) 329 return; 330 var ajaxurl = "/Home/AbortWebShopGroup"; 331 $.post(ajaxurl, { 332 masterpersonid: masterpersonid, personid: personid 333 }, function (response) { 334 if (response.error != '') { 335 RBMessage(response.error); 336 return; 337 } 338 RBShopBasketClose(); 339 RBShopBasketOpen(); 340 }); 341} 342 343function RBMLMLoadBrokerInfo(divid, datetime) { 344 var ajaxurl = "/Home/LoadBrokerInfo"; 345 var $origdiv = $('.' + divid); 346 $origdiv.html(""); 347 var $ajaxloading = $origdiv;
348 RBAjax_AjaxLoadingItemStart($ajaxloading, true); 349 $.post(ajaxurl, { 350 datetime: datetime 351 }, function (response) { 352 RBAjax_AjaxLoadingItemEnd($ajaxloading, true); 353 if (response) { 354 if (response.error != '') { 355 RBMessage(response.error); 356 return; 357 } 358 if (response.result1) { 359 var $ajaxdiv = $('.' + divid + '_1'); 360 $ajaxdiv.html(response.result1); 361 } 362 if (response.result2) { 363 var $ajaxdiv = $('.' + divid + '_2'); 364 $ajaxdiv.html(response.result2); 365 } 366 } 367 }).fail(function (response) { 368 RBAjax_AjaxLoadingItemEnd($ajaxloading, true); 369 RBAjaxPostError(); 370 }); 371} 372 373function RBLoadBinaryTree(url, divid, structurecode) { 374 var $origdiv = $('#' + divid); 375 var $ajaxloading = $origdiv; 376 RBAjax_AjaxLoadingItemStart($ajaxloading, true); 377 $.post(url, { 378 id: divid, structurecode: structurecode 379 }, function (response) { 380 RBAjax_AjaxLoadingItemEnd($ajaxloading, true); 381 if (response) { 382 if (response.result) { 383 $origdiv.html(response.result); 384 } 385 } 386 }).fail(function (response) { 387 RBAjax_AjaxLoadingItemEnd($ajaxloading, true); 388 RBAjaxPostError(); 389 }); 390} 391 392function RBMasterDataChange(changeUrl, masterid, masterdiv, masterarticlediv, field, colorfield, sizefield, propertyid, propertyParamField, propertyFields, imageslider, isproductpackage) { 393 var colorid = RBGetValue("#" + colorfield); 394 var sizeid = RBGetValue("#" + sizefield); 395 var propertyParamid = ""; 396 var propertyIds = ""; 397 if (propertyFields != '') { 398 propertyParamid = RBGetValue("#" + propertyParamField); 399 var propertyFields = propertyFields.split(';'); 400 for (var i = 0; i < propertyFields.length; i++) { 401 if (i > 0) 402 propertyIds += ";"; 403 propertyIds += RBGetValue("#" + propertyFields[i]); 404 } 405 } 406 RBMasterDataChangeValue(changeUrl, masterid, masterdiv, masterarticlediv, field, colorfield, colorid, sizefield, sizeid, propertyid, propertyParamid, propertyFields, propertyIds, imageslider, isproductpackage, 1); 407} 408 409function RBMasterDataChangeValue(changeUrl, masterid, masterdiv, masterarticlediv, field, colorfield, colorid, sizefield, sizeid, propertyid, propertyParamid, propertyFields, propertyIds, imageslider, isproductpackage, iscombo) { 410 RBAjax_AjaxLoadingStart(masterdiv, false); 411 $.post(changeUrl, { 412 masterid: masterid, field: field, colorid: colorid, sizeid: sizeid, propertyid: propertyid, propertyParamid: propertyParamid, isproductpackage: isproductpackage, propertyIds: propertyIds 413 }, function (response) { 414 RBAjax_AjaxLoadingEnd(masterdiv, false); 415 if (response) { 416 if (response.error) { 417 RBMessage(response.error, "", "", true); 418 return; 419 } 420 if (iscombo == 1) { 421 $(masterdiv + ' option').removeAttr("disabled"); 422 if (response.disablecolors) { 423 var colors = response.disablecolors.split(';'); 424 for (var i = 0; i < colors.length; i++) { 425 var onecolor = colors[i]; 426 $(masterdiv + ' #' + colorfield + " option[value='" + onecolor + "']").attr("disabled", "disabled"); 427 } 428 } 429 if (response.disablesizes) { 430 var sizes = response.disablesizes.split(';'); 431 for (var i = 0; i < sizes.length; i++) { 432 var onesize = sizes[i]; 433 $(masterdiv + ' #' + sizefield + " option[value='" + onesize + "']").attr("disabled", "disabled"); 434 } 435 } 436 if (field == "size") 437 if (response.onlygoodcolorid > 0) 438 RBSetValue("#" + colorfield, response.onlygoodcolorid); 439 if (field == "color") 440 if (response.onlygoodsizeid > 0) 441 RBSetValue("#" + sizefield, response.onlygoodsizeid); 442 } 443 else { 444 RBRemoveClass(masterdiv + " .masterarticle_selectitem", "masterarticle_selectitem-selected"); 445 RBAddClass(masterdiv + " .masterarticle_select_color .masterarticle_selectitem-" + response.actcolorid, "masterarticle_selectitem-selected"); 446 RBAddClass(masterdiv + " .masterarticle_select_size .masterarticle_selectitem-" + response.actsizeid, "masterarticle_selectitem-selected"); 447 } 448 if (imageslider) 449 FireRefreshEventHandler(imageslider, "Parameters", response.imagesliderparam); 450 if (response.articlename) { 451 $('.' + masterarticlediv + ' .articleitem_name').html(response.articlename); 452 $('.' + masterarticlediv + ' .articleitem_subname').html(response.articlesubname); 453 $('.' + masterarticlediv + ' .articleitem_button').html(response.articlebutton); 454 $('.' + masterarticlediv + ' .articleitem_prices').html(response.articleprices); 455 $('.detail-full .articleheader').html(response.articleheader); 456 } 457 if (response.productname) { 458 $('.' + masterarticlediv + ' .alexwebdatainfogrid_code').html(response.productcode); 459 $('.' + masterarticlediv + ' .alexwebdatainfogrid_name').html(response.productname); 460 $('.' + masterarticlediv + ' .alexwebdatainfogrid_subname').html(response.productsubname); 461 $('.' + masterarticlediv + ' .alexwebdatainfogrid_onlineprice').html(response.productprices); 462 $('.' + masterarticlediv + ' .labelitem_retaileprice').html(response.retaileprice); 463 $('.' + masterarticlediv + ' .labelitem_discontpercent').html(response.discontpercent); 464 $('.' + masterarticlediv + ' .alexwebdatainfogrid_shipping').html(response.productshipping); 465 $('.' + masterarticlediv + ' .fullstockinfo').html(response.fullExpectedDelivery); 466 $('.' + masterarticlediv + ' .alexwebdatainfogrid_enableorder').html(response.productstock); 467 $('.' + masterarticlediv + ' .productvote').html(response.productvote); 468 if (response.productvote) 469 if (response.productvotedivid && response.productsummavote) 470 VoteHoverCssChange("." + response.productvotedivid + " .vote-before", "vote-yes", "vote-no", response.productsummavote); 471 $('.' + masterarticlediv + ' .alexwebdatainfogrid_alexdata_detail_top_alexdata_detail_right_bookshoplink').html(response.productbutton); 472 $('.' + masterarticlediv + ' .alexwebdatainfogrid_alexdata_detail_top_alexdata_detail_top_right_bookshoplink').html(response.productbutton); 473 $('.' + masterarticlediv + ' .alexwebdatainfogrid_thumbnail_url_img').attr('src', response.productimage); 474 if (response.quickeditonclick) { 475 $('.detail-full .rb-quick-edit').attr('onclick', response.quickeditonclick); 476 } 477 } 478 } 479 }).fail(function (response) { 480 RBAjax_AjaxLoadingEnd(masterdiv, false); 481 RBAjaxPostError(); 482 });
483} 484 485function CheckOutFormReset() { 486 // $(".webshopmain_checkout .validation-summary-globalerror").attr("disabled", true); 487 $(".validation-summary-globalerror-item").html(""); 488} 489 490function RBMLMSetPointShopRule(divid, pointshopruleid, ispopup, ischeckout) { 491 var ajaxurl = "/Home/SetPointShopRule"; 492 var $origdiv = $('.' + divid); 493 $origdiv.html(""); 494 var $ajaxloading = $origdiv; 495 CheckOutFormReset(); 496 RBAjax_AjaxLoadingItemStart($ajaxloading, true); 497 $.post(ajaxurl, { 498 pointshopruleid: pointshopruleid 499 }, function (response) { 500 RBAjax_AjaxLoadingItemEnd($ajaxloading, true); 501 if (response) { 502 if (response.error != '') { 503 RBMessage(response.error); 504 return; 505 } 506 if (ispopup == 1) { 507 RBBodyOverlayClick(); 508 RBOnClick(".basket_refresh_button"); 509 } 510 if (ischeckout == 1) { 511 if (response.url) 512 RBLoadPage(response.url); 513 } 514 } 515 }).fail(function (response) { 516 RBAjax_AjaxLoadingItemEnd($ajaxloading, true); 517 RBAjaxPostError(); 518 }); 519} 520 521function RBAlexFavoriteDelete(sliderid, azon, personid, id) { 522 var ajaxurl = "/Home/AlexFavoriteDelete"; 523 var $ajaxloading = $('#' + sliderid);
524 RBAjax_AjaxLoadingItemStart($ajaxloading, false); 525 $.post(ajaxurl, { 526 azon: azon, personid: personid, id: id 527 }, function (response) { 528 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 529 if (response) { 530 if (response.error != '') { 531 RBMessage(response.error); 532 return; 533 } 534 FireRefreshEventHandler(sliderid, "-1", "Reload"); 535 } 536 }).fail(function (response) { 537 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 538 RBAjaxPostError(); 539 }); 540} 541 542function RBAddCouponToBasket(divid, ajaxurl, couponlinkid, isdel, ischeckout, basketcheckoutajaxid, checkouturl, refreshbutton) { 543 RBAddCouponToBasket(divid, ajaxurl, couponlinkid, isdel, ischeckout, basketcheckoutajaxid, checkouturl, refreshbutton, "", ""); 544} 545 546function RBAddCouponToBasket(divid, ajaxurl, couponlinkid, isdel, ischeckout, basketcheckoutajaxid, checkouturl, refreshbutton, code, showsuccessmessage) { 547 var couponcode = code; 548 if (!couponcode) 549 couponcode = RBGetValue("#basketcoupon"); 550 var $ajaxloading = $('.' + divid); 551 CheckOutFormReset();
552 RBAjax_AjaxLoadingItemStart($ajaxloading, false); 553 $.post(ajaxurl, { 554 couponcode: couponcode, couponlinkid: couponlinkid, isdel: isdel, ischeckout: ischeckout, showsuccessmessage: showsuccessmessage 555 }, function (response) { 556 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 557 if (response) { 558 if (response.error != '') { 559 RBMessage(response.error); 560 return; 561 } 562 if (ischeckout == 1) { 563 if (checkouturl) { 564 RBLoadPage(checkouturl); 565 return; 566 } 567 if (response.result3) { 568 $('#' + basketcheckoutajaxid).html(response.result3); 569 } 570 RBSetValue('#CheckoutSumma', response.data); 571 if (response.total) 572 RBSetValue('#Total', response.total); 573 if (response.action) { 574 eval(response.action); 575 } 576 return; 577 } 578 if (refreshbutton) 579 RBOnClick(refreshbutton); 580 if (response.successNessage && (response.successNessage != '')) 581 RBMessage(response.successNessage, "", "", true); 582 } 583 }).fail(function (response) { 584 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 585 RBAjaxPostError(); 586 }); 587} 588 589function RBAddPersonCardToBasket(divid, ajaxurl, checkouturl, personcardcode, basketcheckoutajaxid, pricefieldid) { 590 var maxprice = ""; 591 if (pricefieldid) 592 maxprice = RBGetValue(pricefieldid); 593 var $ajaxloading = $('.' + divid);
594 RBAjax_AjaxLoadingItemStart($ajaxloading, false); 595 $.post(ajaxurl, { 596 couponcode: personcardcode, ischeckout: '1', maxprice: maxprice 597 }, function (response) { 598 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 599 if (response) { 600 if (response.error != '') { 601 RBMessage(response.error); 602 return; 603 } 604 if (checkouturl) { 605 RBLoadPage(checkouturl); 606 return; 607 } 608 if (response.result3) { 609 $('#' + basketcheckoutajaxid).html(response.result3); 610 } 611 RBSetValue('#CheckoutSumma', response.data); 612 if (response.total) 613 RBSetValue('#Total', response.total); 614 if (response.action) { 615 eval(response.action); 616 } 617 return; 618 } 619 }).fail(function (response) { 620 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 621 RBAjaxPostError(); 622 }); 623} 624 625function RBSetPointsToBasket(divid, ajaxurl, basketid, basketcheckoutajaxid, refreshbutton) { 626 var points = RBGetValue("#basketmlmpoint"); 627 CheckOutFormReset(); 628 var $ajaxloading = $('.' + divid);
629 RBAjax_AjaxLoadingItemStart($ajaxloading, false); 630 $.post(ajaxurl, { 631 basketid: basketid, points: points 632 }, function (response) { 633 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 634 if (response) { 635 if (response.error != '') { 636 RBMessage(response.error); 637 return; 638 } 639 if (response.result3) { 640 $('#' + basketcheckoutajaxid).html(response.result3); 641 } 642 RBSetValue('#CheckoutSumma', response.data); 643 if (response.total) 644 RBSetValue('#Total', response.total); 645 return; 646 } 647 }).fail(function (response) { 648 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 649 RBAjaxPostError(); 650 }); 651} 652 653function RBAddSupportToBasket(divid, basketid, isdel, ischeckout, basketcheckoutajaxid, checkouturl, refreshbutton) { 654 var supportcode = RBGetValue("#basketsupport"); 655 var ajaxurl = "/WebDataShopInfoGrid/AddSupportToBasket"; 656 var $ajaxloading = $('#' + divid); 657 CheckOutFormReset();
658 RBAjax_AjaxLoadingItemStart($ajaxloading, false); 659 $.post(ajaxurl, { 660 basketid: basketid, supportcode: supportcode, isdel: isdel, ischeckout: ischeckout 661 }, function (response) { 662 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 663 if (response) { 664 if (response.error != '') { 665 RBMessage(response.error); 666 return; 667 } 668 if (ischeckout == 1) { 669 if (checkouturl) { 670 RBLoadPage(checkouturl); 671 return; 672 } 673 if (response.result3) { 674 $('#' + basketcheckoutajaxid).html(response.result3); 675 } 676 RBSetValue('#CheckoutSumma', response.data); 677 if (response.total) 678 RBSetValue('#Total', response.total); 679 return; 680 } 681 if (refreshbutton) 682 RBOnClick(refreshbutton); 683 } 684 }).fail(function (response) { 685 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 686 RBAjaxPostError(); 687 }); 688} 689 690function RBSetDiscountPercent(divid, basketid, basketcheckoutajaxid, checkouturl) { 691 var discountpercent = RBGetValue("#basketdiscountpercent"); 692 var ajaxurl = "/WebDataShopInfoGrid/SetDiscountPercent"; 693 var $ajaxloading = $('#' + divid); 694 CheckOutFormReset();
695 RBAjax_AjaxLoadingItemStart($ajaxloading, false); 696 $.post(ajaxurl, { 697 basketid: basketid, discountpercent: discountpercent 698 }, function (response) { 699 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 700 if (response) { 701 if (response.error != '') { 702 RBMessage(response.error); 703 return; 704 } 705 if (checkouturl) { 706 RBLoadPage(checkouturl); 707 return; 708 } 709 if (response.result3) { 710 $('#' + basketcheckoutajaxid).html(response.result3); 711 } 712 RBSetValue('#CheckoutSumma', response.data); 713 if (response.total) 714 RBSetValue('#Total', response.total); 715 } 716 }).fail(function (response) { 717 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 718 RBAjaxPostError(); 719 }); 720} 721 722function RBBasketFunc(url, confirm, divid, basketid, itemid, funckod, funcparam) { 723 if (confirm) 724 if (!RBConfirm(confirm)) 725 return; 726 var $ajaxloading = $(divid);
727 RBAjax_AjaxLoadingItemStart($ajaxloading, false); 728 $.post(url, { 729 basketid: basketid, itemid: itemid, funckod: funckod, funcparam: funcparam 730 }, function (response) { 731 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 732 if (response) { 733 if (response.error != '') { 734 RBMessage(response.error); 735 return; 736 } 737 RBOnClick(".basket_refresh_button"); 738 } 739 }).fail(function (response) { 740 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 741 RBAjaxPostError(); 742 }); 743} 744 745function RBBasketAddDelQuantity(url, divid, quantityinput, quantityfield, isadd, pricefield, summafield, productcode) { 746 var quantity = parseInt(RBGetValue("#" + quantityinput)); 747 if (isadd == 1) { 748 quantity = quantity + 1; 749 } 750 else { 751 if (quantity > 1) 752 quantity = quantity - 1; 753 } 754 if (quantity == 0) 755 return; 756 var $ajaxloading = $(divid); 757 RBAjax_AjaxLoadingItemStart($ajaxloading, false); 758 $.post(url, { 759 productcode: productcode, quantity: quantity 760 }, function (response) { 761 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 762 if (response) { 763 if (response.error != '') { 764 RBMessage(response.error); 765 return; 766 } 767 RBSetValue("#" + quantityinput, response.quantity); 768 $("." + quantityfield).html(response.quantity); 769 $("." + pricefield).html(response.price); 770 $("." + summafield).html(response.summa); 771 } 772 }).fail(function (response) { 773 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 774 RBAjaxPostError(); 775 }); 776} 777 778function RBCreateProductBasketField(divid, url, productcodeid) { 779 var productcode = RBGetValue("#" + productcodeid); 780 RBCreateProductBasket(divid, url, productcode); 781} 782 783function RBCreateProductBasket(divid, url, productcode) { 784 var $ajaxloading = $(divid);
785 RBAjax_AjaxLoadingItemStart($ajaxloading, false); 786 $.post(url, { 787 productcode: productcode 788 }, function (response) { 789 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 790 if (response) { 791 if (response.error != '') { 792 RBMessage(response.error); 793 return; 794 } 795 if (response.url != '') { 796 RBLoadPage(response.url); 797 return; 798 } 799 } 800 }).fail(function (response) { 801 RBAjax_AjaxLoadingItemEnd($ajaxloading, false); 802 RBAjaxPostError(); 803 }); 804}
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.