The Interspire Shopping Cart Notification Module Documentation is an introduction in to implementing additional order notification services in to Interspire Shopping Cart. 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. Available Methods
  3. Callbacks

Introduction

Notification modules allow real-time notifications of new orders to be sent to the store owner via delivery methods such as e-mail, SMS or MSN Messenger.

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.

Notification modules exist within the /modules/notification/ directory and extend upon the base ISC_NOTIFICATION class.

Available Methods

GetOrderId

The GetOrderId method will return the ID number of the order that this notification message is being sent for.

GetOrderTotal

The GetOrderTotal method will return the total dollar amount of the order that this notification is being sent for.

GetOrderNumItems

The GetOrderNumItems method will return the number of items in the order that this notification is being sent for.

GetOrderPaymentMethod

The GetOrderPaymentMethod will return a string containing the name of the payment method that this order was processed through.

Callbacks

SendNotification

Returns: A key/value array containing the outcome (success or fail) and an appropriate message to be logged to the database.

The SendNotification method is automatically called by Interspire Shopping Cart when a new order notification should be sent out via this module. This method should send the notification and return an array containing the appropriate values if the notification was successfully sent or not. By calling the available methods mentioned above, the contents of the notification to be sent should be build.

Example notification callback:

function SendNotification()
{
	$subject = 'New Order on '.GetConfig('StoreName').' (#'.$this->GetOrderId().')';
	$message = "Order ID: ".$this->GetOrderId()."\n";
	$message .= "Order Total: ".FormatPrice($this->GetOrderTotal())."\n";
	$message .= "# of Items: ".$this->GetOrderNumItems()."\n";
	$message .= "Payment Method: ".$this->GetOrderPaymentMethod."\n";
		
	if(!@mail($this->GetValue('emailaddress'), $subject, $message)) {
		return array(
			'outcome' => 'fail',
			'message' => 'Unable to email new order notification'
		);
	}
	else {
		return array(
			'outcome' => 'success',
			'message' => 'Sent new order notification'
		);
	}
}

TestNotificationForm

If the TestNotificationForm method is present and _showtestlink is set to true of this module, this callback will be fired when a user clicks the “Test Notification Method” link on the notification settings page for this module.

This method should send a test notification to the configured settings for this module. For example, the SMS notification method will send a test order SMS notification to the configured cell phone number via the SMSGlobal service. It should output an appropriate page containing the results of the test.