TourCMS community

For users of the TourCMS tour operator ecommerce platform

Hi everybody,

we are developing a Joomla module to search TourCMS products, and we can't find where is possible to get the list of Categories and Groups (product filter) from API, in order to compose automatically the query string.

Can someone help me? If not clear, please contact us at serviziweb@partnersolution.it

Thank you!

Views: 199

Reply to This

Replies to This Discussion

Hi Francesco

I know we talked about this in the support

a) Tour show API has categories

b) Tour search API has search by categories

However what is obviously missing is a development that lets you know what the categories are in the first instance. Normally, for certain sites, this is not an issue - as the designer can build the dropdown themselves, manually.

However yes if you are building a module - you need this data systematically via API.

Let me see what we can do

Once you have your module sorted - shout - and we can promote it

Hi Alex, this is a great news! We plan to finish the module before the end of the year, probably even before WTM. I'll keep you informed. Thank you!

Hi, Francesco,

I've been using this function to grab all tour categories. Note that if takes a VERY long time to process, so you should probably run it as a cron job and then cache it.

public function get_categories() {
  $tourcms = new TourCMS(0, SiteConfig::get("api_private_key"), "simplexml");
  $channel_id = SiteConfig::get("channel_id");

  $categories = array();
  $results = $tourcms->search_tours('', $channel_id);
  if ($results->error == 'OK') {
    foreach ($results->tour as $tour) {
      $t = $tourcms->show_tour((int) $tour->tour_id, $channel_id);
      $groups = $t->tour->categories;

      foreach ($groups->group as $group) {
        $values = $group->values->value;
        $parser = xml_parser_create();
        xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
        $cats = $group->values->asXML();

         xml_parse_into_struct($parser, $cats, $values);
         xml_parser_free($parser);
         foreach ($values as $value) {
           if ($value['type'] == 'complete') {
             $categories[] = $value['value'];
           }
         }
       }
     }
   }
   return array_unique($categories);
}

Thank you very much Kellan, this is a good workaround...but the best should be an API method to get categories and active products for each category (this one, just to permit to decide if show or not categories without products).

Probably we will start with a solution like the one you suggested, waiting for the API implementation!

Thank you again

Francesco

Working on an API implementation

The above I think would be a bit slow in practice (show tour is fast enough cached, called once, i.e. if building a single tour page on a website, but calling many of them, would be slow)

There is a new product filter API that should handle this question from a few years back

RSS

© 2017   Created by TourCMS team.   Powered by

Badges  |  Report an Issue  |  Terms of Service