Extensions and Widgets Creation

From osCommerce Wiki
Jump to navigation Jump to search

Note: This manual is for osCommerce v4.

Basic Provisions:

  1. All extensions must be placed in separate folder.
  2. The class file name must be the same as the folder name.
  3. Templates must be placed in folder 'views'.


if you want to use widgets in extensions

1. Add method getWidgets with $type parameter and describe widgets in array


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


    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




2) check extension enabled - use \common\helpers\Acl::checkExtensionAllowed($extName, 'allowed')

    public static function allowed() {

        return self::enabled();