The Interspire Shopping Cart Addon Module Documentation is an introduction in to creating addons that extend the functionality of the Interspire Shopping Cart Control Panel. This guide assumes you have knowledge of PHP.

Interspire Shopping Cart 3.5 Required
This documentation has been written for the upcoming release of Interspire Shopping Cart 3.5. There are numerous changes between Interspire Shopping Cart 3.5 and earlier releases for modules.

Contents

  1. Introduction
  2. Registering Menu Items
  3. Available Methods
  4. Callbacks
  5. Sample Addon

Introduction

Addon modules allow extra functionality and pages to be implemented in to the Interspire Shopping Cart control panel without actually modifying any of the Interspire Shopping Cart code itself. New addons can be distributed through the Addons Marketplace (accessible from the Addons menu in the Control Panel) directly from Interspire.

This document continues on from the Interspire Shopping Cart Modules Documentation which provides an overview of how Interspire Shopping Cart modules work and their structure.

Addon modules exist within the /modules/addons/ directory and extend upon the base ISC_ADDON class.

Registering Menu Items

Addons can position themselves within the Interspire Shopping Cart Control Panel menus so they’re easily accessible. Each addon can insert as many menu items as it needs in to any of the menus in the header of Interspire Shopping Cart.

To register a menu item for an addon, in the __construct method of the addon call $this->RegisterMenuItem with an array of details about the item to be placed in the menu.

The keys for each of the items in the array of menu details are as follows:

  • location
    The menu under which this menu item should be placed. A list of menus can be found below.
  • icon
    If an icon should be shown next to this menu item, the file name (of an image that exists in the directory for this addon) to show as the icon in the menu.
  • text
    The name of the menu item to be shown in the menu.
  • description
    A description for this menu item. This is only required if this item is placed in the primary navigation menu.
  • link (Optional)
    If a link is specified, this menu item will be linked to this URL. If not specified, the URL to the addon’s main page (see EntryPoint below) will be used. This is useful for addons that integrate in to more than one menu and need to show different content depending on the menu item.

A list of supported menu locations are as follows:

  • Primary Menu Items
    • mnuOrders – The orders menu
    • mnuCustomers – The customers menu
    • mnuProducts – The products menu
    • mnuContent – The website content menu
    • mnuPromotions – The promotions menu
    • mnuStatistics – The statistics menu
  • Secondary Menu Items (Right aligned at the top of the control panel)
    • mnuHome – The home link
    • mnuAddons – The addons link
    • mnuTemplates – The templates link
    • mnuUsers – The users link
    • mnuTools – The tools menu
    • mnuSettings – The settings menu
    • mnuLogout – The logout link
    • mnuViewStore – The view store link
    • mnuHelp – The help link

Example:

$this->RegisterMenuItem(array(
	'location'		=> 'mnuPromotions',
	'icon'			=> 'icon.gif',
	'text'			=> 'Text To Show',
	'description'	=> 'The description for this menu item.'
));

Available Methods

ShowSaveAndCancelButtons

Arguments:
  • A boolean value of whether or not to show the save and cancel buttons on the settings form. Set to false to hide the buttons.

ShowSaveAndCancelButtons allows addons to explicitly hide or show the save and cancel buttons when editing the settings for this addon. This is useful in circumstances where addons may not have any settings or wish to show other content when there is no need for the buttons to be shown.

Callbacks

Init

If present, the Init method of an addon will be called whenever the settings/configuration page for this addon is shown. This allows custom code to be executed on this page. Generally this method is used to tell the addon if the save & cancel buttons should be shown for this addon, as is in the example below.

Example:

function Init()
{
	$this->ShowSaveAndCancelButtons(false);
}

EntryPoint

Each addon must define an EntryPoint method, which is called the first time the addons is run. The EntryPoint method for an addon should contain all of the addon specific code that should be run when this addon is accessed. This is where the bulk of the code for an addon will exist.

If an addon has multiple pages, each page can be declared as a public method within the addons framework. The addon should then refer or link to these pages as follows: index.php?ToDo=runAddon&addon=[ADDON ID]&func=[METHOD NAME]

When that URL is visited, Interspire Shopping Cart will load the addon and look for an available method as specified by [METHOD NAME]. If this method is found, the method will be called automatically.

Example:

public function EntryPoint()
{
	echo "Click here to proceed to the next step.";
}

public function TestFunction()
{
	echo "You're on step 2 - a separate page provided by this addon.";
}

Sample Addon

As Interspire Shopping Cart does not include any addons by default, a sample addon has been developed to assist in addon development. You may download the sample addon below.

The sample addon will allow you to generate an XML feed of the latest orders in your store and demonstrates use of the following module/addon system features:

  • Registering menu items
  • Registering menu items that link to separate pages of an addon / URLs
  • Defining a list of configuration options for an addon
  • Loading a template from the addon templates directory

To install the addon in your store, extract the contents of the download below in to your /addons/ directory.