How To: Connect Statics for PWAjet

The schema skeleton for the PWAjet extension is located in app/addons/sd_api_extender/schemas/sd_api_extender/extensions.php.

[
  'author'    => Developer name
  'extension' => Add-on name to extend PWAjet
  'scripts'   => [] Array with scripts to connect
]

Let’s look at the Simtech Development add-on: PWAjet: Order barcode integration add-on as the example of the PWAjet extension.

  1. Add a file to extend the skeleton of the schema app/addons/pwajet_barcode_integration/schemas/sd_api_extender/extensions.post.php.
<?php
/***************************************************************************
*                                                                          *
*   © Simtech Development Ltd.                                             *
*                                                                          *
* This  is  commercial  software,  only  users  who have purchased a valid *
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
***************************************************************************/

defined('BOOTSTRAP') or die('Access denied');

$schema[] = [
    'author'    => 'simtechdev',
    'extension' => 'pwajet_barcode_integration',
    'scripts'   => [
        '/design/spa_files/example/assets/extensions/simtechdev/pwajet_barcode_integration/js/runtime~integration-barcode.38a78c3c.js',
        '/design/spa_files/example/assets/extensions/simtechdev/pwajet_barcode_integration/js/integration-barcode.38a78c3c.chunk.js'
    ]
];

return $schema;

2. The path to scripts in the schema does not have to be assembled according to the rule /design/spa_files/example/assets/extensions/{author}/{extension}/. Any path is allowed from the root directory where the store files are located. But in the PWAjet static, scripts will be copied to the /design/spa_files/example/assets/extensions/{author}/{extension}/js/directory.

  1. PWAjet allows adjusting the extension connection depending on the storefront. Just add a setting in the addon.xml file of the extensible add-on.
<settings edition_type="ROOT,ULT:VENDOR">
    <sections>
       <section id="general">
            <items>
                <item id="active_for_storefront">
                    <type>checkbox</type>
                    <default_value>Y</default_value>
               </item>
            </items>
        </section>
    </sections>
</settings>
  1. Do not set dependencies of sd_api_extender in the addon.xml file to avoid conflicts. The logic of extension dependencies from PWAjet is already implemented in the application.