Las Vegas Hotels, Casinos & Resorts

Hold up. You’re going where? In a city filled with diversions and excursions, the first question you need to answer is … where am I staying? Find the Las Vegas hotel, casino or resort that matches you − and your ambitions.

{ if (entry.isIntersecting) { const taBeacon = entry.target.querySelector(‘[data-trip-advisor]’); getTA(taBeacon); observer.unobserve(entry.target); } }); } function getTA(beacon) { if (beacon.dataset.initated === ‘true’) return; fetch(`${taAPI}${beacon.dataset.tripAdvisor}`) .then(res => { if (!res.ok) { throw new Error(`${res.status} ${res.statusText}`); } return res.json(); }) .then(data => { data = data.data; const markup = ` Tripadvisor Traveler Rating - ${data.rating} ${data.num_reviews} reviews ]]>`;

// const priceLevel = beacon.closest(‘[data-slide]’).querySelector(‘[data-price-level]’);

beacon.innerHTML = markup;
beacon.dataset.initiated = true;

// t587260 Remove pricing from hotels & restaurants
// if(data.price_level) {
// priceLevel.innerHTML = data.price_level;
// }
})
.catch(err => console.log(err));
}

slider.on(‘mount.after’, async () => {
taBeacons = Array.from(root.querySelectorAll(‘[data-trip-advisor]’));

if (!taBeacons.length) return;

// lazy-load TA info
for (let beacon of taBeacons) {
const slide = beacon.closest(‘[data-slide]’);

io.observe(slide);
}
});

slider.mount();

if (arrows?.length) {
arrows.forEach(arrow => arrow.addEventListener(‘click’, () => {
const dir = arrow.dataset.sliderArrow === ‘prev’ ? ‘<' : '>‘;

slider.go(dir);
}));
}

});

