Include two or more different services in a shortcode?

SupportInclude two or more different services in a shortcode?
exoticnik Staff asked 7 years ago
I don't think the service in the shortcode really does anything. Example below. I have 3 pages, Page1, Page2 and page3. One worker and one location. I have set up 6 services. On Page1 I want to show services1 and services2 from the drop down services menu. On Page2 I want to show services3 and services4 and on Page3 show services5 and services6. But on all three pages show all the services for that worker. Regardless of the service code inserted or not in the short code. So examples of shortcode below. Page1 [ea_bootstrap worker="1" location="1" service="1,2" width="800px" scroll_off="true" layout_cols="2"] Page2 [ea_bootstrap worker="1" location="1" service="3,4" width="800px" scroll_off="true" layout_cols="2"] Page3 [ea_bootstrap worker="1" location="1" service="5,6" width="800px" scroll_off="true" layout_cols="2"] Is the shortcode above correct syntax? I copied it from the support page. I have tried it with just one service e.g service="1" and it seems to make no difference.  Any help or guidance greatly appreciated. Cheers
exoticnik Staff replied 7 years ago

The shortcode was stripped from my question. Anyway to add it without it stripping?

exoticnik Staff replied 7 years ago

This must be a bug. I have tested it with different locations, workers and services. And it grabs all the services regardless of worker or location and displays them. I have added the below code with out the brackets. So for the below code I would assume that it would only show services with the ID of 6 and 7 for worker 1 and location 1. Am I correct in thinking that?
ea_bootstrap worker=”1″ location=”1″ service=”6,7″ width=”800px” scroll_off=”true” layout_cols=”2″
If I wanted to only show the services ID of 4 and 5 for worker and location 1 then I would surely just update the service attribute to service=”4,5″
And I should be able to display the booking form on different pages showing on services that I want to display for that page. e.g so on page1 you can only see from the services drop down menu services1 and services2. On page2, it should only display services3 and services4 and so on.
I look forward getting this resolved or let me know if I am doing it incorrectly.

1 Answers
exoticnik Staff answered 7 years ago
I have added some code to the dbmodels.php file. On line 484 I have replaced the whole switch statement with  case 'ea_services':
$query = "SELECT DISTINCT s.* FROM {$table} s INNER JOIN $connections c ON c.is_working=1"; if (!empty($location_id) && is_numeric($location_id)) {
$query .= ' AND c.location=' . $location_id;
} if (!empty($worker_id) && is_numeric($worker_id)) {
$query .= ' AND c.worker=' . $worker_id;
}
if (!empty($service_id)) {
$query .= ' WHERE s.id IN (' . $service_id . ')';
}   This way you can add the service attribute in the search code and it will only display those services on the booking form on a page. Hope this helps others.