';strHtml += 'Quantity Available:';strHtml += '';jQuery(strHtml).prependTo(this.container.find(".quantity_field_container"));};//update quantity available informationAddToCartView.prototype.updateQuantityAvailableInformation = function(display, hasQuantityAvailable, quantityAvailable){var $quantityAvailableInfo = jQuery(this.container).find("#quantity_available_info");if (hasQuantityAvailable){$quantityAvailableInfo.addClass("available_quantity");$quantityAvailableInfo.removeClass("no_available_quantity");}else{$quantityAvailableInfo.removeClass("available_quantity");$quantityAvailableInfo.addClass("no_available_quantity");}if (display){$quantityAvailableInfo.show();}else{$quantityAvailableInfo.hide();}$quantityAvailableInfo.find("#quantity_available_number").html(quantityAvailable);};AddToCartView.prototype.resetForm = function(){jQuery(this.container).find('form[name="add_to_cart_form"]')[0].reset();}AddToCartView.prototype.clearAllSelectAttributes = function(){jQuery(this.container).find('[name="ProductAttributeOptionIDs"]').val("");jQuery(this.container).find('[name="ProductAttributeOptionIDs"]').trigger("change");}AddToCartView.prototype.createClearAllAttributesButton = function(){var strHtml = 'Clear All';$clearAllAttributesButton = jQuery(strHtml);this.container.find(".add_to_cart_form_content").append($clearAllAttributesButton);return $clearAllAttributesButton;}//create attribute selection for custom optionsAddToCartView.prototype.createAttributeSelection = function(productAttribute, onChange, openAttributeOptionSelectionWindow, showOptionPreview){var isInProductAttributeGrid = productAttribute.ISINPRODUCTATTRIBUTEGRID;var selectedOption = productAttribute.SELECTEDVALUE;strHtml = '
';jQuery(strHtml).appendTo(this.container.find(".add_to_cart_form_content"));jQuery(this.container).find("#ProductAttributeOptionID_" + productAttribute.PRODUCTATTRIBUTEID).on("keyup change paste", function(){onChange( productAttribute.PRODUCTATTRIBUTEID, jQuery(this).val() );});jQuery(this.container).find("[data-productattributeid='" + productAttribute.PRODUCTATTRIBUTEID + "'] input[type='radio'].attributeoption").on("keyup click paste", function(e){onChange( productAttribute.PRODUCTATTRIBUTEID, jQuery(this).val() );});jQuery(this.container).find(".open-attribute-selection-window[data-attributeid='" + productAttribute.PRODUCTATTRIBUTEID + "']").on("click", function(){openAttributeOptionSelectionWindow( productAttribute.PRODUCTATTRIBUTEID, jQuery(this).val() );});if (!productAttribute.SHOWTHUMBNAILS && productAttribute.HASIMAGES){jQuery(this.container).find("#ProductAttributeOptionID_" + productAttribute.PRODUCTATTRIBUTEID).on("change", function(){showOptionPreview( productAttribute.PRODUCTATTRIBUTEID, jQuery(this).val() );});}if (productAttribute.SHOWTHUMBNAILS){var v = this;jQuery(this.container).find(".viewMoreAttributeOptions[data-attributeid='" + productAttribute.PRODUCTATTRIBUTEID +"']").click(function(){v.viewMoreAttributeOptions(productAttribute, onChange);return false;});jQuery(this.container).find(".hideMoreAttributeOptions[data-attributeid='" + productAttribute.PRODUCTATTRIBUTEID +"']").click(function(){v.hideMoreAttributeOptions(productAttribute);return false;});this.addAttributeOptionTooltips(productAttribute.PRODUCTATTRIBUTEID, false);if (selectedOption != ''){var strSelector = "[data-productattributeid='" + productAttribute.PRODUCTATTRIBUTEID + "'] input[type='radio'][value='" + selectedOption + "'].attributeoption";if (jQuery(this.container).find(strSelector).length > 0){if( this.customAttributeCount >= 1 ){jQuery(this.container).find(strSelector).attr("checked", "checked").trigger("click");}}else{strHtml = '';//if not loaded yet, use a hidden input field to store value selectedjQuery(this.container).find(".add_to_cart_form").append(strHtml);$hiddenSelectedValue = jQuery(this.container).find('[name="ProductAttributeOptionIDs_' + productAttribute.PRODUCTATTRIBUTEID + '"].hiddenSelectedValue');if( this.customAttributeCount >= 1 ){$hiddenSelectedValue.change( function(){onChange(productAttribute.PRODUCTATTRIBUTEID, selectedOption);});$hiddenSelectedValue.trigger("change");}}}}}//product attribute gridAddToCartView.prototype.createAttributeGrid = function(useAttributeGrid, quantityFieldLabel, attribute1, attribute2, onChangeUseAttributeGrid, onChangeAttributeGridQuantities, priceAdjustments){var is2D = typeof attribute2 != "undefined";var strHtml = '
';strHtml += '
';strHtml += '';strHtml += '';strHtml += '
';strHtml += '
';jQuery(strHtml).appendTo(this.container.find(".add_to_cart_form_content"));jQuery("#UseAttributeGridField").change(function(){onChangeUseAttributeGrid(jQuery(this).attr("checked") == "checked");});var v = this;jQuery(".quantity-grid-quantity-field").on("change keyup paste", function(){onChangeAttributeGridQuantities(v.getAttributeGridQuantities());});}AddToCartView.prototype.getAttributeGridQuantities = function(){var attributeGridQuantities = [];jQuery(".quantity-grid-quantity-field").each(function(){attributeGridQuantities.push({optionX: jQuery(this).closest(".attribute-grid-quantity-container").data("optionxid"),optionY: jQuery(this).closest(".attribute-grid-quantity-container").data("optionyid"),quantity: jQuery(this).val()});});return attributeGridQuantities;}AddToCartView.prototype.showAttributeGrid = function(onLoad){jQuery(this.container).find(".quantity_field_container").hide();var add_to_cart_form = jQuery(".add_to_cart_form_container").appendTo(".attribute-grid-add-to-cart-container");//hide all the attribute grid attributesjQuery(".product-attribute.attribute-grid-product-attribute").hide();jQuery(".attribute-grid-add-to-cart-container").show();jQuery(".attribute-grid-container").show();if (!onLoad){jQuery('html, body').animate({ scrollTop: jQuery(".attribute-grid-add-to-cart-container").offset().top }, 300);}}AddToCartView.prototype.hideAttributeGrid = function(){jQuery(this.container).find(".quantity_field_container").show();var add_to_cart_form = jQuery(".add_to_cart_form_container").appendTo(".add-to-cart-region");//show all the attribute grid attributesjQuery(".product-attribute.attribute-grid-product-attribute").show();jQuery(".attribute-grid-add-to-cart-container").hide();jQuery(".attribute-grid-container").hide();}AddToCartView.prototype.renderImageOptionHtml = function(option){var width = 30;if (option.IMAGE.length){return '';}else{return '';}};AddToCartView.prototype.markAttributeGridCombinationAsNA = function(optionx, optiony){var strSel = ".attribute-grid-quantity-container[data-optionxid='" + optionx + "']";if (typeof optiony != "undefined"){strSel += "[data-optionyid='" + optiony + "']";}var container = jQuery(this.container).find(strSel);container.find(".not-available-combination").show();container.find(".quantity-grid-quantity-field").hide();container.find(".attribute-grid-price-adjustment").hide();}//set the quantity field in attribute grid.AddToCartView.prototype.updateAttributeGridQuantityField = function(optionX, optionY , value){var strSel = '#Quantity_' + optionX;if (typeof optionY != "undefined"){strSel += '_' + optionY;}var container = jQuery(this.container).find(strSel).val(value);}//show error for attribute grid quantityAddToCartView.prototype.showErrorForQuantityGridField = function(optionX, optionY){var strSel = '#Quantity_' + optionX;if (typeof optionY != "undefined"){strSel += '_' + optionY;}jQuery(this.container).find(strSel).addClass("erroneous-quantity");}//hide error for attribute grid quantityAddToCartView.prototype.hideErrorForQuantityGridField = function(optionX, optionY){var strSel = '#Quantity_' + optionX;if (typeof optionY != "undefined"){strSel += '_' + optionY;}jQuery(this.container).find(strSel).removeClass("erroneous-quantity");}AddToCartView.prototype.updateAttributeGridCombination = function(optionx, optiony , priceAdjustment, priceAdjustmentPoints){var strSel = ".attribute-grid-quantity-container[data-optionxid='" + optionx + "']";if (typeof optiony != "undefined"){strSel += "[data-optionyid='" + optiony + "']";}var container = jQuery(this.container).find(strSel);container.find(".not-available-combination").hide();container.find(".quantity-grid-quantity-field").show();var strHtml = priceAdjustment;if (priceAdjustmentPoints != ''){strHtml += (priceAdjustment != '' ? "
" : "") + priceAdjustmentPoints;}container.find(".attribute-grid-price-adjustment").html(strHtml);container.find(".attribute-grid-price-adjustment").show();}AddToCartView.prototype.renderQuantityField = function(optionX, optionY, priceAdjustment){var strFieldName = 'Quantity_' + optionX.PRODUCTATTRIBUTEOPTIONID;if (typeof optionY != "undefined"){strFieldName += '_' + optionY.PRODUCTATTRIBUTEOPTIONID;}var strHtml = '
';strHtml += '
';strHtml += '
';strHtml += '
';strHtml += '';strHtml += '
';strHtml += '
';strHtml += '
';strHtml += '';strHtml += '
' + priceAdjustment + '
';strHtml += '
';strHtml += '
';strHtml += '
';strHtml += '
';return strHtml;};//if selecting from the opener window an attribute( like ACHS )AddToCartView.prototype.setAttributeOption = function(intProductAttributeID, intProductAttributeOptionID){jQuery(this.container).find("#ProductAttributeOptionID_"+intProductAttributeID).val(intProductAttributeOptionID).change();};//change the preview image based on the option selected(when not using swatches)AddToCartView.prototype.showOptionPreview = function(intProductAttributeID, strImage){if (strImage != ''){jQuery(this.container).find("#option_preview_"+intProductAttributeID).attr("src", strImage).show();}else{jQuery(this.container).find("#option_preview_"+intProductAttributeID).hide();}}AddToCartView.prototype.resetGridAttribute = function(intProductAttributeID){_$attributeControlContainer = jQuery(this.container).find(".attributeSelectionWithImages[data-productattributeid='" + intProductAttributeID + "' ]" );_$attributeControlContainer.find("li[data-optionid]").removeClass( 'not-eligible' );_$attributeControlContainer.find("input[type='radio'].attributeoption:checked").prop('checked', false).trigger("change");_$attributeControlContainer.find("input[type='radio']").prop('disabled', false);$attributeOptionList = _$attributeControlContainer.find( ".attributeOptionList" );$allOptions = $attributeOptionList.find(".attributeoptioncontainer");$allOptions.removeClass("attribute-option-hightlight");_$attributeControlContainer.find( ".attributeCaption[ data-attributeid='" + intProductAttributeID + "' ]" ).html("");}//change event for attribute optionAddToCartView.prototype.updateAttributeOptionSelection = function(intProductAttributeID, intProductAttributeOptionID, strCaptionSelected){$attributeOptionList = jQuery( ".attributeOptionList[data-productattributeid='" + intProductAttributeID + "' ]" );$allOptions = $attributeOptionList.find(".attributeoptioncontainer");$selectedOption = $allOptions.filter("[ data-optionid='" + intProductAttributeOptionID + "' ]");if( $selectedOption.hasClass("attribute-option-hightlight") ){// unfade all options$attributeOptionList.parents(".attributeSelectionWithImages").removeClass("attribute-option-selected");// uncheck selected option$allOptions.removeClass("attribute-option-hightlight");$selectedOption.removeClass("attribute-option-hightlight");jQuery( ".attributeCaption[ data-attributeid='" + intProductAttributeID + "' ]" ).html( '' );jQuery( ".attributeOptionList[data-productattributeid='" + intProductAttributeID + "' ] [ data-optionid='" + intProductAttributeOptionID + "' ] input" ).prop('checked', false);}else{// fade out all options$attributeOptionList.parents(".attributeSelectionWithImages").addClass("attribute-option-selected");// highlight selected option$allOptions.removeClass("attribute-option-hightlight");$selectedOption.addClass("attribute-option-hightlight");jQuery( ".attributeCaption[ data-attributeid='" + intProductAttributeID + "' ]" ).html( strCaptionSelected );}}//common ground, as to what to return to the controller, for the attributes selectedAddToCartView.prototype.getProductAttributeSelectedValues = function(){var productAttributes = {};var selector = "select[name='ProductAttributeOptionIDs'], .attribute-type-dropdown-state-country select"+ ", input[type='radio'].attributeoption:checked, .attribute-type-singleline input[type='text'], .attribute-type-date input[type='text']"+ ", .attribute-type-textarea textarea, .product-attribute-file-upload input[type='file']";//map all attribute select dropdowns to their selected valuesif (jQuery("#UseAttributeGridField").length && jQuery("#UseAttributeGridField").attr("checked") == "checked"){jQuery(".attribute-grid-add-to-cart-container").filter(function(){var $attribute = jQuery(this);if ($attribute.hasClass("custom-options-attribute")&& $attribute.hasClass("attribute-grid-product-attribute")){return false;}return true;}).find(selector).each(function(){productAttributes[jQuery(this).data("attributeid")] = jQuery(this).val();});}else{jQuery(this.container).find(selector).each(function(){productAttributes[jQuery(this).data("attributeid")] = jQuery(this).val();});}return productAttributes;}//Create attribute option thumbnail, to selectAddToCartView.prototype.createImageAttributeOption = function(productAttributeID, option, lazyLoaded){strHtml = '
';return strHtml;}AddToCartView.prototype.addAttributeOptionTooltips = function(productAttributeID, lazyLoaded){var $attributeOptions = jQuery(this.container).find("#attributeOptionList_" + productAttributeID + " li.js-tooltip" + (lazyLoaded ? ".lazyLoadedOption" : ""));$attributeOptions.each(function(){jQuery(this).tooltipsy({offset: [1, 0],content: "
"});});setTimeout(function(){$attributeOptions.each(function(){( new Image() ).src = jQuery(this).data("tooltipimage");});}, 300);jQuery(window).scroll(function(){$attributeOptions.each(function(){jQuery(this).data("tooltipsy").hide();});});}//AddToCartView all attribute optionsAddToCartView.prototype.viewMoreAttributeOptions = function(productAttribute, onChange){var productAttributeID = productAttribute.PRODUCTATTRIBUTEID;var $attributeOptionList = jQuery(this.container).find("#attributeOptionList_" + productAttributeID);//if the rest of the options need to be rendered then do so.$attributeOptionList.data("expanded", true);if ($attributeOptionList.data("rendered") === false){var numberOfItemsBeforeExpanding = 8;var checkedOption = jQuery(this.container).find("[name='ProductAttributeOptionIDs_" + productAttributeID + "']:checked");var selectedValue = checkedOption.val();//remove hidden selected option since we will now show itjQuery("[name='ProductAttributeOptionIDs_" + productAttributeID + "'].hiddenSelectedValue").remove();var strHtml = "";for (var i = numberOfItemsBeforeExpanding; i < productAttribute.OPTIONS.length; i++){strHtml += this.createImageAttributeOption(productAttributeID, productAttribute.OPTIONS[i], true);}$attributeOptionList.append(strHtml);$attributeOptionList.find(".lazyLoadedOption input[type='radio']").change(function(){onChange(productAttributeID, jQuery(this).val());});if (selectedValue != ""){var strSelector = "[data-productattributeid='" + productAttribute.PRODUCTATTRIBUTEID + "'] input[type='radio'][value='" + selectedValue + "'].attributeoption";jQuery(this.container).find(strSelector).attr("checked", "checked").trigger("change");}jQuery(this.container).find("#attributeOptionList_" + productAttributeID + " .hideUnlessExpanded").hide();this.renderAttributeOptionImagesSlowly(productAttributeID);this.addAttributeOptionTooltips(productAttributeID, true);$attributeOptionList.data("rendered", true);}else{jQuery(this.container).find("#attributeOptionList_" + productAttributeID + " .hideUnlessExpanded").show();jQuery(this.container).find(".hideMoreAttributeOptions[data-attributeid='" + productAttributeID + "']").show();}jQuery(this.container).find(".viewMoreAttributeOptions[data-attributeid='" + productAttributeID + "']").hide();}//the purpose of this function, is to disallow showing attribute images before they are loaded//assuming we have a lot of options, with images that take a while to load.AddToCartView.prototype.renderAttributeOptionImagesSlowly = function(productAttributeID){jQuery(this.container).find("[data-attributeid='" + productAttributeID + "'].spinner-loader-wrapper").show();if(typeof this.numImagesToWait == "undefined"){this.numImagesToWait = {};}if(typeof numImagesLoaded == "undefined"){this.numImagesLoaded = {};}var numImagesBeforeExpanding = 8;//find out how many images are waiting for loading for this product attributevar v = this;jQuery(document).ready(function(){var attributeLoaderIdentified = "p_" + productAttributeID;v.numImagesToWait[attributeLoaderIdentified] = jQuery(v.container).find("#attributeOptionList_" + productAttributeID + " img.track-loading").length;v.numImagesLoaded[attributeLoaderIdentified] = numImagesBeforeExpanding;if (v.numImagesToWait[attributeLoaderIdentified] == 0){//once the images we are waiting for are loaded//(except for the tooltip ones, lets not wait for those as well).//then hide the overlay and show the images.jQuery(v.container).find("#attributeOptionList_" + productAttributeID + " .hideUnlessExpanded").show();jQuery("[data-attributeID='" + productAttributeID + "'].spinner-loader-wrapper").hide();jQuery(".hideMoreAttributeOptions[data-attributeid='" + productAttributeID + "']").show();}jQuery(v.container).find("#attributeOptionList_" + productAttributeID + " img.track-loading").on("load",function(){//decrement the number of images we are waiting for loading.v.numImagesToWait[attributeLoaderIdentified]--;v.numImagesLoaded[attributeLoaderIdentified]++;if (v.numImagesToWait[attributeLoaderIdentified] == 0){//once the images we are waiting for are loaded//(except for the tooltip ones, lets not wait for those as well).//then hide the overlay and show the images.jQuery(v.container).find("#attributeOptionList_" + productAttributeID + " .hideUnlessExpanded").show();jQuery("[data-attributeID='" + productAttributeID + "'].spinner-loader-wrapper").hide();jQuery(".hideMoreAttributeOptions[data-attributeid='" + productAttributeID + "']").show();}//if a couple of rows managed to load, then show themelse if (v.numImagesLoaded[attributeLoaderIdentified] > numImagesBeforeExpanding&& v.numImagesLoaded[attributeLoaderIdentified] % (v.getAttributeOptionsPerRow() * 2) == 0){var startIndex = 0;var endIndex = v.numImagesLoaded[attributeLoaderIdentified] - v.getAttributeOptionsPerRow();jQuery(v.container).find("#attributeOptionList_" + productAttributeID + " .hideUnlessExpanded").slice(startIndex, endIndex).slideDown();}});});}//calculate how many children can fit per row.AddToCartView.prototype.getAttributeOptionsPerRow = function(){if(typeof this.childrenPerRow == "undefined"){var oneItemWidth = 0;var containerWidth = 0;//calculate how many attribute option images, can fit in a row, hide the rest.jQuery(this.container).find(".attributeSelectionWithImages ul").each(function(){if (jQuery(this).find("li").length > 1){//show just the first two, in order to be able to make calculations!jQuery(this).find("li:first").show();jQuery(this).find("li:eq(1)").show();firstChild = jQuery(this).find("li")[0];secondChild = jQuery(this).find("li")[1];containerWidth = jQuery(this).width();oneItemWidth = secondChild.offsetLeft - firstChild.offsetLeft;if (oneItemWidth == 0){oneItemWidth = jQuery(this).find("li:first").outerWidth(true);}return false;}});if (oneItemWidth > 0){var childrenPerRow = Math.floor(containerWidth / oneItemWidth);//now that we know how many children can fit, hide the rest.jQuery(this.container).find(".attributeSelectionWithImages ul").each(function(){numberOfRows = 1;numberOfVisibleItems = childrenPerRow * numberOfRows;jQuery(this).children("li").removeClass("hideUnlessExpanded");//add class hide unless expanded, to children under the first rowjQuery(this).children("li:gt(" + (numberOfVisibleItems - 1) + ")").addClass("hideUnlessExpanded");$loadedAttributeOptions = jQuery(this).children("li");$loadedAttributeOptions.show();blnShowExpandToggle = numberOfVisibleItems < jQuery(this).data("totaloptions");if ($loadedAttributeOptions.length < jQuery(this).data("totaloptions")){blnShowExpandToggle = true;}if (blnShowExpandToggle){if (jQuery(this).data("expanded")){jQuery(".viewMoreAttributeOptions[data-attributeid='" + jQuery(this).data("productattributeid") + "']").hide();jQuery(".hideMoreAttributeOptions[data-attributeid='" + jQuery(this).data("productattributeid") + "']").show();} else {//if this was not previously expanded and now it has been resized, hide all the hidden items, and shoe the view more option$loadedAttributeOptions.filter(".hideUnlessExpanded").hide();jQuery(".viewMoreAttributeOptions[data-attributeid='" + jQuery(this).data("productattributeid") + "']").show();jQuery(".hideMoreAttributeOptions[data-attributeid='" + jQuery(this).data("productattributeid") + "']").hide();}} else {//if all options can fit into the collapsed rows, then just hide the viewmore/hide options and just show everythingjQuery(".viewMoreAttributeOptions[data-attributeid='" + jQuery(this).data("productattributeid") + "']").hide();jQuery(".hideMoreAttributeOptions[data-attributeid='" + jQuery(this).data("productattributeid") + "']").hide();}});this.childrenPerRow = childrenPerRow;return childrenPerRow;}else{jQuery(".viewMoreAttributeOptions").hide();jQuery(".hideMoreAttributeOptions").hide();jQuery(".attributeSelectionWithImages ul li").show();}}else{return this.childrenPerRow;}}//Collapse attribute optionsAddToCartView.prototype.hideMoreAttributeOptions = function(productAttribute){var productAttributeID = productAttribute.PRODUCTATTRIBUTEID;jQuery(this.container).find("#attributeOptionList_" + productAttributeID).data("expanded", false);jQuery(this.container).find("#attributeOptionList_" + productAttributeID + " .hideUnlessExpanded").hide();jQuery(this.container).find(".viewMoreAttributeOptions[data-attributeid='" + productAttributeID + "']").show();jQuery(this.container).find(".hideMoreAttributeOptions[data-attributeid='" + productAttributeID + "']").hide();}//create single line text attributeAddToCartView.prototype.createSingleLineTextAttribute = function(productAttribute){var strHtml = '
';strHtml+= '
';strHtml+= '
';strHtml+= '';strHtml+= '
';jQuery(strHtml).appendTo(this.container.find(".add_to_cart_form_content"));}//create state and country dropdownsAddToCartView.prototype.createCountryDropdown = function(productAttribute, countries){this.createAttributeDropdown(productAttribute, countries);}AddToCartView.prototype.createStateDropdown = function(productAttribute, states){this.createAttributeDropdown(productAttribute, states);}AddToCartView.prototype.createAttributeDropdown = function(productAttribute, options){var strRequiredClass = "";if(productAttribute.ISREQUIRED){strRequiredClass = " attributeSelectionLabelRequired";}var strHtml = '
'strHtml += '';strHtml += '';strHtml += '
';jQuery(strHtml).appendTo(this.container.find(".add_to_cart_form_content"));}//create text area attributeAddToCartView.prototype.createTextAreaAttribute = function(productAttribute){var strRequiredClass = "";if(productAttribute.ISREQUIRED){strRequiredClass = " attributeSelectionLabelRequired";}var strHtml = '
';strHtml += '';strHtml += '';strHtml += '
';jQuery(strHtml).appendTo(this.container.find(".add_to_cart_form_content"));}//create date attributeAddToCartView.prototype.createDateAttribute = function(productAttribute){var strRequiredClass = "";if(productAttribute.ISREQUIRED){strRequiredClass = " attributeSelectionLabelRequired";}var strHtml = '
';strHtml += '';strHtml += '';strHtml += '
';strHtml += "'%name%' must be a valid date, format yyyy-mm-dd.".replace("%name%", productAttribute.Name);strHtml += '
';strHtml += '
';jQuery(strHtml).appendTo(this.container.find(".add_to_cart_form_content"));this.container.find(".attribute-datepicker").datepicker({dateFormat: 'yy-mm-dd',showOn: "both",buttonImage: "/core/public/shared/assets/images/calendar.gif",buttonImageOnly: true,buttonText: 'Click for Calendar',changeMonth: true,yearRange: "-100:+25",changeYear: true});}//create file upload attributeAddToCartView.prototype.createFileUploadAttribute = function(productAttribute){var strHtml = '
';strHtml += '
';strHtml += '';strHtml += '';strHtml += '
';strHtml += '
';strHtml += 'Accepted Formats: ' + productAttribute.ACCEPTEDFORMATS;strHtml += '
';if (productAttribute.SPECIALINSTRUCTIONS != ''){strHtml += '
' + productAttribute.SPECIALINSTRUCTIONS + '
';}strHtml += '
';jQuery(strHtml).appendTo(this.container.find(".add_to_cart_form_content"));}//update variant nameAddToCartView.prototype.setVariantName = function(name){jQuery(this.container).find("#variant-name").html(name);}AddToCartView.prototype.formatPrice = function(price){return "€" + price.toFixed(2);}AddToCartView.prototype.updatePrice = function(prices, priceTiers, hasPrice, rangePriceStart, rangePriceEnd){//update the item pricereturn;}AddToCartView.prototype.hideItemPrice = function(){return;}AddToCartView.prototype.getUseRewardPoints = function(){return jQuery(this.container).find("input[ name='PurchaseWithPoints' ]:checked").val();}AddToCartView.prototype.updateRewardPoints = function(points){//update the item pricejQuery(this.container).find(".product-reward-points").html(points);}AddToCartView.prototype.updateSKUNumber = function(skunumber){// Update SKU NumberjQuery(this.container).find("#sku-number").html(skunumber);}AddToCartView.prototype.updateWeight = function(weight){// Update WeightjQuery(this.container).find("#weight").html(weight + ' lbs');}//update view based on new price(if we changed to a variant), images etc.AddToCartView.prototype.updatePicturesView = function(productImages){blnHasSetupSlider = true;jQuery(".main-slider").removeData("slider");var strImages = "";var intMinToBeConsideredLarge = 500;if (productImages.length > 1){strImages += '
';strImages += '
';var hasLargeImageDimensions = false;for (var i = 0; i < productImages.length; i++){var productImage = productImages[i];hasLargeImageDimensions = hasLargeImageDimensions || productImage.ColorboxDimensions.split('x')[0] > intMinToBeConsideredLarge;strImages += '
';strImages += '';strImages += ' 0){strImages += 'data-lazy="/media/products/' + productImage.IMAGE + '?dimensions=' + productImage.LargeDimensions + '"';strImages += 'src="/core/public/shared/assets/images/space.gif"';}else{strImages += 'src="/media/products/' + productImage.IMAGE + '?dimensions=' + productImage.LargeDimensions + '"';}strImages += 'alt="' + productImage.IMAGEALTTEXT + '"';strImages += 'title="' + productImage.IMAGEALTTEXT + '"';strImages += 'style="border: 0;"';strImages += 'role="link"';strImages += '/>';strImages += '';strImages += '
';}strImages += '
';strImages += '
';strImages += '
';strImages += '
';strImages += 'Hover to zoom';strImages += '
';strImages += '
';for (var i = 0; i < productImages.length; i++){var productImage = productImages[i];strImages += '
';strImages += '
';strImages += '
';strImages += ' 4 ){strImages += 'data-lazy="/media/products/' + productImage.IMAGE + '?dimensions=' + productImage.ThumbnailDimensions + '"';strImages += 'src="/core/public/shared/assets/images/space.gif"';}else{strImages += 'src="/media/products/' + productImage.IMAGE + '?dimensions=' + productImage.ThumbnailDimensions + '"';}strImages += 'alt="' + productImage.IMAGEALTTEXT + '"';strImages += 'title="' + productImage.IMAGEALTTEXT + '"';strImages += 'style="border: 0;"';strImages += 'role="link"';strImages += '/>';strImages += '
';strImages += '
';strImages += '
';}strImages += '
';}else if (productImages.length == 1){var productImage = productImages[0];var imagePath = '/media/products/' + productImage.IMAGE;var hasLargeImageDimensions = productImage.ColorboxDimensions.split('x')[0] > intMinToBeConsideredLarge;strImages += '
';strImages += '
';strImages += '';strImages += '';strImages += '';strImages += '';strImages += '';strImages += '
';strImages += '
';strImages += 'Hover to zoom';strImages += '
';}// Set up the html inside the sliderjQuery(".product-details-slideshow").html(strImages);if ( productImages.length > 0 ) {// Set up the slider in the divthis.renderSlider();}}//set subtotal on the view, after calculationsAddToCartView.prototype.setSubtotalRow = function(subtotal, pointsSubtotal, hasPrice, includeRewardPointsSelect, hasRewardPoints){var strPrice = subtotal;if (includeRewardPointsSelect){var strPoints = pointsSubtotal;var strHtml = '
';strHtml += '
Subtotal
';strHtml += '
';strHtml += '
';strHtml += '
';strHtml += '
';strHtml += '
';jQuery(this.container).find(".subtotal_row").html(strHtml);}else{var strHtml = '
Subtotal
' + strPrice + ''jQuery(this.container).find(".subtotal_row").html(strHtml);}}AddToCartView.prototype.hideSubtotalRow = function(){jQuery(this.container).find(".subtotal_row").hide();}AddToCartView.prototype.showSubtotalRow = function(){jQuery(this.container).find(".subtotal_row").show();}//create add to cart buttonAddToCartView.prototype.createAddToCartButton = function(onClick){var strHtml = '
';strHtml+= '';strHtml+= '';strHtml+= '
';jQuery(strHtml).appendTo(jQuery(this.container).find(".submit_row"))jQuery(this.container).find("button[name='SubmitButton'][value='btn-add-to-cart']").click(function(){onClick("btn-add-to-cart");});jQuery(this.container).find("button[name='SubmitButton'][value='btn-wishlist']").click(function(){onClick("btn-wishlist");});}AddToCartView.prototype.enableAddToCartButton = function(onClick){jQuery(this.container).find("#AddToCartButtonContainer button").prop("disabled", false);}AddToCartView.prototype.disableAddToCartButton = function(onClick){jQuery(this.container).find("#AddToCartButtonContainer button").prop("disabled", true);}AddToCartView.prototype.showAddToCartButton = function(onClick){jQuery(this.container).find("#AddToCartButtonContainer").show();}AddToCartView.prototype.hideAddToCartButton = function(onClick){jQuery(this.container).find("#AddToCartButtonContainer").hide();}AddToCartView.prototype.showAddedToCartMessage = function(){jQuery(this.container).find(".added-to-cart-message").show();jQuery(this.container).find("#AddToCartButtonContainer button").hide();}//create preorder buttonAddToCartView.prototype.createPreOrderButton = function(onClick, PreorderAvailabilityMessage){var strHtml = '
';strHtml+= '';strHtml+= '';strHtml+= '
';jQuery(strHtml).appendTo(jQuery(this.container).find(".submit_row"))jQuery(this.container).find("button[name='SubmitButton'][value='btn-add-to-cart']").click(function(){onClick("btn-add-to-cart");});jQuery(this.container).find("button[name='SubmitButton'][value='btn-wishlist']").click(function(){onClick("btn-wishlist");});}//create wishlist buttonAddToCartView.prototype.createWishlistButton = function(onClick){// moved this to "createAddToCartButton", due to design constraints}AddToCartView.prototype.showWishlistButton = function(){this.container.find("#AddToWishList").show();}AddToCartView.prototype.hideWishlistButton = function(){this.container.find("#AddToWishList").hide();}//create view wishlist linkAddToCartView.prototype.createViewWishlistLink = function(){var strHtml = '
';strHtml += 'View Wishlist';strHtml += '
'jQuery(strHtml).appendTo(this.container.find(".add_to_cart_form_container"));}//create favorites buttonAddToCartView.prototype.createFavoritesButton = function(onClick){jQuery('').appendTo(this.container.find(".submit_row")).click(function(){onClick("btn-add-to-favorites");});}AddToCartView.prototype.showFavoritesButton = function(){this.container.find("#AddToFavorites").show();}AddToCartView.prototype.hideFavoritesButton = function(){this.container.find("#AddToFavorites").hide();}//create view favorites linkAddToCartView.prototype.createViewFavoritesLink = function(){var strHtml = '
';strHtml += 'View Favorites';strHtml += '
'jQuery(strHtml).appendTo(this.container.find(".add_to_cart_form_container"));}//create out of stock messageAddToCartView.prototype.createOutOfStockMessage = function() {var strHtml = '
';strHtml+= '';strHtml+= '
Out of stock
';strHtml+= '
';jQuery(strHtml).appendTo(jQuery(this.container).find(".submit_row"));jQuery(this.container).find("button[name='SubmitButton'][value='btn-wishlist']").click(function(){onClick("btn-wishlist");});}AddToCartView.prototype.showOutOfStockMessage = function() {jQuery(this.container).find("#OutOfStockContainer").show();}AddToCartView.prototype.hideOutOfStockMessage = function() {jQuery(this.container).find("#OutOfStockContainer").hide();}//create product availability formAddToCartView.prototype.toggleProductAvailabilityForm = function() {jQuery(this.container).find("#product-availability").toggle();}AddToCartView.prototype.createProductAvailabilityForm = function() {var fullScope = this;var strHtml = '';jQuery(strHtml).appendTo(this.container.find(".submit_row")).on('click', function() {fullScope.toggleProductAvailabilityForm();});var strHtml = '
';strHtml += '
Please enter your details in order to receive email notification once this product is available:
';strHtml += '
';strHtml += ' ';strHtml += ' ';strHtml += '
';strHtml += '
';strHtml += ' ';strHtml += ' ';strHtml += '
';strHtml += ' ';strHtml += '
';strHtml += '
';strHtml += '
';jQuery(strHtml).appendTo(this.container.find(".submit_row"));jQuery('#emailAddress').keypress( function( event ) {var keycode = ( event.keyCode ? event.keyCode : event.which );if ( keycode == '13' ) {jQuery('#btn-product-availability-notification').click();event.preventDefault();return false;}});jQuery('#btn-product-availability-notification').on('click', function() {jQuery( '.product-availability-notification-message' ).hide();jQuery( '.product-availability-notification-error' ).hide();jQuery.ajax({url: "/ecommerce/126162/subscribe",type: 'POST',data: {"emailAddress": jQuery("#emailAddress").val(),"phone": jQuery("#phone").val()},success: function (data){if( data.SUCCESS ){jQuery( '.product-availability-notification-message' ).html( data.MESSAGE );jQuery( '.product-availability-notification-error' ).hide();jQuery( '.product-availability-notification-message' ).show();} else {jQuery( '.product-availability-notification-error' ).html( data.MESSAGE );jQuery( '.product-availability-notification-error' ).show();jQuery( '.product-availability-notification-message' ).hide();}},error: function (data){jQuery( '.product-availability-notification-error' ).html( data.MESSAGE );jQuery( '.product-availability-notification-error' ).show();jQuery( '.product-availability-notification-message' ).hide();}});});}AddToCartView.prototype.showProductAvailabilityButton = function() {jQuery(this.container).find("#NotifyWhenAvailable").show();}AddToCartView.prototype.hideProductAvailabilityButton = function() {jQuery(this.container).find("#NotifyWhenAvailable").hide();}//Create availability informationAddToCartView.prototype.createAvailabilityInformation = function(showOnlineAvailability, isAvailableOnline, onlineAvailabilityMessage, showStoreAvailability, isAvailableInStore, storeAvailabilityMessage){var strHtml = '';if (showOnlineAvailability){strHtml += '' + onlineAvailabilityMessage + '
';}if (showStoreAvailability){strHtml += '' + storeAvailabilityMessage + '
';}jQuery(strHtml).appendTo(this.container.find(".availability_box"));}//create product installation fees informationAddToCartView.prototype.createProductInstallationFeesInfo = function() {var fullScope = this;var strHtml = '
This product has installation fees
';jQuery(strHtml).appendTo(this.container.find(".submit_row"));}//show combination is invalid messageAddToCartView.prototype.showCombinationIsInvalid = function() {jQuery(this.container).find(".notavailable_row").show();}AddToCartView.prototype.hideCombinationIsInvalid = function() {jQuery(this.container).find(".notavailable_row").hide();}AddToCartView.prototype.renderSlider = function (intVariantIndex){jQuery('.main-slider').on("init", function(event, slick){jQuery(this).find('.main-slide img').animate({opacity: 1});});jQuery('.main-slider').slick({arrows: false,slidesToShow: 1,slidesToScroll: 1,fade: true,draggable: false,infinite: true,lazyLoad: 'ondemand',speed: 100,swipe: false,responsive: [{breakpoint: 720,settings: {draggable: true}}]});jQuery('.carousel-slider').slick({prevArrow: "",nextArrow: "",slidesToShow: 4,slidesToScroll: 4,infinite: true});jQuery('.carousel-slider .mini-slide[data-slick-index="0"]').find(".mini-slide-image-outer-wrapper").addClass('selected');jQuery('.carousel-slider').on("click keypress", ".slick-slide", function(){if (e.type == 'keypress' && e.keyCode != 13){return;}var currentSlide = jQuery(this).data('slick-index');jQuery('.main-slider').slick("slickGoTo", parseInt(currentSlide));jQuery('.carousel-slider .mini-slide-image-outer-wrapper').removeClass('selected');jQuery('.carousel-slider .mini-slide[data-slick-index="' + currentSlide + '"]').find(".mini-slide-image-outer-wrapper").addClass('selected');});setupLightBoxMagnifier();setupInnerMagnifier();}function setupLightBoxMagnifier(){jQuery(".js-with-lightbox-magnifier").magnificPopup({type: 'image',delegate: '.js-larger-image',closeOnContentClick: false,showCloseBtn: true,disableOn: 721,closeOnBgClick: false,zoom: {enabled: true,opener: function(openerElement){return openerElement.is('img') ? openerElement : openerElement.find('img');}},gallery: {enabled: true,tCounter: 'Image %curr% of %total%'},callbacks: {close: function() {initInnerMagnifier();$('.lightbox-magnifier-description').text('Hover to zoom');},buildControls: function() {// re-appends controls inside the main containerif ( this.arrowLeft != null && this.arrowRight != null ) {this.contentContainer.append(this.arrowLeft.add(this.arrowRight));}}}});$('body').on('click', '.js-larger-image', function() {if ( $( window ).width() < 721 ) {event.preventDefault();}});}$(document).on("mouseenter", ".flyout-element-handler", function() {$('.lightbox-magnifier-description').text('Click to enlarge');});$(document).on("mouseleave", ".flyout-element-handler", function() {$('.lightbox-magnifier-description').text('Hover to zoom');});function setupInnerMagnifier(){initInnerMagnifier();apiEasyZoom.opts.loadingNotice = " Loading...";apiEasyZoom.opts.preventClicks = false;// Manually click the proper image to trigger Magnific popup, because easyzoom creates conflict$('body').on('click', '.easyzoom-flyout img', function() {apiEasyZoom.teardown();if ( $('.slick-current').length > 0 ) {$('.slick-current .js-larger-image img').click();}else {$('.js-larger-image img').click();}});// Whenever changes in any of the easyzoom DOM happens, check if we are in mobile view and remove easyzoom$('.slick-track').on('DOMSubtreeModified', function(){if ( $( window ).width() < 976 ) {$('.easyzoom').removeClass('easyzoom--overlay');completeInnerMagnifierTeardown( objEasyZoom );}});// Check on load if easyzoom needs to be removed (mobile view)$( document ).ready(function() {if ( $( window ).width() < 976 ) {$('.easyzoom').removeClass('easyzoom--overlay');completeInnerMagnifierTeardown( objEasyZoom );$('.lightbox-magnifier-description').hide();}});// When the window is resized, show/remove easyzoom depending on the view$( window ).resize(function() {if ( $( window ).width() < 976 ) {$('.easyzoom').removeClass('easyzoom--overlay');completeInnerMagnifierTeardown( objEasyZoom );$('.lightbox-magnifier-description').hide();}else {if ( !$('.easyzoom').hasClass('easyzoom--overlay') ) {$('.easyzoom').addClass('easyzoom--overlay');completeInnerMagnifierTeardown( objEasyZoom );initInnerMagnifier();}$('.lightbox-magnifier-description').show();}});}function initInnerMagnifier(){objEasyZoom = jQuery('.easyzoom').easyZoom();apiEasyZoom = objEasyZoom.data('easyZoom');objEasyZoom.each((i) => {objEasyZoom.eq(i).data('easyZoom').$flyout.addClass('flyout-element-handler');});}// Destroy all easyzoom instances attached to this objectfunction completeInnerMagnifierTeardown( easyZoomHandler ){easyZoomHandler.each((i) => {easyZoomHandler.eq(i).data('easyZoom').teardown();});}AddToCartView.prototype.showMessages = function( messages){alert(messages.join('\n'));}AddToCartView.prototype.showGiftsMessage = function(strGiftsMessage, strProductDetailsURL) {}AddToCartView.prototype.showMTNPlan = function(strMTNPlan, strProductDetailsURL) {}AddToCartView.prototype.showSpecs = function(strSpecs) {}