{“leo”:{“apply”:”Apply”,”clear_filters”:”Reset”,”reset”:”Reset”,”filter”:”Filter”,”sort”:”Sort”,”view”:”View”,”keyword”:”Search”,”search_placeholder”:”Keyword”,”regions”:”Where?”,”categories”:”Categories”,”property_type”:”Property Type”,”grid”:”Grid”,”list”:”List”,”map”:”Map”,”show_map”:”Show Map”,”hide_map”:”Hide Map”,”all”:”All”,”recommended”:”Featured”,”near_me”:”Near Me”,”read_more”:”More Info”,”quick_view”:”Quickview”,”featured_title”:”Partner”,”visit_website”:”Visit Website”,”email”:”E-mail”,”tollfree”:”Toll Free”,”tab_about”:”About”,”tab_map”:”Map”,”show_more”:”Show more”,”show_less”:”Show Less”,”results”:”$1 results”,”no_results”:”There are no results that match your filter.”,”miles_from_you”:”Miles from You”,”meeting_rooms”:”Meeting Rooms”,”square_feet”:”Total Sq. Ft.”,”largest_room”:”Largest Room”,”sleeping_rooms”:”Sleeping Rooms”,”banquet”:”Banquet Capacity”,”reception”:”Reception Capacity”,”theatre”:”Theater Capacity”,”classroom”:”Classroom Capacity”,”compare”:”Compare”,”close_compare_dropdown”:”Close compare dropdown”,”compare_add”:”Add to compare”,”compare_remove”:”Remove from compare”,”compare_clear_all”:”Clear All”,”compare_limit_message”:”You can only compare four (4) items at a time”,”location”:”Location”,”locations”:”Locations”,”details”:”Details”,”address”:”Address”,”err_loc_timeout”:”We’re unable to determine your location at this time.”,”err_loc_blocked”:”You must allow location access for distance sorting.”,”err_loc_radius”:”You must be within $1 miles to sort by distance.”,”date_range_title”:”Show Events For”,”date_range_day”:”Day”,”date_range_week”:”Week”,”date_range_weekend”:”Weekend”,”date_range_month”:”Month”,”date_range_year”:”Year”,”date_range_selected_dates”:”Selected Dates”,”per_page_label”:”Items Per Page”,”tb_add”:”Add to Trip”,”tb_remove”:”Remove from Trip”,”tb_view”:”View Trip”,”facilities”:”Facilities”,”download”:”Download Events as CSV”,”convention”:”Convention”,”venues”:”Venues”,”dates”:”Dates”,”attendance”:”Attendance”,”whats_nearby”:”What’s Nearby”,”attractions”:”Attractions”,”dining”:”Dining”,”accommodations”:”Accommodations”,”events”:”Events”,”things_to_do”:”Things To Do”,”get_directions”:”Get Directions”,”redo_search_in_map”:”Redo Search in Map”,”add_to_calendar”:”Add to Calendar”,”add_to_google_calendar”:”Add to Google Calendar”,”add_to_microsoft_calendar”:”Add to Microsoft Live Calendar”,”add_to_outlook_calendar”:”Add to Office365 Outlook Calendar”,”add_to_iCloud_calendar”:”Add to iCloud Calendar”,”add_to_windows_calendar”:”Add to Windows Calendar”,”start_date”:”Start Date”,”end_date”:”End Date”,”book_now”:”Book Now”,”venue_type”:”Venue Type”,”showrooms”:”Show Rooms”,”largestshowroomcapacity”:”Largest Showroom Capacity”,”maxStanding”:”Max Standing”,”maxSeating”:”Max Seating”},”listings”:{“clear_filters”:”Clear Filters”,”amenities”:”Amenities”,”tab_amenities”:”Amenities”,”tab_view_all_amenities”:”View All Amenities”,”tab_meeting_facilities”:”Meeting Facilities”,”tab_offers”:”Offers”,”tab_events”:”Events”,”tab_hours”:”Hours”,”tab_tripadvisor”:”TripAdvisor”,”tab_yelp”:”Yelp”,”yelp_closed”:”Closed”,”tab_social_feeds”:”Social Feeds”,”facility_info”:”Facility Info”,”meeting_rooms”:”Meeting Rooms”,”m_exhibits_space”:”Exhibits Space”,”m_description”:”Description”,”m_exhibits”:”Exhibits”,”m_floorplan_file”:”Floorplan File”,”m_largest_room”:”Largest Room”,”m_toll_free”:”Toll Free”,”m_total_sq_ft”:”Total Sq. Ft.”,”m_reception_capacity”:”Reception Capacity”,”m_space_notes”:”Space Notes”,”m_theater_capacity”:”Theater Capacity”,”m_link”:”Link”,”m_villas”:”Villas”,”m_banquet_capacity”:”Banquet Capacity”,”m_number_of_rooms”:”Number of Rooms”,”m_booths”:”Booths”,”m_large_floor_plan_pdf”:”Large floor Plan PDF”,”m_suites”:”Suites”,”m_classroom_capacity”:”Classroom Capacity”,”m_sleeping_rooms”:”Sleeping Rooms”,”m_width”:”Width”,”m_length”:”Length”,”m_height”:”Height”,”m_booth_capacity”:”Booth Capacity”,”m_amphitheater_present”:”Amphitheater Present”,”m_listening_devices_present”:”Listening Devices Present”}}

