This is the documentation for LemonStand V1, which has been discontinued. You can learn more and upgrade your store here.

LemonStand Version 1 Has Been Discontinued

This documentation is for LemonStand Version 1. LemonStand is now offered as a cloud-based eCommerce platform.
You can try the new LemonStand and learn about upgrading here.

Using Module Access Points

Module access points allow you to register special URLs which can be used for different tasks, for example for executing some module specific actions using cron jobs.

In order to register a module access point you need to override the register_access_points() method in the module information class. The module information class has been described in the Developing a simple module article. The register_access_points() method should return an array. Indexes (keys) of the array should match URLs you want to register. Slashes are not allowed in access point URLs. Array values should match the information class method names. Below is an example of the access point registration code.

public function register_access_points()
{
  return array(
    'blog_send_newspaper'=>'send_newspaper'
  );
}

The code registers a single access point with URL 'blog_send_newspaper'. If your website URL was http://my-site.com/ then the access point URL would be http://my-site.com/blog_send_newspaper.

According to the code example, the module information class should also have the send_newspaper() method definition. It should be a public class method with a single parameter:

public function send_newspaper($params)
{
  /*
   * Some newspaper sending code
   */
}

The method parameter is an array, which contains all parameters present in the access point URL. For example, if the access point was invoked using the http://my-site.com/blog_send_newspaper/subscribers URL, the $params array would have a single element - 'subscribers'. You can use as many access point parameters as you need.

Access points are not actions and they have no corresponding view documents. You can use the echo() or print() function for outputting some status information.


Previous: Programming Module CMS Actions
Return to Understanding LemonStand Modules