Sky naturhvit

Sky naturhvit
Varenr.
DL301
Lager
På lager
Pris
kr 69,00

Kvantumsrabatt

Loading...

0) { addToCartIconContainer.show(); prodContainer.effect('transfer', { to: addToCartIconContainer }, 500, function () { addToCartIconContainer.effect('bounce', null, 500); }); } } else { notify(prod.message, 'error'); } }); } } function onWishListButtonClick(evt) { evt.preventDefault(); var $wishListControl = $(this); var isAddToWishListAction = $wishListControl.hasClass('Add'); var productId = $wishListControl.closest('.' + classes.prodItem).data('productid'); if (isAddToWishListAction) { $.when(root.PublicEStore.addToWishList(productId)).then(wishListCallback, errorCallback); } else { $.when(root.PublicEStore.removeFromWishList(productId)).then(wishListCallback, errorCallback); } function wishListCallback(dataContract) { if (dataContract.status.toLowerCase() === 'ok') { _.each(dataContract.result.items, function (prod) { if (prod.status.toLowerCase() === 'ok') { notify(labels.wishListUpdated, 'success'); $wishListControl.toggleClass('Add', !isAddToWishListAction); $wishListControl.toggleClass('Remove', isAddToWishListAction); } else { notify(prod.message, 'error'); } }); } else { notify(dataContract.message, dataContract.status); } } } function onShoppingListButtonClick(evt) { evt.preventDefault(); var $shoppinListButton = $(this); var $prodContainer = $shoppinListButton.closest('.' + classes.prodItem); var productToAdd = getAddToCartContract($prodContainer); root.showAddToCollectionPopup([productToAdd]); } function setupDimensionsInStockOverlay() { var $singleDimensionProducts = $productListContainer.find('.SingleDimensionProduct'); var singleDimensionItemIds = $singleDimensionProducts.map(function () { return $(this).data('itemid'); }).get(); $.post(productsHandlerUrl, { action: 'GetAvailableDimensionProducts', itemIds: JSON.stringify(singleDimensionItemIds) }) .done(function (availableDimProductsMap) { _.each(availableDimProductsMap, function (availableDimProducts, currentItemId) { var $currentProductContainer = $singleDimensionProducts.filter('[data-itemid="' + currentItemId + '"]'); var $currentDimensionsInStockContainer = $currentProductContainer.find('.DimensionsInStockContainer'); var $dimensionsStockContent; if (availableDimProducts && availableDimProducts.length > 0) { // Create content var dimensionsInStockText = _.map(availableDimProducts, function (dimProduct) { return dimProduct.dimensions[0].STPD_SysName; }).join(', '); $dimensionsStockContent = $('

' + labels.dimensionsInStock + '
' + dimensionsInStockText + ''); } else { $dimensionsStockContent = $('
' + labels.dimensionsOutOfStock + '
'); } // Place it in own container if ($currentDimensionsInStockContainer.length === 1) { $currentDimensionsInStockContainer.prepend($dimensionsStockContent).addClass('show'); } }); }) .fail(function () { console.error('Failed to load available dimensions'); }); } function setupDimensionChoices() { var $prodContainer; var $mainImage; var mainImageURL; var dimImageUrl; $('.' + classes.dimItem).hover( function () { $prodContainer = $(this).closest('.' + classes.prodItem); $mainImage = $prodContainer.find('.' + classes.mainImage); mainImageURL = $prodContainer.find('.' + classes.mainImage).attr('src'); dimImageUrl = $(this).data('main-img-src'); if ($mainImage.length && dimImageUrl) { $mainImage.attr('src', dimImageUrl); } }, function () { $mainImage.attr('src', mainImageURL); } ); } function onQuantityChanged() { if (vars.multPriceByQuantity) { var $prodContainer = $(this).closest('.' + classes.prodItem); var productId = $prodContainer.data('productid'); var quantity = getSelectedProductQuantity($prodContainer); var cacheKey = 'quantityPrices_' + productId + '_' + quantity; if (cacheKey in dataCache) { var productListItem = dataCache[cacheKey]; updateDisplayedPrices($prodContainer, productListItem); } else { blockUI(); var query = { action: 'GetProductQuantityPrice', controlId: currentControlState.controlId, pageId: root.BasePageID, productId: productId, quantity: quantity }; $.get(productsHandlerUrl, query) .done(function (productListItem) { dataCache[cacheKey] = productListItem; updateDisplayedPrices($prodContainer, productListItem); }) .fail(function (errResp) { var message; if (typeof (errResp) === 'object') { // Extract error message var responseObj = JSON.parse(errResp.responseText); message = responseObj.Message ? responseObj.Message : errResp.statusText; } else { message = errResp; } notify(labels.failedToLoadProductList + '
' + message, 'error'); }) .always(unblockUI); } } function updateDisplayedPrices($prodContainer, productListItem) { if (productListItem.DiscountPrice) { $prodContainer.find('.DiscountPriceRow .DiscountPrice.Value').text(productListItem.DiscountPriceString); } if (productListItem.Price) { if (productListItem.OriginalPrice) { $prodContainer.find('.PriceRow .OriginalPrice.Value').text(productListItem.OriginalPriceString); } $prodContainer.find('.PriceRow .Price').not('.WithVAT,.WithoutVAT').text(productListItem.PriceString); } if (productListItem.PriceWithoutVAT) { if (productListItem.OriginalPrice) { $prodContainer.find('.PriceRow .OriginalPrice.Value').text(productListItem.OriginalPriceString); } $prodContainer.find('.PriceRow .Price.WithoutVAT').text(productListItem.PriceWithoutVATString); } if (productListItem.PriceWithVAT) { if (productListItem.OriginalPrice) { $prodContainer.find('.PriceRow .OriginalPrice.Value').text(productListItem.OriginalPriceString); } $prodContainer.find('.PriceRow .Price.WithVAT').text(productListItem.PriceWithVATString); } if (productListItem.Price2) { $prodContainer.find('.Price2Row .Price2.Value').text(productListItem.Price2String); } if (productListItem.Price3) { $prodContainer.find('.Price3Row .Price3.Value').text(productListItem.Price3String); } } } }; function refresh(callback, needPublish) { blockUI(); var query = { action: 'GetProductList', pageId: root.BasePageID, itemId: root.BaseItemID, orderId: orderId, controlId: currentControlState.controlId, perPage: currentControlState.perPage, page: currentControlState.page, sort: currentControlState.sort, filteredItemIds: JSON.stringify(currentControlState.filteredItemIds), s: searchTerm, isProductPage: currentControlState.isProductPage }; $.post(productsHandlerUrl, query) .done(function(productListHtml) { $productListContainer.html(productListHtml); initProductControls(); if(callback && typeof (callback) === 'function') { callback.apply(this); } if (needPublish) { pubSub.publish(refreshChannelPrefix, null); } }) .fail(function(errResp) { var message; if (typeof (errResp) === 'object') { // Extract error message var responseObj = JSON.parse(errResp.responseText); message = responseObj.Message ? responseObj.Message : errResp.statusText; } else { message = errResp; } notify(labels.failedToLoadProductList + '
' + message, 'error'); }) .always(unblockUI); } function setupPaging() { if($pagingControls.length > 0) { var perPage = currentControlState.perPage; var totalItems = currentControlState.totalItems; // This will re-init paging controls $pagingControls.find('.ProductListPager').remove(); $pagingControls.html('
    '); if (perPage > 0 && totalItems > perPage) { var $listPager = $pagingControls.find('.ProductListPager'); $listPager.twbsPagination({ totalPages: Math.ceil(totalItems / perPage), visiblePages: shownPages, startPage: currentControlState.page, first: labels.first, next: labels.next, prev: labels.prev, last: labels.last, onPageClick: pagingChangedCallback }); var $viewAllItem = $('
  • ' + labels.viewAll + '
  • '); $viewAllItem.click(viewAllClicked); $listPager.append($viewAllItem); } } function pagingChangedCallback(event, page) { //note: re-adding ViewAll item because it is removed by pagination plugin on page change var $viewAllItem = $('
  • ' + labels.viewAll + '
  • '); $viewAllItem.click(viewAllClicked); $pagingControls.find('.ProductListPager').append($viewAllItem); currentControlState.page = page; refreshProductList(true, false, true); } function viewAllClicked() { currentControlState.perPage = -1; // Reset current page index currentControlState.page = 1; refreshProductList(true, true, true); } } function onUpdateHistory() { // Update history if(enableHistoryState && root.history && typeof (root.history.pushState) !== 'undefined') { var newStateUrl = location.href.split('#')[0]; var state = currentControlState; if(state.sort) { newStateUrl = $.setQueryStringParam(newStateUrl, 'sort_' + state.controlId, state.sort); } if (state.page) { newStateUrl = $.setQueryStringParam(newStateUrl, 'page_' + state.controlId, state.page); } if(state.perPage) { newStateUrl = $.setQueryStringParam(newStateUrl, 'perpage_' + state.controlId, state.perPage); } if(!_.isEmpty(state.appliedFilters)) { newStateUrl += '#' + JSON.stringify(state.appliedFilters); } if (newStateUrl != location.href) { root.history.pushState(currentControlState, '', newStateUrl); } } } function errorCallback(dataContract) { if (dataContract.status.toLowerCase() === 'unauthorized') { pubSub.publish('notification.warning', { text: labels.availableToRegisteredOnly + '
    ' + labels.loginToContinue + '', layout: 'center', killer: true, modal: true, timeout: false }); } else if(dataContract.result){ _.each(dataContract.result.items, function (prod) { notify(prod.message, 'error'); }); } } function refreshProductList(updateHistory, updatePagers, needPublish) { refresh(function() { $viewSettings.show(); if (updatePagers) { setupPaging(); } if(updateHistory) { onUpdateHistory(); } }, needPublish); } //#region Helpers function getSelectedProductQuantity($prodContainer) { return $prodContainer.find('.QuantityTxb,.QuantityDrp').val(); } function getAddToCartContract($prodContainer) { var customFields = {}; $prodContainer.find('.customFieldsCont .customField').each(function(idx, elem) { var $elem = $(elem); var customFieldId = $elem.attr('customFieldId'); //Special handling for checkbox because they are wrapped in a span if($elem.find('input').length > 0) { $elem = $elem.find('input'); } if(customFieldId) { var cfValue = $elem.is(':checkbox') ? $elem.is(':checked').toString() : $elem.val(); customFields[customFieldId] = cfValue; } }); return { productId: $prodContainer.data('productid'), imageId: $prodContainer.data('imageid'), quantity: getSelectedProductQuantity($prodContainer), fraction: $prodContainer.find('.Fraction').val(), customFields: customFields, }; } function notify(message, type) { var notificationChannel = typeof (type) === 'string' && type ? 'notification.' + type : 'notification'; pubSub.publish(notificationChannel, message); } function blockUI() { if (typeof ($.blockUI) === 'function') { $.blockUI({ message: null }); } } function unblockUI() { if (typeof ($.unblockUI) === 'function') { $.unblockUI(); } } //#endregion $(function() { initProductControls(); // Subscribe to removeFromCart event and hide shopCart icon root.PublicEStore.subscribe('estore.callback.shopcart.removefromcart', removeFromCartCallback); root.PublicEStore.subscribe('estore.callback.shopcart.emptycart', emptyCartCallback); setupViewSettings(); if ($mainPanel.find('.FragmentContainer.Campaign').length > 0) { // Hide paging and sorting for campaigns. Campaigns should be valid for the initial load only. $viewSettings.hide(); } else { $viewSettings.show(); setupPaging(); } // Filters pubSub.subscribe(filtersChannelPrefix + '.apply', filterCallback); pubSub.subscribe(staticfilterChannelPrefix + '.apply', function (topic, itemsCount) { currentControlState.page = 1; currentControlState.totalItems = itemsCount; refreshProductList(false, true, false); }); if (enableHistoryState) { // Set initial state root.history.replaceState(currentControlState, '', null); // Subscribe to popstate event $(root).on('popstate', onHistoryPopState); } function filterCallback(topic, filterState) { var totalItemsAfterFiltersApplied = typeof(filterState.filteredItemIds) !== 'undefined' && filterState.filteredItemIds !== null ? filterState.filteredItemIds.length : totalItemsInDataSource; // reset paging if (!filterState.isRestoring) { currentControlState.page = 1; } currentControlState.totalItems = totalItemsAfterFiltersApplied; // apply filters currentControlState.filteredItemIds = filterState.filteredItemIds; currentControlState.appliedFilters = filterState.appliedFilters; refreshProductList(true, true, true); } function removeFromCartCallback(topic, dataContract) { _.each(dataContract.result.items, function (prod) { if (prod.status.toLowerCase() === 'ok') { $productContainers.filter('[data-productid="' + prod.productID + '"]').find(' .AddToCartContainer').hide(); } }); } function emptyCartCallback(topic, dataContract) { if (dataContract.status.toLowerCase() === 'ok') { $productListContainer.find('.AddToCartContainer').hide(); } } function setupViewSettings() { // Setup sorting if ($sortingControls.length > 0) { currentControlState.sort = $sortingControls.val(); $sortingControls.change(function () { sortingChangedCallback(this.value); }); } function sortingChangedCallback(sortBy) { currentControlState.sort = sortBy; refreshProductList(true, false, true); } // Setup items per page changes $perPageItems.change(function (evt) { currentControlState.perPage = parseInt(evt.target.value); // Reset current page index currentControlState.page = 1; refreshProductList(true, true, true); }); } function onHistoryPopState(evt) { var state = evt.originalEvent.state; if (state && state.controlId == currentControlState.controlId) { // Restore target state currentControlState = state; refreshProductList(false, true, true); } } }); })(jQuery, _, window);
    • FAST FRAKT
    • RASK LEVERING
    • HØYKVALITETS PRODUKTER