{{#data}} {{:rating_image_url}}

Tripadvisor Traveler Rating

{{/}} {{/data}} require([ “jquery”, “plugins_core/main”, “sv_site”, “sv_crmLib”, “sv_cloudinaryLib”, “sv_asyncLib”, “sv_clientMoment”, “sv_arrayLib”, “sv_load!plugins_dtn”, “plugins_common_custom_layoutjs”, “plugins_common_custom_lazyload”, “sv_load!site_gamClient”, “plugins_common_custom_ui_watcher”, “sv_clientLib”, “plugins_common_custom_utils”, “plugins_common_custom_leo_helpers”, “sv_goatee!” ], function( $, core, site, crmLib, sv_cloudinaryLib, asyncLib, clientMoment, arrayLib, dtn, layoutjs, lazyload, gamClient, UIWatcher, clientLib, utils, leoHelpers, goatee ) { var widget = {“template”:”list”,”showSearchBox”:”true”,”listingcats”:”261″,”region”:”13″,”amenityoptions”:”none”,”custom_defaultView”:”grid”,”custom_map_defaults_open”:”false”,”custom_hide_regions”:”false”,”custom_randomize”:”false”,”custom_items_per_page”:”24″,”custom_showListingFilters”:”true”,”custom_showListingPaging”:”true”,”custom_hideLocationsFilter”:”false”,”region_array”:[“13″,”1″,”4″,”233″,”8″,”217″,”232″,”6″,”7″,”231″,”234″,”9″,”10″,”2″,”11″,”12”]}; var useGroupedCats = false; var groupedCats = [{“label”:”Attractions & Activities”,”value”:”151″},{“label”:”Dining”,”value”:”152″},{“label”:”Golf”,”value”:”153″},{“label”:”Lodging”,”value”:”154″},{“label”:”Entertainment & Shows”,”value”:”155″},{“label”:”Tours”,”value”:”157″},{“label”:”Transportation”,”value”:”158″},{“label”:”Weddings”,”value”:”159″},{“label”:”Commissionable Cats”,”value”:”160″},{“label”:”Hotel Meeting Facilities”,”value”:”177″},{“label”:”Convention Services”,”value”:”181″},{“label”:”Transportation”,”value”:”185″},{“label”:”Casino”,”value”:”189″},{“label”:”Convention Facilities”,”value”:”190″},{“label”:”Specialty Dining”,”value”:”191″},{“label”:”Sports Facilities”,”value”:”193″},{“label”:”Other Meeting Facilities”,”value”:”195″},{“label”:”Showrooms and Theaters”,”value”:”197″},{“label”:”What’s Your Event?”,”value”:”199″},{“label”:”Group Programs”,”value”:”201″},{“label”:”Accommodations”,”value”:”239″},{“label”:”Restaurants”,”value”:”240″},{“label”:”Things to Do”,”value”:”241″},{“label”:”Accommodations”,”value”:”261″,”options”:[{“label”:”Casino Resort”,”value”:”1086″},{“label”:”Extended Stay”,”value”:”1087″},{“label”:”Motel/Inn”,”value”:”1053″},{“label”:”Non-Gaming Hotel”,”value”:”1088″},{“label”:”Resort/Hotel”,”value”:”1054″},{“label”:”RV Parks And Campgrounds”,”value”:”1166″},{“label”:”Timeshare”,”value”:”1055″}]},{“label”:”Restaurants”,”value”:”262″},{“label”:”Attractions & Activities”,”value”:”263″},{“label”:”Transportation”,”value”:”269″},{“label”:”Event Venues”,”value”:”277″},{“label”:”Nearby hotels”,”value”:”279″},{“label”:”Accommodations”,”value”:”281″},{“label”:”Restaurants”,”value”:”282″},{“label”:”Attractions & Activities”,”value”:”283″},{“label”:”Sports & Recreation”,”value”:”284″},{“label”:”Transportation”,”value”:”288″},{“label”:”Weddings”,”value”:”289″},{“label”:”Gaming & Nightlife”,”value”:”290″},{“label”:”Mesquite Meeting Space”,”value”:”291″},{“label”:”Accommodations”,”value”:”292″},{“label”:”Restaurants”,”value”:”293″},{“label”:”Attractions & Activities”,”value”:”294″},{“label”:”Sports & Recreation”,”value”:”295″},{“label”:”RV Parks And Campgrounds”,”value”:”296″},{“label”:”Shopping”,”value”:”297″},{“label”:”Sightseeing And Tours”,”value”:”298″},{“label”:”Transportation”,”value”:”299″},{“label”:”Weddings”,”value”:”300″},{“label”:”Casino”,”value”:”301″},{“label”:”Laughlin Event Space”,”value”:”302″},{“label”:”Sports Venues”,”value”:”303″}]; var subcats = [{“label”:”Casino Resort”,”value”:”1086″},{“label”:”Extended Stay”,”value”:”1087″},{“label”:”Motel/Inn”,”value”:”1053″},{“label”:”Non-Gaming Hotel”,”value”:”1088″},{“label”:”Resort/Hotel”,”value”:”1054″},{“label”:”RV Parks And Campgrounds”,”value”:”1166″},{“label”:”Timeshare”,”value”:”1055″}]; var regions = leoHelpers.getRegionGroups(); var subcatsChosen = false; var specificListingsChosen = false; var hasMapDefault = false; var showRegionsFilter = true; let regionsArray = []; var amenities = []; var hasPrimaryCat = true; var initialAmenities = (widget !== undefined && widget.custom_amenities_filter !== undefined) ? widget.custom_amenities_filter : undefined; var initialRegions = (widget !== undefined && widget.region_array !== undefined) ? widget.region_array : undefined; var dtnargs = {“auid”:”/214662569/dtn_featured_listings”,”limit”:10,”sort”:”random”}; var hasDtn = (dtnargs.auid !== undefined && dtnargs.auid.length > 0 && dtnargs.limit > 0 && dtn !== undefined); var limit = widget.custom_items_per_page !== undefined && site?.siteConfig?.custom?.[site.site].listings?.enablePaginationCountControl ? Number(widget.custom_items_per_page) : site?.siteConfig?.custom?.[site.site].listings?.paginationCountDefault; var defaultHooks = []; var listingCat = parseInt(widget.listingcats); var isCommissionable = (listingCat === 160); var defaultView = widget.custom_defaultView !== undefined ? widget.custom_defaultView : “grid”; var randomizeListings = widget.custom_randomize !== undefined && widget.custom_randomize === “true”; const translations = JSON.parse(document.querySelector(‘#translations_6f5f594d-ddd0-48c3-9e2c-44d5fa60d5ad’).innerHTML); const taTemplate = document.querySelector(‘[data-sv-tripadvisorTemplate]’).innerHTML; let abortController; if (widget.detail_type !== undefined) { defaultHooks.push({ name : “afterFind_custom_detail_type”, args : { detail_type : widget.detail_type } }); } if (widget.dtnlimit) { // if a limit is specified in the widget, override that passed in config dtnargs.limit = Number(widget.dtnlimit); } if (hasDtn) { // we want the smaller of the limit and dtnargs.limit dtnargs.limit = Math.min(dtnargs.limit, limit); } var allFilterTagItems = subcats.map(function(val) { return { site : site.site, subcatid : Number(val.value) } }); // the base filter is the minimum filter applied to all queries. This is *not* the same as a “default” query, or the initial query. // this is the base. Any filter components that can be done in the UI are added to this object var baseFilter = { $and : [] } if (hasPrimaryCat) { baseFilter.$and.push({ filter_tags : { $in : crmLib.getListingFilterTags({ items : allFilterTagItems }) } }); } else { baseFilter.$and.push({ filter_tags : { $in : [‘site_’ + site.site] } }); } if (initialRegions && initialRegions.length) { const regionFilter = leoHelpers.cleanRegionFilter(initialRegions); baseFilter.$and.push({ regionid : { $in: regionFilter } }); } if (specificListingsChosen) { baseFilter.recid = { $in : widget.custom_specific_listings_ids }; } if (initialAmenities && widget.amenityoptions === “none”) { initialAmenities.forEach(function(val) { baseFilter[“amenities.” + val + “.value_raw”] = true; }); } else if (initialAmenities && widget.amenityoptions === “custom”) { initialAmenities.forEach(function(val) { let selected = amenities.some(function(amenity) { return amenity.value === val; }); if (!selected) { baseFilter[“amenities.” + val + “.value_raw”] = true; } }); } const subCatFilter = { name : “subcats”, label : translations.leo.categories, show : subcats.length > 1, type : useGroupedCats ? “twostage” : “checkbox”, typeExtra : { options : useGroupedCats ? groupedCats : subcats, countArgs : { watchFilters : [“amenities”, “regions”], unsupportedFilters : [“keyword”], field : “categories.subcatid”, unwind : “categories”, model : “plugins_listings_listings”, sort : true } }, toFilter : function(value, filter, context) { filter.$and.push({ filter_tags : { $in : crmLib.getListingFilterTags({ items : this.custom_selectedSubcatItems }) } }); return filter; } } // If “VLV Web: Accommodations” category is chosen, use property type version of subcat filter if(widget.listingcats === ‘261’) { subCatFilter.label = translations.leo.property_type; subCatFilter.type = “checkbox” subCatFilter.typeExtra.options = leoHelpers.getPropertyTypes(); } var masterFlow = new asyncLib.Flow(); masterFlow.series({ init: function(cb) { var vue = layoutjs.getVue({ rootNode : document.querySelector(‘#layoutjs_6f5f594d-ddd0-48c3-9e2c-44d5fa60d5ad’), type : “listings”, view : defaultView, limit : limit, sort : “qualityScore”, translations : translations.leo, mapOpen: hasMapDefault, // if there is a defaultImageUrl defined in client config, use it. Else it will utilize the default declared in custom_layoutjs.js fallbackImageUrl : site.siteConfig.custom && site.siteConfig.custom[site.site] && site.siteConfig.custom[site.site].defaultImageUrl, showFilter : true, baseFilter : baseFilter, // change to true in order to show the first and last page arrows pager_first_last_page_arrows: true, filters : [ { name : “keyword”, label : translations.leo.keyword, placeholder : translations.leo.search_placeholder, type : “keyword”, toFilter : function(value, filter, context) { filter.solrOptions = { keyword : value } return filter; } }, { name : “regions”, label : translations.leo.regions, // we implicitly filter on regions if they have been selected in the widget, so no reason to display a region option with 1 choice // if no regions were selected, then a region option with 1 choice is valid and therefore we pass the whole array show : showRegionsFilter, type : “checkbox”, typeExtra : { options : regions, countArgs : { watchFilters : [“subcats”, “amenities”], unsupportedFilters : [“keyword”], field : “regionid”, unwind : “regionid”, model : “plugins_listings_listings”, sort : true } }, toFilter : function(value, filter, context) { const regionFilter = leoHelpers.cleanRegionFilter(value); filter.$and.push({ regionid : { $in: regionFilter } }); return filter; } }, subCatFilter, { name : “amenities”, label : translations.listings.amenities, // we do not implicitly filter on amenities so if there is only one available option we still want to show the checkbox show : amenities.length > 0, type : “checkbox”, initialValue : initialAmenities, typeExtra : { options : amenities, countArgs : { watchFilters : [“subcats”, “regions”, “amenities”], unsupportedFilters : [“keyword”], field : “amenities_array.uniquename”, unwind : “amenities_array”, model : “plugins_listings_listings”, sort : true } }, toFilter : function(value, filter) { value.forEach(function(val) { filter[“amenities.” + val + “.value_raw”] = true; }); return filter; } } ], sortOptions : [ { value : “qualityScore”, label : (randomizeListings) ? translations.leo.recommended : translations.leo.all, tabindex : 0 }, { value : “distance”, label : translations.leo.near_me, tabindex : 0 }, { value : “pan”, label : ” , tabindex : -1 } ], limitOptions : site?.siteConfig?.custom?.[site.site].listings?.enablePaginationCountControl && site?.siteConfig?.custom?.[site.site].listings?.paginationOptions ? site.siteConfig.custom[site.site].listings.paginationOptions : [], maxRangeMiles : 100, latitude : 36.1699, longitude : -115.1398, data : { custom_catid : (widget.listingcats !== undefined) ? Number(widget.listingcats) : undefined, custom_dtnids : [] }, // computed allows the passing of computed and method properties, in cases where they may need to be unique to the template computed : { custom_selectedSubcatItems : function() { return this.filter_subcats_numberArray.map(function(val) { return { site : site.site, subcatid : val } }); }, custom_dtnFilterTagItems : function() { // if we have not chosen subcats in the widget, then we need to load via the category id // if we have chosen subcats then we utilize whatever the state of the if (this.custom_selectedSubcatItems.length > 0) { // if we have items selected in the UI, use them return this.custom_selectedSubcatItems; } else if (subcatsChosen) { // if we have items chosen in the widget, use those return allFilterTagItems; } else { // otherwise fall back to the chosen catid return [{ site : site.site, catid : this.custom_catid }]; } } }, methods : {}, watch : { docs: function() { // place logic in here that needs to happen after render of items this.$nextTick(function() { if (hasDtn) { gamClient.renderAds(); } lazyload.lazy($(this.$el).find(‘.content .item’).toArray()); }); // tripadvisor const taBeacons = Array.from(this.$el.querySelectorAll(‘[data-tripadvisor]’)); taBeacons.forEach(ta => { const item = ta.closest(‘.item’); const recid = ta.closest(‘[data-recid]’).getAttribute(‘data-recid’); const taParams = `?service=tripadvisor&recid=${recid}`; fetch(`/includes/plugins/listings/getreviews/${taParams}`) .then(res => { if (res.ok) { return res.json(); } else { throw new Error(`TripAdvisor fetch error ${res.status}: ${res.statusText}`); } }) .then(d => { const markup = goatee.fill(taTemplate, d); item.classList.add(‘has-tripadvisor’); ta.innerHTML = markup; }) .catch(err => console.error(err)); }); } }, query : function(cb) { var self = this; var filter = self.getFilter(“query”); // only show listings from primary, to avoid incorrect results and certain errors filter.primary_site = site.site; var options = { limit : self.limit, skip : self.skip, count : true, castDocs : false, fields : { recid : 1, title : 1, address1 : 1, url : 1, fullname : 1, phone : 1, fax : 1, contact_email : 1, primary_category : 1, crmtracking : 1, “listingudfs_object.18.value” : 1, “listingudfs_object.2852.value” : 1, description : 1, isDTN : 1, latitude : 1, longitude : 1, primary_image_url : 1, qualityScore : 1, weburl : 1, regionid: 1, isCommissionable: 1, hasTripAdvisor : 1, “categories.subcatid”: 1, “dtn.rank” : 1, “yelp.rating” : 1, “yelp.url” : 1, “yelp.review_count” : 1, “yelp.price” : 1 }, hooks : defaultHooks }; if (self.sort === “pan”) { options.sort = { qualityScore : -1, sortcompany : 1 }; filter[“loc.coordinates”] = { “$geoWithin”: { “$geometry”: { type: “Polygon”, coordinates: [[ [parseFloat(self.bounds.W),parseFloat(self.bounds.N)], [parseFloat(self.bounds.E),parseFloat(self.bounds.N)], [parseFloat(self.bounds.E),parseFloat(self.bounds.S)], [parseFloat(self.bounds.W),parseFloat(self.bounds.S)], [parseFloat(self.bounds.W),parseFloat(self.bounds.N)] ]] } } } } else if (self.sort === “qualityScore”) { options.sort = (randomizeListings) ? { qualityScore : -1, ‘listingudfs_object.2852.value’ : 1, sortcompany : 1 } : { qualityScore : -1, sortcompany : 1 }; } else if (self.sort === “distance”) { filter.solrOptions = filter.solrOptions || {}; filter.solrOptions.sort = “distance”; filter.solrOptions.point = [self.georesult.latitude, self.georesult.longitude].join(“,”); filter.solrOptions.radius = self.args.maxRangeMiles.toString(); } if (options.skip === 0) { // whenever the skip is 0, we reset the custom_dtnids back to scratch self.custom_dtnids = []; } var flow = new asyncLib.Flow(); flow.series({ dtn : function(cb) { if (hasDtn === false || options.skip > 0 || self.sort === “distance” || self.custom_catid === undefined || self.sort === “pan”) { return cb(null, []); } var dtnFilter = self.getFilter(“query”); dtnFilter.$and.push({ filter_tags : { $in : crmLib.getListingFilterTags({ items : self.custom_dtnFilterTagItems, dtn : true }) } }); // using 0000 and 2359 for caching purposes, otherwise we could just use Date().toISOString() var today0000 = clientMoment().startOf(“day”); // send date as 00:00:00 in the client timezone in UTC var today2359 = clientMoment().endOf(“day”); // send date as 23:59:59 in the client timezone in UTC dtnFilter.$and.push( { $or : [ { “dtn.sdate” : { $lte : { $date : today0000.toISOString() } } }, { “dtn.sdate” : { $exists : false } } ] }, { $or : [ { “dtn.edate” : { $gte : { $date : today2359.toISOString() } } }, { “dtn.edate” : { $exists : false } } ] } ); var dtnOptions = utils.extend({}, options, { // we allow DTN to oversell the first page by a factor of 2 // we will pull from this set a max of the limit limit : self.limit * 2, count : false, hooks : defaultHooks.concat(“afterFind_dtn”) }); if (abortController) { abortController.abort(); } abortController = new AbortController(); const xhr = new URL( `${window.location.protocol}//${window.location.host}/includes/rest_v2/plugins_listings_listings/find/` ); xhr.searchParams.append(‘json’, JSON.stringify({ filter : dtnFilter, options : dtnOptions })); xhr.searchParams.append(‘token’, core.simpleToken ); const fetchOptions = { method: ‘GET’, mode: ‘no-cors’, signal: abortController.signal, }; fetch(xhr, fetchOptions) .then(function(res) { return res.json() }) .then(function(res) { // randomize the result set, then trim it down to our desired limit res.docs = arrayLib.randomize(res.docs); res.docs = res.docs.splice(0, dtnargs.limit); res.docs.forEach(function(val) { self.custom_dtnids.push(val.recid); val.dtnAuid = dtnargs.auid; val.isDTN = true; }); return cb(null, res.docs); }) .catch(function(err) { if (err.name === “AbortError”) { return flow.halt({ total : 0, docs : [] }); } return cb(new Error(err)); } ); }, data : function(cb) { if (flow.data.dtn.length > 0) { // has DTN listings, need to adjust page 1 limit and store dtnids for exclusion from main query on all pages options.limit -= self.custom_dtnids.length; } else { options.skip = Math.max(0, (options.skip – self.custom_dtnids.length)); } if (self.custom_dtnids.length > 0) { filter.recid = { $nin : self.custom_dtnids } } if (self.custom_dtnids.length === self.limit && options.limit <= 0) { options.limit = 1; } if (abortController) { abortController.abort(); } abortController = new AbortController(); const xhr = new URL( `${window.location.protocol}//${window.location.host}/includes/rest_v2/plugins_listings_listings/find/` ); xhr.searchParams.append('json', JSON.stringify({ filter : filter, options : options })); xhr.searchParams.append('token', core.simpleToken ); const fetchOptions = { method: 'GET', mode: 'no-cors', signal: abortController.signal, }; fetch(xhr, fetchOptions) .then(function(res) { return res.json() }) .then(function(res) { var returnData = { total : res.docs.count + self.custom_dtnids.length, docs : flow.data.dtn.concat(res.docs.docs).slice(0, self.limit) }; returnData.docs = returnData.docs.map(function(val) { return { recid : val.recid, title : val.title, crmc : val.primary_category.catname, crmsc : val.primary_category.subcatname, ga4_cats : val.primary_category.catname + ' | ' + val.primary_category.subcatname, ga4_type: 'listings', image_url: (val.primary_image_url === undefined) ? self.args.fallbackImageUrl : val.primary_image_url, url : val.url, dtn : val.isDTN ? { auid : dtnargs.auid, rank : val.dtn.rank } : undefined, yelp : val.yelp, locations: leoHelpers.getPropertyType(val.categories) ? undefined : [{ title : val.address1 }], // sets listing location phone : val.phone, fax : val.fax, description: val.description, fullname : val.fullname, contact_email : val.contact_email, commission : (val.listingudfs_object !== undefined && val.listingudfs_object["18"] !== undefined && val.listingudfs_object["18"].value !== undefined) ? val.listingudfs_object["18"].value : "", latitude : val.latitude, longitude : val.longitude, qualityScore : val.qualityScore, isCommissionable: isCommissionable, region: leoHelpers.getRegion(val.regionid), propertyType: leoHelpers.getPropertyType(val.categories), hasTripAdvisor: val.hasTripAdvisor, button : { title : translations.leo.read_more, url : val.url, weburl : val.weburl !== undefined ? crmLib.getTrackUrl(val.crmtracking.core_listing_click, val.weburl) : undefined, weburl_title : translations.leo.visit_website } // call to action button } }); return cb(null, returnData); }) .catch(function(err) { if (err.name === "AbortError") { return flow.halt({ total : 0, docs : [] }); } return cb(new Error(err)); } ); } }, flow.cbLast(cb)); } }); /* register available UI events */ var watcher = new UIWatcher(vue, $, document); var uid = clientLib.uuid().toString(); var widgetEvents = [ "change-page", "view-change", "value-change", "sort-change", "toggle-show-more", "scroll-into-view", "item-click", "title-click", "map-pin-click", "tripbuilder" ]; for (var i=0; i
Source

ovaleditorialteam

Learn More →