Her finner du deler vi har til Weasel
FUEL PUMP
kr 2248,00
GASKET SET, MANIFOLD, WEASEL
kr 159,00
GASKET SET, VALVE GRIND, WEASEL
kr 906,00
'); availableDimProducts.forEach(function (dimProduct) { var dimName = dimProduct.dimensions[0].STPD_SysName; var dimProdLink = dimProduct.dimensionLinks[0]; if (dimName && dimProdLink) { $($dimensionsStockContent[1]).append('' + dimName + ''); } }); } 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); } } } var $searchBtn = $('.js-product-list-search').find('.js-product-list-search-btn'); $searchBtn.unbind().on('click', function (e) { e.preventDefault(); var term = $.trim($searchInput.val()); if (term) { search(term); } }); $searchInput.autocomplete({ minLength: 3, source: function () { $searchBtn.trigger('click'); } }).one('keypress', function (e) { var term = $.trim($searchInput.val()); if (e.keyCode == 13) { e.preventDefault(); search(term); } }); $searchInput.keyup(function () { if (!this.value) { $productListContainer.html($(document.createElement('h3')).text(labels.enterSearchQuery).addClass(currentControlState.controlId.toString().toLowerCase() + ' __no-products-msg')); $pagingControls.find('.ProductListPager').remove(); } else if (this.value.length < 3) { $productListContainer.html($(document.createElement('h3')).text(labels.noProductsFound).addClass(currentControlState.controlId.toString().toLowerCase() + ' __no-products-msg')); $pagingControls.find('.ProductListPager').remove(); } }); }; function search(term) { if ($timer) { window.clearTimeout($timer); $timer = null; } $timer = window.setTimeout(function() { searchTerm = term; refreshProductList(false, true, false, true); }, 500); } function onQuickViewButtonClick(evt) { evt.preventDefault(); var $prodContainer = $(this).closest('.' + classes.prodItem); var productId = $prodContainer.data('productid'); var query = { action: 'GetQuickView', controlId: currentControlState.controlId, pageId: root.BasePageID, productId: productId }; blockUI(); $.get(productsHandlerUrl, query) .always(unblockUI) .done(function(quickViewData) { var quickViewHtml = quickViewData.html; var quickViewModel = quickViewData.model; if (quickViewHtml) { showQuickViewPopup(quickViewHtml, quickViewModel); } else { reportQuickViewFail(); } }) .fail(reportQuickViewFail); function reportQuickViewFail() { notify(labels.failedToLoadQuickView, 'error'); } function showQuickViewPopup(quickViewHtml, quickViewModel) { $.fancybox.open({ src: quickViewHtml, type: 'html', opts: { parentEl: "form:first", afterLoad: function(instance, current) { if (typeof root.productViewController !== 'function') console.error('Product view main asset is not loaded'); var quickViewController = root.productViewController(current.$content, quickViewModel); quickViewController.init(); if (typeof root.customFieldsController === 'function') { var customFieldsController = root.customFieldsController(); customFieldsController.init(); } } } }); } } function refresh(callback, needPublish, dontBlockUi) { if (!dontBlockUi) 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), filteredCategoryIDs: JSON.stringify(currentControlState.filteredCategoryIDs), s: searchTerm, isProductPage: currentControlState.isProductPage, showOnlyInStock: currentControlState.showOnlyInStock }; $.post(productsHandlerUrl, query) .done(function (productListData) { //note: total items count may change when 'show only in stock' is changed currentControlState.totalItems = productListData.totalItemsCount; if (productListData.totalItemsCount > 0) { $productListContainer.html(productListData.productListHtml); } else { $productListContainer.html($(document.createElement('h3')).text(labels.noProductsFound).addClass(currentControlState.controlId.toString().toLowerCase() + ' __no-products-msg')); } $('.js-search-statistics').text(productListData.totalStatistics); initProductControls(); if(callback && typeof (callback) === 'function') { callback.apply(this); } reportImpressions(); if (needPublish) { pubSub.publish(refreshChannelPrefix, { showOnlyInStock: currentControlState.showOnlyInStock }); } }) .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; var showViewAll = currentControlState.showViewAll; // 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 }); if (showViewAll) { var $viewAllItem = $('
'); $viewAllItem.click(viewAllClicked); $listPager.append($viewAllItem); } } } function pagingChangedCallback(event, page) { if (currentControlState.showViewAll) { //note: re-adding ViewAll item because it is removed by pagination plugin on page change var $viewAllItem = $('
'); $viewAllItem.click(viewAllClicked); $pagingControls.find('.ProductListPager').append($viewAllItem); } currentControlState.page = page; refreshProductList(true, false, true, false, true); } function viewAllClicked() { currentControlState.perPage = -1; // Reset current page index currentControlState.page = 1; refreshProductList(true, true, true); } } function onUpdateHistory() { // Update history if (root.history) { var newStateUrl = location.href.split('#')[0]; var state = currentControlState; if (enableHistoryState) { 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); newStateUrl = state.showOnlyInStock ? $.setQueryStringParam(newStateUrl, 'instockonly_' + state.controlId, 'true') : $.removeQueryStringParam(newStateUrl, 'instockonly_' + state.controlId); if (state.filtersUrl) newStateUrl += '#' + state.filtersUrl; if (newStateUrl !== location.href && typeof (root.history.pushState) !== 'undefined') root.history.pushState(state, '', newStateUrl); } else if (state.filtersUrl) { newStateUrl += '#' + state.filtersUrl; if (newStateUrl !== location.href && typeof (root.history.replaceState) !== 'undefined') root.history.replaceState(state, '', 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, dontBlockUi, scrollToTop) { refresh(function() { $viewSettings.show(); if (updatePagers) { setupPaging(); } if(updateHistory) { onUpdateHistory(); } if (scrollToTop) { tryScrollToTop(); } }, needPublish, dontBlockUi); } function tryScrollToTop() { if ($productContainers && $productContainers.length) { try { var firstProd = $productContainers[0]; var rect = firstProd.getBoundingClientRect(); if (rect.top < 0) { $('body').scrollToThis(500); } } catch (e) { console.error(e); } } } function reportImpressions() { $mainPanel.find('.js-fragment-container').each(function() { var $fragment = $(this); try { var listName = getFragmentTitle($fragment); var productImpressions = []; $fragment.find('.' + classes.prodItem).each(function () { var $prod = $(this); var productId = parseInt($prod.data('productid')); if (productId > 0) { productImpressions.push({ productId: productId, $links: $prod.find('.js-product-link') }); } }); if (productImpressions.length > 0) { root.reportProductListView(listName, productImpressions); } } catch (e) { console.error('Failed to report fragment\'s products impressions. ' + e); } }); function getFragmentTitle($fragment) { var title = $fragment.data('listname') || $mainPanel.find('.MainTitle').text() || document.title; return $.trim(title); } } //#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('.js-uc193-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(); reportImpressions(); var initialTerm = $.trim($searchInput.val()); if (initialTerm && initialTerm.length >= 3) { search(initialTerm); } // Subscribe to removeFromCart event and hide shopCart icon root.PublicEStore.subscribe('estore.callback.shopcart.removefromcart', removeFromCartCallback); root.PublicEStore.subscribe('estore.callback.shopcart.emptycart', emptyCartCallback); root.PublicEStore.subscribe('estore.callback.shopcart.addtocart', addToCartGlobalCallback); setupViewSettings(); if ($mainPanel.find('.js-fragment-container.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, data) { currentControlState.page = 1; currentControlState.filteredCategoryIDs = data.selectedIds; refreshProductList(false, true, false); }); pubSub.subscribe(staticfilterChannelPrefix + '.reset', function () { currentControlState.page = 1; currentControlState.filteredCategoryIDs = null; refreshProductList(false, true, false); }); if (enableHistoryState) { // Set initial state root.history.replaceState(currentControlState, '', null); // Subscribe to popstate event $(root).on('popstate', onHistoryPopState); } pubSub.publish(readyChannelPrefix); function filterCallback(topic, filterState) { if (filterState.isPreApplied === true) { if (isPreAppliedFilterProcessed) { return; } isPreAppliedFilterProcessed = true; } 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.filtersUrl = filterState.filtersUrl; currentControlState.appliedFilters = filterState.appliedFilters; refreshProductList(filterState.isHistoryPopEvent !== 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(' .js-add-to-cart').hide(); } }); } function emptyCartCallback(topic, dataContract) { if (dataContract.status.toLowerCase() === 'ok') { $productListContainer.find('.js-add-to-cart').hide(); } } function addToCartGlobalCallback(topic, contract) { _.each(contract.result.items, function (prod) { if (prod.status.toLowerCase() === 'ok') { // Update total product's count for the current temp order line var prodContainer = $productContainers.filter('[data-productId="' + prod.productID + '"]'); var orderLineQuantityContainer = prodContainer.find('.js-prod-count'); orderLineQuantityContainer.show(); orderLineQuantityContainer.text(prod.totalQuantityInTempOrderLine); // Animate action var addToCartIconContainer = prodContainer.find('.js-add-to-cart'); if (addToCartIconContainer.length > 0) { addToCartIconContainer.show(); prodContainer.effect('transfer', { to: addToCartIconContainer }, 500, function () { addToCartIconContainer.effect('bounce', null, 500); }); } } }); } 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); }); //Setup show only in stock change if ($cbxShowOnlyInStock.length) { $cbxShowOnlyInStock.prop('checked', currentControlState.showOnlyInStock === true); $cbxShowOnlyInStock.change(function () { currentControlState.page = 1; currentControlState.showOnlyInStock = $cbxShowOnlyInStock.prop('checked'); refreshProductList(true, true, true); }); } } function onHistoryPopState(evt) { var state = evt.originalEvent.state; if (state && state.controlId === currentControlState.controlId) { // Restore target state currentControlState = state; if ($cbxShowOnlyInStock.length) { $cbxShowOnlyInStock.prop('checked', currentControlState.showOnlyInStock === true); } refreshProductList(false, true, true); } } });})(jQuery, _, window);