twisted1919
Administrator
Staff memberThis simple extension shows how to add one/more menu links in the customer area.
It is also a good example to learn a bit about mailwizz extension development.
In order to get started, create a new folder on your desktop, named "customer-area-menu-items".
In it, create a new file called "CustomerAreaMenuItemsExt.php" and paste following contents:
Then simply zip the folder and go to your mailwizz app in Backend -> Extend -> Extensions and upload it then after upload, make sure you enable it.
After the above steps, login as a customer and you should see a new menu link that will point the customers to the articles area of your application.
It is also a good example to learn a bit about mailwizz extension development.
In order to get started, create a new folder on your desktop, named "customer-area-menu-items".
In it, create a new file called "CustomerAreaMenuItemsExt.php" and paste following contents:
PHP:
<?php defined('MW_PATH') || exit('No direct script access allowed');
class CustomerAreaMenuItemsExt extends ExtensionInit
{
// name of the extension as shown in the backend panel
public $name = 'Customer area menu items';
// description of the extension as shown in backend panel
public $description = 'Add a links in the menu from customer area';
// current version of this extension
public $version = '1.0';
// the author name
public $author = 'Your name';
// author website
public $website = 'http://www.website.com/';
// contact email address
public $email = 'your.email@domain.com';
// in which apps this extension is allowed to run
public $allowedApps = array('customer');
// can this extension be deleted? this only applies to core extensions.
protected $_canBeDeleted = true;
// can this extension be disabled? this only applies to core extensions.
protected $_canBeDisabled = true;
// run the extension, ths is mandatory
public function run()
{
Yii::app()->hooks->addFilter('customer_left_navigation_menu_items', array($this, '_addMenuItem'));
}
public function _addMenuItem(array $items = array())
{
$newItems = array();
$newItem = array(
'name' => Yii::t('app', 'Articles'),
'icon' => 'glyphicon-book',
'active' => 'api_keys',
'route' => Yii::app()->apps->getAppUrl('frontend', 'articles'),
);
foreach ($items as $name => $value) {
if ($name == 'api-keys') {
$newItems['articles'] = $newItem;
}
$newItems[$name] = $value;
}
if (!isset($newItems['articles'])) {
$newItems['articles'] = $newItem;
}
return $newItems;
}
}
Then simply zip the folder and go to your mailwizz app in Backend -> Extend -> Extensions and upload it then after upload, make sure you enable it.
After the above steps, login as a customer and you should see a new menu link that will point the customers to the articles area of your application.
Last edited: