`; jQuery('#grid_wrapper_search_products_grid .aggregator-product-loader').hide(); jQuery('#grid_wrapper_search_products_grid .grid-content').show(); jQuery('#grid_wrapper_search_products_grid .grid-content').html(noDataFound); }, createGrid: function(gridName, productSummaries, categories, recordsTotal, searchTerm) { let gridItems = ''; for (var i = 0; i < productSummaries.length; i++) { gridItems += this.createGridCard(gridName, productSummaries[i]); } let productTotal = 0; if(productSummaries.length > 0){ productTotal = recordsTotal; } let catFilter = categories; if( catFilter.length > 0){ if(catFilter.length > 1){ // catFilter = 'All Categories'; catFilter = ''; } else { catFilter = catFilter[0].replace(/-/g, " "); catFilter = ucwords(catFilter); } } let utmPillsHtml = ''; if(utmParams.length > 0){ utmParams.forEach(function(val) { utmPillsHtml += `
`; }); } let showingResults = '
'; if(!isEmpty(utmParams)){ catFilter = utmParams.join(', '); } if(!isEmpty(searchTerm) || !isEmpty(catFilter)){ showingResults = `
Found ${productTotal} result(s) ${!isEmpty(searchTerm) ? 'for "'+searchTerm+'"' : 'for "'+catFilter+'"'}
`; }else{ showingResults = `
Found ${productTotal} result(s) for All Programmes
`; } let grid = `
${showingResults}
${localStorage.getItem("sortValue") ?? 'A-Z'}
- A-Z
- Price Low-High
- Price High-Low
${gridItems}
`; jQuery('#grid_wrapper_search_products_grid .aggregator-product-loader').hide(); jQuery('#uni4ol_grid_pagination').show(); jQuery('#grid_wrapper_search_products_grid .grid-content').show(); jQuery('#grid_wrapper_search_products_grid .grid-content').html(grid); }, createGridCard: function(gridName, product) { return `
${this.createProductCard(gridName, product)}
`; }, createProductCard: function(gridName, product) { var accreditedImgTokenEl = ''; var certifiedImgTokenEl = ''; var endorsedImgTokenEl = ''; if (!isEmpty(product.courseType) && product.courseType == 'fq') { if (product.isAccredited) { accreditedImgTokenEl = ``; } if (product.isCertified) { certifiedImgTokenEl = ``; } if (product.isEndorsed) { endorsedImgTokenEl = ``; } } else if (!isEmpty(product.courseType) && product.courseType == 'slp') { if (product.isAccredited) { accreditedImgTokenEl = ``; } if (product.isCertified) { certifiedImgTokenEl = ``; } if (product.isEndorsed) { endorsedImgTokenEl = ``; } } let productSaleBadge = ''; let productPromotionBadge = ''; if (product.isOnSale) { productSaleBadge = 'Sale'; } if (product.isOnPromotion) { productPromotionBadge = 'Promotion'; } return `
${accreditedImgTokenEl} ${certifiedImgTokenEl} ${endorsedImgTokenEl}
${productSaleBadge} ${productPromotionBadge}
${this.renderSubtitleSection(product)}
`; }, renderSubtitleSection: function(product) { let brandLogoTag = `` let brandLogoSection = product.brandLogoDark ? `
${brandLogoTag}
` : ''; let subtitleSection = product.subtitle ? `
${product.subtitle}
` : ''; return `
${product.title}
${subtitleSection}
${brandLogoSection}`; }, handleFilterPills: function(value) { $gridNetworkProductRequest_search_products_grid.redirectTo = value; this.fetchData($gridNetworkProductRequest_search_products_grid, processGridProducts_search_products_grid); }, handleFilterAcademicPartner: function(value) { if (value == 'all') { $gridNetworkProductRequest_search_products_grid.academicPartner = ''; this.fetchData($gridNetworkProductRequest_search_products_grid, processGridProducts_search_products_grid) return; } $gridNetworkProductRequest_search_products_grid.academicPartner = value; this.fetchData($gridNetworkProductRequest_search_products_grid, processGridProducts_search_products_grid); }, handleCourseFilter: function(value) { let searchValue = value; let isAlreadyActive = jQuery(`.uni4ol_redirect[value='${searchValue}']`).hasClass('active'); // Remove all active classes jQuery('.clearButton button.active').removeClass('active'); jQuery('.uni4ol_redirect').removeClass('active'); if(isAlreadyActive == false){ jQuery('.uni4ol_redirect[value="'+value+'"]').addClass('active'); } else if(isAlreadyActive == true){ jQuery('.uni4ol_redirect[value="'+value+'"]').removeClass('active'); jQuery('.clearButton button').addClass('active'); searchValue = "all"; } // Show circle notification let activePill = jQuery('.uni4ol_redirect.active'); if(activePill.length > 0){ if(jQuery('.uni4ol_circleNotification').hasClass('d-none')){ jQuery('.uni4ol_circleNotification').removeClass('d-none'); jQuery('.uni4ol_circleNotification').addClass('d-block'); } }else if(activePill.length < 0){ jQuery('.uni4ol_circleNotification').removeClass('d-block'); jQuery('.uni4ol_circleNotification').addClass('d-none'); } searchValue = value.replace(/\s+/g, "-").toLowerCase(); // current categories $gridNetworkProductRequest_search_products_grid.categories = []; let activeCategory = jQuery('.category-filter.active'); if(activeCategory.length > 0){ $gridNetworkProductRequest_search_products_grid.categories.push(activeCategory.val()); }else{ defineSupportedCategories(); } $gridNetworkProductRequest_search_products_grid.pageNumber = 0; if (searchValue == 'all' || isAlreadyActive) { // Need to send all as redirectFilter on ajax jQuery('.clearButton button').addClass('active'); jQuery(`.uni4ol_redirect`).removeClass('active'); if(jQuery('.uni4ol_circleNotification').hasClass('d-block')){ jQuery('.uni4ol_circleNotification').removeClass('d-block'); jQuery('.uni4ol_circleNotification').addClass('d-none'); } defineSupportedCategories(); // this.fetchData($gridNetworkProductRequest_search_products_grid, processGridProducts_search_products_grid); this.handleFilterPills('none'); return; } this.handleFilterPills(searchValue); }, handleFilterCategory: function(value) { let catValue = value; let isAlreadyActive = jQuery(`.category-filter[value='${catValue}']`).hasClass('active'); $gridNetworkProductRequest_search_products_grid.categories = []; $gridNetworkProductRequest_search_products_grid.pageNumber = 0; jQuery(`.category-filter`).removeClass('active'); if (catValue == 'all' || isAlreadyActive) { if(jQuery('.uni4ol_circleNotification').hasClass('d-block')){ jQuery('.uni4ol_circleNotification').removeClass('d-block'); jQuery('.uni4ol_circleNotification').addClass('d-none'); } defineSupportedCategories(); this.fetchData($gridNetworkProductRequest_search_products_grid, processGridProducts_search_products_grid); return; } jQuery(`.category-filter[value='${catValue}']`).addClass('active'); // Show circle notification let activePill = jQuery('.category-filter.active'); if(activePill.length > 0){ if(jQuery('.uni4ol_circleNotification').hasClass('d-none')){ jQuery('.uni4ol_circleNotification').removeClass('d-none'); jQuery('.uni4ol_circleNotification').addClass('d-block'); } }else if(activePill.length <= 0){ jQuery('.uni4ol_circleNotification').removeClass('d-block'); jQuery('.uni4ol_circleNotification').addClass('d-none'); } $gridNetworkProductRequest_search_products_grid.categories.push(catValue); this.fetchData($gridNetworkProductRequest_search_products_grid, processGridProducts_search_products_grid); }, handleSearch: function(searchTerm = '') { clearTimeout($gridNetworkProductRequest_search_products_grid.searchTimeout); let searchString = document.getElementById("searchBox").value; if (searchTerm && searchTerm.trim()) { searchString = searchTerm; document.getElementById("searchBox").value = searchString; } $gridNetworkProductRequest_search_products_grid.pageNumber = 0; if (!searchString || !searchString.trim()) { $productGrid_search_products_grid.handleClearSearch(); return; } $gridNetworkProductRequest_search_products_grid.search = searchString; $gridNetworkProductRequest_search_products_grid.searchTimeout = setTimeout(() => { jQuery('#clearSearchButton ').show(); this.fetchData($gridNetworkProductRequest_search_products_grid, processGridProducts_search_products_grid); }, 1000); }, handleClearSearch: function() { jQuery('#clearSearchButton ').hide(); document.getElementById("searchBox").value = ""; $gridNetworkProductRequest_search_products_grid.search = ''; $gridNetworkProductRequest_search_products_grid.pageNumber = 0; this.fetchData($gridNetworkProductRequest_search_products_grid, processGridProducts_search_products_grid); }, handleSort: function(value) { let sortValue = value; if (sortValue == 'title_asc') { $gridNetworkProductRequest_search_products_grid.sort = 'title_asc'; this.fetchData($gridNetworkProductRequest_search_products_grid, processGridProducts_search_products_grid); return; } $gridNetworkProductRequest_search_products_grid.sort = sortValue; this.fetchData($gridNetworkProductRequest_search_products_grid, processGridProducts_search_products_grid); }, fetchData: function(request, successCallBack) { this.getProducts(request, successCallBack); }, handleProductFocus_search_products_grid: function(productElement) { let selectedProductId = jQuery(productElement).data('productid'); let selectedProductTenant = jQuery(productElement).data('tenantshortcode'); $productModal.functions.Open(productElement, selectedProductId, selectedProductTenant); }, handleProductUnfocus_search_products_grid: function(productElement) { $productModal.functions.ResetTimers(); $productModal.functions.ResetProduct(); }, updateUtmUrlParam: function(el, utmTermToRemove) { el.remove(); // Remove the filter user closed utmParams = utmParams.filter(item => item !== utmTermToRemove); $gridNetworkProductRequest_search_products_grid.utmParams = utmParams; // Make the ajax call $productGrid_search_products_grid.getProducts($gridNetworkProductRequest_search_products_grid, processGridProducts_search_products_grid); }, getProducts: function(networkRequest, successCallBack) { jQuery.ajax(ajaxurl, { type: 'POST', data: { action: $gridNetworkProductRequest_search_products_grid.action, productCategories: $gridNetworkProductRequest_search_products_grid.categories, tenant: $gridNetworkProductRequest_search_products_grid.tenant, academicPartner: $gridNetworkProductRequest_search_products_grid.academicPartner, pageSize: $gridNetworkProductRequest_search_products_grid.pageSize, pageNumber: $gridNetworkProductRequest_search_products_grid.pageNumber, search: $gridNetworkProductRequest_search_products_grid.search, sort: $gridNetworkProductRequest_search_products_grid.sort, redirectTo: $gridNetworkProductRequest_search_products_grid.redirectTo, filters: $gridNetworkProductRequest_search_products_grid.filters, filterType: $gridNetworkProductRequest_search_products_grid.filterType, utmParams: $gridNetworkProductRequest_search_products_grid.utmParams, }, dataType: 'json', timeout: 60000, beforeSend: function() { // Before we send the request, display the loading template. jQuery('#grid_wrapper_search_products_grid .aggregator-product-loader').show(); jQuery('#grid_wrapper_search_products_grid .grid-content').hide(); jQuery('#uni4ol_grid_pagination').hide(); }, success: function(response) { if (response.success) { response.data.categoryFilters = networkRequest.categories; successCallBack(response.data); // Pagination fix for mobile optimizePaginationLinks(); } else { console.warn(`Unable to get products`); } }, error: function(xhr, ajaxOptions, thrownError) { console.error(thrownError); } }) } }; var $gridNetworkProductRequest_search_products_grid = { action: 'uni4ol_ajax_get_product_summary', categories: [], searchTimeout: null, tenant: 'lmo', academicPartner: 'lyceum', pageSize: 8, pageNumber: 0, sort: 'title_asc', search: '', redirectTo: 'none', filters: [], filterType: 'qualificationtypes', utmParams: utmParams }; function defineSupportedCategories() { $gridNetworkProductRequest_search_products_grid.categories.push('digital-marketing'); $gridNetworkProductRequest_search_products_grid.categories.push('business-management'); $gridNetworkProductRequest_search_products_grid.categories.push('data-sciences'); $gridNetworkProductRequest_search_products_grid.categories.push('education'); $gridNetworkProductRequest_search_products_grid.categories.push('finance'); $gridNetworkProductRequest_search_products_grid.categories.push('human-resources'); $gridNetworkProductRequest_search_products_grid.categories.push('information-technology'); $gridNetworkProductRequest_search_products_grid.categories.push('marketing'); } defineSupportedCategories(); processGridProducts_search_products_grid = function(response) { $productGrid_search_products_grid.initialiseProductsData(response); // Scroll to filter section if utm params exist let utmParameters = ''; if(!isEmpty(utmParameters)){ var selectedLocation = jQuery('.uni4ol_searchAllProductsBarContainer'); var container = jQuery('html, body'); container.animate({ scrollTop: selectedLocation.offset().top - 20 }, { duration: 2000 }); } } if (urlFilter.length > 0) { $productGrid_search_products_grid.handleFilterCategory(urlFilter); } else { $productGrid_search_products_grid.getProducts($gridNetworkProductRequest_search_products_grid, processGridProducts_search_products_grid); } // redirect filter // jQuery(".uni4ol_redirect").on('click', function() { // // let redirectTo = jQuery(this).data('redirect'); // // let url = `/${redirectTo}`; // // window.location.href = url; // handleCourseFilter(); // }); jQuery("#searchBox").on('keyup paste propertychange', function(e) { let searchTerm = ''; if (e.type == 'paste') { searchTerm = e.originalEvent.clipboardData.getData('text'); e.preventDefault(); } $productGrid_search_products_grid.handleSearch(searchTerm); }); let $redirectPillSlide = new Splide('#partner-filter-slide', { perPage: 1, perMove: 1, rewind: true, trimSpace: true, autoWidth: true }).mount(); // if (filterType != 'none') { // debugger // const lisRedirect = [...document.querySelectorAll('#partner-filter-slide .uni4ol_redirect')]; // lisRedirect.forEach((li) => { // if (li.classList.contains('active')) { // const index = lisRedirect.indexOf(li); // $redirectPillSlide.go(index); // } // }); // } let $categoryPillSlide = new Splide('#category-filter-slide', { perPage: 1, perMove: 1, rewind: true, trimSpace: true, autoWidth: true, breakpoints: { 640: { fixedWidth: '270px', trimSpace: false, perPage: 1, perMove: 1, } } }).mount(); if (urlFilter.length > 0) { const lisFilter = [...document.querySelectorAll('#category-filter-slide .uni4ol_redirect')]; lisFilter.forEach((li) => { if (li.classList.contains('active')) { const index = lisFilter.indexOf(li); $filterPillSlide.go(index); } }); } function sortValues(sortVal, sortRel) { let sortBy = sortVal; let sortByVal = sortRel; // Set local storage to update the filter btn text localStorage.removeItem("sortValue"); localStorage.setItem("sortValue", sortBy); // Update UI sort block jQuery('#sortGridSelect .uni4ol_sortDisplayP').text(sortBy); // Fire the ajax call $productGrid_search_products_grid.handleSort(sortByVal); } function openCloseDropDown() { if (jQuery('.uni4ol_sortDropdown').hasClass('d-none')) { jQuery('.uni4ol_Overlay').removeClass('d-none'); jQuery('.uni4ol_Overlay').addClass('d-block'); jQuery('.uni4ol_sortDropdown').removeClass('d-none'); jQuery('.uni4ol_sortDropdown').addClass('d-block'); } else { jQuery('.uni4ol_Overlay').removeClass('d-block'); jQuery('.uni4ol_Overlay').addClass('d-none'); jQuery('.uni4ol_sortDropdown').removeClass('d-block'); jQuery('.uni4ol_sortDropdown').addClass('d-none'); } } function optimizePaginationLinks() { if (jQuery(window).width() < 600) { const act = jQuery(".pagination .page-item.active").index(); let lastEl = jQuery(".pagination .page-item").eq(-2).text(); jQuery(".pagination .page-item").hide(); jQuery(".pagination .page-item.active").each(function() { if (jQuery(this).text() != '1') { jQuery(this).before('...'); } jQuery(this).show(); if (jQuery(this).text() != lastEl) { jQuery(this).after('...'); } }); jQuery(".pagination .page-item:first").show(); jQuery(".pagination .page-item:last").show(); } } function toggleArrowIcon(){ const arrowIcon = jQuery('i.uni4ol_filtersAllProductsDarkGrey'); if(arrowIcon.hasClass('fa-chevron-down')){ arrowIcon.removeClass('fa-chevron-down'); arrowIcon.addClass('fa-chevron-up'); }else{ arrowIcon.removeClass('fa-chevron-up'); arrowIcon.addClass('fa-chevron-down'); } } function ucwords (str) { return (str + '').replace(/^([a-z])|\s+([a-z])/g, function ($1) { return $1.toUpperCase(); }); } jQuery(document).ready(function(){ if(localStorage.getItem("sortValue") != null){ localStorage.removeItem("sortValue"); } if(jQuery('.uni4ol_circleNotification').hasClass('d-block')){ jQuery('.uni4ol_circleNotification').removeClass('d-block'); jQuery('.uni4ol_circleNotification').addClass('d-none'); } });
Our Top Programmes
See what’s popular
`; }, createProductCard: function(slideName, product) { let productSaleBadge = ''; let productPromotionBadge = ''; var accreditedImgTokenEl = ''; var certifiedImgTokenEl = ''; var endorsedImgTokenEl = ''; if (!isEmpty(product.courseType) && product.courseType == 'fq') { if (product.isAccredited) { accreditedImgTokenEl = ``; } if (product.isCertified) { certifiedImgTokenEl = ``; } if (product.isEndorsed) { endorsedImgTokenEl = ``; } } else if (!isEmpty(product.courseType) && product.courseType == 'slp') { if (product.isAccredited) { accreditedImgTokenEl = ``; } if (product.isCertified) { certifiedImgTokenEl = ``; } if (product.isEndorsed) { endorsedImgTokenEl = ``; } } if (product.isOnSale) { productSaleBadge = 'Sale'; } if (product.isOnPromotion) { productPromotionBadge = 'Promotion'; } return `
${accreditedImgTokenEl} ${certifiedImgTokenEl} ${endorsedImgTokenEl}
${productSaleBadge} ${productPromotionBadge}
${this.renderSubtitleSection(product)}
`; }, renderSubtitleSection: function(product) { let brandLogoTag = `` let brandLogoSection = product.brandLogoDark ? `
${brandLogoTag}
` : ''; let subtitleSection = product.subtitle ? `
${product.subtitle}
` : ''; return `
${product.title}
${subtitleSection}
${brandLogoSection}`; }, intitialiseSlide: function(slideName) { var $slidetop_courses = new Splide(`#card-slider-${slideName}`, { perPage: 5, perMove: 5, gap: '0.5em', padding: { left: '2rem', right: '2rem', }, breakpoints: { 1440: { perPage: 4, perMove: 4, }, 1200: { perPage: 3, perMove: 3, }, 991: { perPage: 2, perMove: 2, }, 640: { fixedWidth: '270px', trimSpace: false, focus: 'center', perPage: 1, perMove: 1, } } }).mount(); }, initialiseProductsData: function(response) { this.createSlide('top_courses', response.data); }, handleProductFocus_top_courses: function(productElement) { let selectedProductId = jQuery(productElement).data('productid'); let selectedProductTenant = jQuery(productElement).data('tenantshortcode'); $productModal.functions.Open(productElement, selectedProductId, selectedProductTenant); }, handleProductUnfocus_top_courses: function(productElement) { $productModal.functions.ResetTimers(); $productModal.functions.ResetProduct(); }, getProducts: function(successCallBack) { var requestData = { action: 'uni4ol_ajax_get_product_summary', productCategories: [], tenant: 'lmo', academicPartner: '', cross_selling_products_ids: [], pageSize: 100 }; requestData.productCategories.push('featured'); jQuery.ajax(ajaxurl, { type: 'POST', data: requestData, timeout: 600000, dataType: 'json', beforeSend: function() { // Before we send the request, display the loading template. // jQuery('body.page-template .uni4ol_courseCategoryBackground .splide').addClass('show-loader'); }, success: function(response) { if (response.success) { successCallBack(response.data); // removing loader class from parent element to hide the card preloader setTimeout(() => { jQuery('body.page-template .uni4ol_courseCategoryBackground .splide').removeClass('show-loader'); }, 2000); } else { console.warn(`Unable to get products`); } }, error: function(xhr, ajaxOptions, thrownError) { console.error(thrownError); } }) } }; jQuery(document).ready(function() { processSlideProducts_top_courses = function(response) { $productSlidetop_courses.initialiseProductsData(response); } $productSlidetop_courses.getProducts(processSlideProducts_top_courses); });