WEARING
THE RIGHT SHOE
MATTERS.
Get matched with the right golf shoe for your specific playing style and preferences, and improve your on-course comfort with a few short questions.
' ).append( '
' + recommender.$t('select-all-none') + '
' ); $('.recommender').find('.slug-question-importance .question-title-text').append( '
' + recommender.$t('select-two') + '
' + '
' + recommender.$t('select-two') + '
' + '
' + recommender.$t('select-two-continue-action') + '
' + '
' + recommender.$t('select-two-continue-action') + '
' ); $('.recommender').find('.slug-question-importance .question').append(recommender.$t('continue-action')); // If there is a saved history state, replay it. setTimeout(function () { var savedHistory; if (window.history && window.history.pushState && window.history.state) { if (window.history.state.recommenderHistory) { savedHistory = window.history.state.recommenderHistory; window.history.replaceState({}, document.title); } } if (savedHistory) { replaying = true; $('.recommender-main').show(); recommender.replay(savedHistory); } }); }, replayComplete: function () { replaying = false; $('.recommender-title').fadeOut(); $('html, body').animate({ scrollTop: 0 }, 400); }, pageAnimation: function (options) { if (replaying) { options.from.hide(); options.to.show(); if (options.to.is('.question-group-results')) { var height = options.to.show().get(0).scrollHeight; $('.recommender-container').css({ 'min-height': height }); } return; } if (options.from) { if (options.from.is('.question-group-results')) { // Animates between full-page recommender page and full-height recommendations page. // ... when leaving recommendations page. var height = $('.recommender-container').outerHeight(); $('.recommender-container').css({ 'min-height': 0 }); var newHeight = $('.recommender-container').outerHeight(); $('.recommender-container').css({ 'min-height': height }).animate({ 'min-height': newHeight }, function () { $('.recommender-container').css({ 'min-height': '' }); }); } options.from.fadeOut(); } if (options.to) { if (options.to.is('.question-group-results')) { // Animates between full-page recommender page and full-height recommendations page. // ... when entering the results page. var height = options.to.show().get(0).scrollHeight; $('.recommender-container').css({ 'min-height': $('.recommender-container').height() }).animate({ 'min-height': height }); } options.to.hide().fadeIn(); } return true; }, enterPage: function (options) { // Clear questions to allow autoadvance again. recommender.undoQuestions(options.page.find('.question')); if (options.page.is('.slug-page-playerprofile')) { // Clear interstitial page to enable the button again. } if (options.page.is('.slug-page-shoeprofile')) { // Clear interstitial page to enable the button again. } if (options.page.is('.slug-page-pain')) { // Clear all questions... options.page.find('.slug-choice-none').find('input').trigger('click').trigger('change'); } }, afterUpdateFactor: function (o) { if (o.answerSlug === 'choice-womens'){ lastGender = 'W'; // https://www.footjoy.com/on/demandware.store/Sites-footjoy-Site/en_US/Search-Show?cgid=shoes-women shopAllLink = "https://www.footjoy.fr/fr_FR/femme/chaussures/"; } if (o.answerSlug === 'choice-junior'){ lastGender = 'M'; shopAllLink = "https://www.footjoy.fr/fr_FR/junior/juniors-2/"; } if (o.answerSlug === 'choice-mens') { lastGender = 'M'; shopAllLink = "https://www.footjoy.fr/fr_FR/homme/chaussures/"; } }, afterActivateQuestion: function (o) { updatePainQuestion(o); updateImportanceQuestion(o); }, afterDeactivateQuestion: function (o) { updatePainQuestion(o); updateImportanceQuestion(o); }, beforeRetrieveRecommendations: function (o) { if (o.pageIndex
' + recommender.$t('we-recommend') + ' —
').insertBefore( $('.recommender-main').find('.recommender-products').first()); $('' ); } // Mark the product order $('.recommender-main').find('.product').first().addClass('product-first'); $('.recommender-main').find('.product').eq(1).addClass('product-second').addClass('product-secondary'); $('.recommender-main').find('.product').eq(2).addClass('product-third').addClass('product-secondary'); // Build container around product content (not image) $('.recommender-main .product-first .product-inner').find('h3, .price, .add-to-cart, .product-description, .product-swatches, .product-reviews').wrapAll('
'); $('.recommender-main .product-second .product-inner').find('h3, .price, .add-to-cart, .product-description, .product-swatches, .product-reviews').wrapAll('
'); $('.recommender-main .product-third .product-inner').find('h3, .price, .add-to-cart, .product-description, .product-swatches, .product-reviews').wrapAll('
'); // Build container around secondary products $('.recommender-products').find('.product-second, .product-third').wrapAll('
'); loadProducts(); setTimeout(function () { updateResultsHeight(); }, 100); }, addToCart: function (options) { // Save breadcrumbs. if (breadcrumbs) { if (window.history && window.history.pushState) { window.history.replaceState({ recommenderHistory: breadcrumbs }, document.title); } } setTimeout(function () { if (lastProductLink) { if ($(lastProductLink).attr('data-product-url')) { window.location.href = $(lastProductLink).attr('data-product-url'); } else if ($(lastProductLink).is('.action-customizable')) { var url; if ($(lastProductLink).attr('data-myjoys')) { url = "https://www.footjoy.fr/fr_FR/myjoys-customize" + '?prodId=' + $(lastProductLink).attr('data-myjoys'); } else { url = "https://www.footjoy.fr/fr_FR/myjoys-custom-golf-shoes" + '?filter=' + lastGender + '&packId=-1'; } window.location.href = url; } else { var url = "https://www.footjoy.fr/on/demandware.store/Sites-footjoy-emea-Site/fr_FR/Product-Show?pid=" + options.productId; window.location.href = url; } } }); }, historyChanged: function (history) { breadcrumbs = history; }, // Listen to the update event and modify the UI accordingly. summaryUpdated: function (summary) { } }, helpers: { ifincludes: function () { var options = arguments[arguments.length - 1]; var test = arguments[0] || ''; for (var i = 1; i = 0) { return options.fn(this); } } return options.inverse(this); } }, templates: { product: [ '
', '
', '{{> productimage this}}', '{{> productname this}}', '{{> productprice this}}', '
', '
', '
{{#if attributes.' + descriptionAttr + '}}{{attributes.' + descriptionAttr + '}}{{else}}{{attributes.long_description}}{{/if}}
', '{{> productaddtocart this}}', '
', '
' ].join(''), productname: [ '

{{product.name}}

', ].join(''), productaddtocart: [ '

', '', '{{#if attributes.MyJoys_Identifier}}', '', '{{/if}}', '

', ].join(''), productprice: '
', productlink: "https://www.footjoy.fr/on/demandware.store/Sites-footjoy-emea-Site/fr_FR/Product-Show?pid={{product.externalId}}" }, }); // Start recommender experience. recommender.run(); // Global handlers. $(document).on('click', '.result-start-over', function (e) { e.preventDefault(); recommender.restart(); $('html, body').animate({ scrollTop: 0 }, 400); }); $(document).on('click', '.action-add-to-cart', function (e) { lastProductLink = this; }); // Helpers. var uniqueId = 1; $(document).on('submit', '.js-submit-results', function (e) { e.preventDefault(); var email = $('.results-save-email').val().trim(); if (email.length > 0) { var products = []; if ($('.recommender-products .product-first')) { products.push($('.recommender-products .product-first')); } if ($('.recommender-products .product-second')) { products.push($('.recommender-products .product-second')); } if ($('.recommender-products .product-third')) { products.push($('.recommender-products .product-third')); } var data = { 'Email address': email, 'Opt in': $('.js-checkbox-terms').is(':checked') }; products.forEach(function ($product, i) { var index = i + 1; if ($product.attr('data-product-id')) { var productId = ($product.attr('data-product-id') || '').trim(); data['Recommended product ' + index + ' product id'] = productId; data['Recommended product ' + index + ' product name'] = ($product.find('h3 a').text() || '').trim(); data['Recommended product ' + index + ' product URL'] = "https://www.footjoy.fr/on/demandware.store/Sites-footjoy-emea-Site/fr_FR/Product-Show?pid=" + productId; data['Recommended product ' + index + ' product image'] = $product.find('.image').css('backgroundImage').replace(/url\(\"/, '').replace(/"\)$/, ''); if ($product.find('.price-standard').length > 0) { data['Recommended product ' + index + ' price'] = ($product.find('.price-sales').text() || '').trim(); } else if ($product.find('.price-sales').length > 0) { data['Recommended product ' + index + ' price'] = ($product.find('.price-sales').text() || '').trim(); } else { $product.find('.price .price-currency').remove(); data['Recommended product ' + index + ' price'] = ($product.find('.price').text() || '').trim(); } data['Recommended product ' + index + ' product details'] = ($product.find('.product-description').text() || '').trim(); } }); console.log('Sharing data', data); recommender.share([email], { project: 'ShoeFinder', optIn: $('.js-checkbox-terms').is(':checked'), products: data, }); $('.results-save-email').val(''); $('.results-save-sent').fadeIn(); } }); $(document).on('click', '.pain-continue', function (e) { e.preventDefault(); $(this).closest('.question-group').find('.question-group-next button').click(); }); $(document).on('click', '.importance-continue', function (e) { e.preventDefault(); $(this).closest('.question-group').find('.question-group-next button').click(); }); function updateResultsHeight() { var $results = $('.question-group-results'); if ($results.is(':visible')) { var height = $results.get(0).scrollHeight; $('.recommender-container').stop().css({ 'min-height': height }); } } function loadProducts() { $('.recommender .product').each(function () { var $product = $(this); var productId = $product.attr('data-product-id'); var url = "https://www.footjoy.fr/on/demandware.store/Sites-footjoy-emea-Site/fr_FR/Product-Show?pid=" + productId + '&format=ajax'; if (window.location.href.indexOf('localhost') >= 0) { url = 'https://www.footjoy.com' + url; } $.ajax({ type: 'GET', url: url, dataType: 'html' }).done(function (pdp) { var pdpDocument = document.implementation.createHTMLDocument('preview'); var $pdp = $(pdp, pdpDocument); var $price = $pdp.find('.product-price'); if ($price.length > 0) { $product.find('.price').html($price.html()); } var $swatches = $pdp.find('.swatchanchor'); if ($swatches.length > 0) { $product.find('.product-swatches').empty(); var extra = 0; var count = 0; $swatches.each(function () { count += 1; var $swatch = $product.find('.action-add-to-cart.action-primary').clone(); $swatch.removeClass('action-primary').addClass('action-swatch'); $swatch.html($(this).html()); $swatch.attr('data-product-url', $(this).attr('data-product-url')); if ($product.is('.product-secondary')) { if (count > 3) { extra += 1; } else { $product.find('.product-swatches').append($swatch); } } else { $product.find('.product-swatches').append($swatch); } }); if (extra > 0) { $product.find('.product-swatches').append('' + extra + '+'); } } // Insert power reviews. var reviewsId = 'reviews-' + new Date().getTime() + '-' + (uniqueId++); $product.find('.product-reviews').attr('id', reviewsId); var componentsObject = { ReviewSnippet: reviewsId }; if (window.POWERREVIEWS) { POWERREVIEWS.display.render({ api_key: 'e3b046ff-7dd1-4538-99b4-515f9ed691c8', locale: 'en_US', merchant_group_id: '48005', merchant_id: '739006', style_sheet: '', page_id: productId, components: componentsObject, on_render: function () { setTimeout(function () { updateResultsHeight(); }, 500); } }); } updateResultsHeight(); }); }); } function updatePainQuestion(o) { // Pain - Select all or NONE customization if (o.question.is('.slug-question-pain')) { var notNoneChecked = o.question.find('input:not([data-slug~="choice-none"])').filter(':checked'); // Need to delay toggling None button after this event call is complete. setTimeout(function () { var $none = o.question.find('.slug-choice-none').find('input'); if (notNoneChecked.length > 0) { if ($none.prop('checked')) { $none.prop('checked', false).trigger('change'); } } else { if (!$none.prop('checked')) { $none.prop('checked', true).trigger('change'); } } }); } } function updateImportanceQuestion(o) { if (o.question.is('.slug-question-importance')) { var checked = o.question.find('input').filter(':checked'); o.question .closest('.question-group').find('.importance-can-continue').hide() .closest('.question-group').find('.importance-cannot-continue').show(); if (checked.length === 2) { o.question .closest('.question-group').find('.importance-can-continue').show() .closest('.question-group').find('.importance-cannot-continue').hide(); o.question.find('.question-choice').each(function () { var $input = $(this).find('input'); if (!$input.is(':checked')) { $(this).find('.question-checkbox-button').addClass('disabled'); $input.prop('disabled', true); } }); } else { o.question.find('.question-choice').each(function () { $(this).find('.question-checkbox-button').removeClass('disabled').end().find('input').prop('disabled', false); }); } if (checked.length !== 2) { if (o.question.find('.slug-choice-spiked input').is(':checked')) { o.question.find('.slug-choice-spikeless').find('.question-checkbox-button').addClass('disabled').end().find('input').prop('disabled', true); } else { o.question.find('.slug-choice-spikeless').find('.question-checkbox-button').removeClass('disabled').end().find('input').prop('disabled', false); } if (o.question.find('.slug-choice-spikeless input').is(':checked')) { o.question.find('.slug-choice-spiked').find('.question-checkbox-button').addClass('disabled').end().find('input').prop('disabled', true); } else { o.question.find('.slug-choice-spiked').find('.question-checkbox-button').removeClass('disabled').end().find('input').prop('disabled', false); } } o.question.closest('.question-group').find('.question-group-next').toggle(checked.length === 2); } } })); });