SAGE settings admin page
Category page (Drupal)

1. About

API module able to create integration with the SAGE DataStream XML API (http://www.sageworld.com).

Drupal just displays products, categories etc and nothing is installed on the Drupal database from the SAGE database.

By default this module provides an admin page for several SAGE settings, some Drupal pages to display the data (see below) as also as a lot of functions to get data from the DataStream API the way you want.

2. SAGE API resources

2.1 About the DataStream XML API

http://sageworld.com/supplier/xml-datastream.php

2.2 SAGE XML API Documentation

https://www.sagemember.com/kb/kb.dll/ViewArticle?ID=10288

3. SAGE API available data (within Drupal)

There are some ready to use pages when installing this module. Of course, you need to configure the SAGE Member settings to establish a connection.

  • Single Product (drupal page)
  • Category (drupal page)
  • Search (drupal page)
  • Category list (drupal admin page)
  • Theme list (drupal admin page)
  • Supplier data (php array from SAGE XML data)
  • Supplier list (php array from SAGE XML data)

Search and Category pages provide pager with sorting options.

Notice that many functions (especially for data display) are "project specific" so you can ignore them.

4. Recommended modules

  • pathauto (used to provide better path aliases for Products and Categories).
  • devel (shows information about SAGE API calls etc).

5. Documentation

For the moment please check the /includes/sage.functions.inc file. The (Drupal) API functions in this file are self described and with proper comments.

1) You can use this modules API functions to get php arrays from SAGE DataStream XML API.
Example:

     $default_option = sage_default_search_option();
     $myoptions = array(
       // Get results for SAGE Category with ID 123456.
       "category" => "123456",
      );
      $option = array_intersect_key($myoptions, $default_option);
      $option = array_filter($option);
      // Get the php array from XML SAGE API.
      $results = sage_load_search($option);

2) You can only import the SAGE API product or category ids on Drupal and then display the results on Drupal using the available Drupal functions.
Example:

      // Category_id is already on Drupal.
      $category_id = $node->field_sage_category['und'][0]['value'];

      $default_option = sage_default_search_option();
      $myoptions = array(
        "category" => $category_id,
      );
      $option = array_intersect_key($myoptions, $default_option);
      $option = array_filter($option);
      // Get the php array from XML SAGE API.
      $results = sage_load_search($option);

6. To Do

Help will be appreciated because I don't think I will deal with such tasks in the future.

  1. Create a sage.api.php file.
  2. Add some hooks for the functions.
  3. Cache results (using Drupal core cache).
  4. Add tests.

7. Sponsorship

Logismico
This module was sponsored by Logismico a 25+ years software building company with specialization in advanced Drupal projects and not only.

AttachmentSize
horizontal_logo_250.png8.61 KB

Project information

Releases