Bug: Bootstrap code specifying single location showing services in the dropdown that aren't offered at that location.

Support forumBug: Bootstrap code specifying single location showing services in the dropdown that aren't offered at that location.
pamelapar asked 6 years ago
<p>Ok, this must be a bug, then, because I have two locations and two different workers, but when I implement the shortcode specifying one location and one worker, it is showing the services from both locations. <br />   Here’s the connections set up: <br />   <img src="https://libertyhilltx.org/wp-content/uploads/2017-11-04_10-09-07.png" alt="" /><br />   And the shortcode: <br />   <img src="https://libertyhilltx.org/wp-content/uploads/2017-11-04_10-32-05.png" alt="" width="481" height="25" /><br />   &nbsp;<br />   And here’s what I see on the front end: <br />   <img src="https://libertyhilltx.org/wp-content/uploads/2017-11-04_10-31-26.png" /><br />   Shouldn’t I only see the services associated with that location? I’m just testing right now, hence the generic names of things. </p>   </div>       <div class="dwqa-comments">   <div class="dwqa-comments-list">       <div class="dwqa-comment">   <div class="dwqa-comment-meta">   <a href="https://easy-appointments.net/support-forum/?user=pamelapar"><img alt='' src='https://secure.gravatar.com/avatar/ae39998dbecdb65d8a33dc2a322ac6ba?s=16&d=mm&r=g' srcset='https://secure.gravatar.com/avatar/ae39998dbecdb65d8a33dc2a322ac6ba?s=32&amp;d=mm&amp;r=g 2x' class='avatar avatar-16 photo' height='16' width='16' />pamelapar</a>   replied 1 week ago <div class="dwqa-comment-actions">   </div>   </div>   <p>And, to be clear, if this locations functionality was working, I wouldn’t need to specify multiple services in the shortcode. </p>   </div>
Start your code here
pamelapar replied 6 years ago

sorry for the crappy formatting. I’d asked this in another thread but it wasn’t answered so was trying to copy my content over to this new one.

4 Answers
pamelapar answered 6 years ago
Trying again...  Ok, this must be a bug, then, because I have two locations and two different workers, but when I implement the shortcode specifying one location and one worker, it is showing the services from both locations.   Here’s the connections set up:   
 
And the shortcode:     
And here’s what I see on the front end:   
 
Shouldn’t I only see the services associated with that location? I’m just testing right now, hence the generic names of things.   
Nikola Loncar Staff answered 6 years ago
Hi, it is a bug. It will be fixed in new version. Best regards, Nikola
exoticnik answered 6 years ago
I have exactly the same problem. But looking into the code it is the SQL statement that is incorrect. In the dbmodels.php file on line 473 the statement is getting all services that match the service id. Which is all off them compared to the services table ID. I have played around with it and the correct SQL statement should be... $query  = "SELECT DISTINCT s.* FROM {$table} s INNER JOIN $connections c ON c.worker = {$worker} WHERE s.id in ({$service_id})"; I tested it and set the $service_id with  multiple service numbers that matched my services and it worked fine. Not sure though if this SQL statement is used in other areas of the site. So will leave it up to Nikola to fix. This allows for multiple services which is in the bootstrap short code. E.g worker = 1 services = 2,5 location = 1 and so on. Did know how to get the shortcode variables though, that was where my php coding experience stopped. Anyways I hope this helps with speeding up the solution.  
Nikola Loncar Staff answered 6 years ago
Hi, new version is live so you can update. You should not have that issue any more. Best regards, Nikola
exoticnik replied 6 years ago

Thanks Nikola for the quick update. But it appears it still isn’t working correctly. The services attribute in the shortcode is not being implemented in the statement. So regardless of adding the services as service=”23,24″ it doesn’t add them to the sql query so it just displays all the services for that worker and location. The correct SQL statement is
SELECT DISTINCT s.* FROM {$table} s INNER JOIN $connections c ON c.is_working=1 AND c.location=1 AND c.worker=1 WHERE s.id IN($service_id) I have updated my code so it now works on my site. But I think you still need to update the code so that the services can be used per page or booking form.