App for J2store

In the following guide, we are going to cover the following topics related to plugin development:

Introduction App Structure Naming Conventions The Manifest Creating app class App Model Class App controller


Developing a app for J2Store is very simple process if you are good in PHP and the Joomla MVC structure.

J2Store comes with a app library and wrappers that makes creating a app for J2Store.

App Structure

There is a folder structure and a few naming conventions, that should be followed during the development of a app for J2Store.

A typical app should look like this:

├── app_example/
│   ├── app_example.php
│   ├── app_example.xml
│   ├── languages/
│   │   ├── en-GB.plg_j2store_app_example.ini
│   ├── app_example/
│   │   ├── tmpl/
│   │   │   ├── form.php
│   │   │   ├── default.php
│   │   ├── controller.php
│   │   ├── models/
│   │   │   ├── appexample.php

Naming Conventions

The name of the app folder should start with the prefix “app”. Otherwise, J2Store will not recognise your app. So our example app is named as:appexample

Make sure that the name of the file and folder is in lower case and there are no spaces or any other characters in the name.


An example manifest should look like this:

<?xml version="1.0" encoding="utf-8"?>
<extension version="3.0" type="plugin" group="j2store" method="upgrade">
	<creationDate>July 2015</creationDate>
	<copyright>2015 Weblogicx India</copyright>
	<license>GNU General Public License v2</license>
		<filename plugin="app_example">app_example.php</filename>
		<language tag="en-GB">languages/en-GB.plg_j2store_app_example.ini</language>		
		<fields name="params">
			<fieldset name="basic" label="J2STORE_BASIC_SETTINGS" 

Creating app class

Make sure the name of the class suffix is same as your app file’s name. And it should extend the J2StoreAppPlugin class.

defined('_JEXEC') or die('Restricted access');
    class plgJ2StoreApp_Example extends J2StoreAppPlugin
    	 * @var $_element  string  Should always correspond with the plugin's filename,
    	 *                         forcing it to be unique
    	var $_element    = 'app_example';```

This file should have following two methods:

**onJ2StoreGetAppView** - This method is used to check if it is a app_example or not.

viewList - A controller for this plugin.
	```$html = $this->_getLayout('default', $vars);```

The above line will call the template layout for the app_example from /app_example/app_example/tmpl/default.php

**App Model Class**

App's model should have file named with appexample.php and it should be like below

defined(’JEXEC’) or die(‘Restricted access’); requireonce (JPATHADMINISTRATOR . ‘/components/comj2store/library/appmodel.php’); class J2StoreModelAppExample extends J2StoreAppModel {

public $_element = 'app_example';


**App controller**

Controller.php file should be located in /app_donation/app_donation/controller.php and you must include the J2Store's library appcontroller and it should be written like below

defined(’JEXEC’) or die(‘Restricted access’); requireonce(JPATHADMINISTRATOR.’/components/comj2store/library/appcontroller.php’);

class J2StoreControllerAppexample extends J2StoreAppController{

var $_element   = 'app_example';


Last updated