Extensions and Widgets Creation: Difference between revisions
No edit summary |
No edit summary |
||
Line 29: | Line 29: | ||
<h4>in this case ShoppingCart (in subfolder \ShoppingCart) is widget ( ShoppingCart.php) can be used in customizing Themes</h4> | <h4>in this case ShoppingCart (in subfolder \ShoppingCart) is widget ( ShoppingCart.php) can be used in customizing Themes</h4> | ||
2. to show additional settings for widget use method showSettings | <h3>2. to show additional settings for widget use method showSettings</h3> | ||
example: | <h4>example:</h4> | ||
public static function showSettings($settings){ | public static function showSettings($settings){ | ||
Line 39: | Line 39: | ||
} | } | ||
extension installer: | <h4>extension installer:</h4> | ||
1) extends \common\classes\modules\ModuleExtensions | <h3>1) extends \common\classes\modules\ModuleExtensions</h3> | ||
2) install (example) | <h3>2) install (example)</h3> | ||
public function install($platform_id){ | public function install($platform_id){ | ||
Line 63: | Line 63: | ||
} | } | ||
2) | <h3>2) check extension enabled - use \common\helpers\Acl::checkExtensionAllowed($extName, 'allowed')</h3> | ||
public static function allowed() { | public static function allowed() { |
Revision as of 12:40, 21 February 2023
Note: This manual is for osCommerce v4.
Basic Provisions:
All extensions must be placed in separate folder.
The class file name must be the same as the folder name.
Templates must be placed in folder 'views'.
//additional
if you want to use widgets in extensions
1. Add method getWidgets with $type parameter and describe widgets in array
example:
return [
[
'name' => 'CustomerLoyalty\ShoppingCart', 'title' => 'Customer Loyalty Info Box', 'description' => '', 'type' => 'cart',
],
];
in this case ShoppingCart (in subfolder \ShoppingCart) is widget ( ShoppingCart.php) can be used in customizing Themes
2. to show additional settings for widget use method showSettings
example:
public static function showSettings($settings){
return self::begin()->render('settings.tpl', ['settings' => $settings]);
}
extension installer:
1) extends \common\classes\modules\ModuleExtensions
2) install (example)
public function install($platform_id){
parent::install($platform_id);// install in liek other modules
// install extention envirenment
$migration = new \common\classes\Migration;
$migration->addTranslation(['admin/main'], [
//add keys
]);
return;
}
2) check extension enabled - use \common\helpers\Acl::checkExtensionAllowed($extName, 'allowed')
public static function allowed() {
return self::enabled();
}