### Example Extended Session Start Parameters Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/configincphp.md An example demonstrating how to extend session start parameters with specific parameter names and values. ```php $this->aRequireSessionWithParams = array( 'fnc' => array( 'login_noredirect' => true, ), 'new_sid' => true ); ``` -------------------------------- ### Example Module Composer.json Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/codeception/write_new_test.md Configuration file for the example module, specifying its name, type, and autoloading rules. ```json { "name": "examplevendor/examplemodule", "description": "This package contains example code.", "type": "oxideshop-module", "autoload": { "psr-4": { "ExampleVendor\ExampleModule\": "src/" } } } ``` -------------------------------- ### Codeception Initialization Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/codeception/write_new_test.md Concrete example of initializing Codeception acceptance tests for an OXID shop module. ```shell cd /var/www/oxideshop ./vendor/bin/codecept init Acceptance --path examplemodule/tests ``` -------------------------------- ### Install New Component with --no-plugins Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/getting_started/installation/eshop_installation.md When installing a new component, use `--no-plugins` to manage dependencies separately. This ensures that plugins are executed with their required versions after the initial installation. ```bash composer require --no-plugins monolog/monolog ``` ```bash composer install ``` -------------------------------- ### CHANGELOG.md Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/certification/documentation.md An example of a CHANGELOG.md file, detailing changes for different releases with the latest on top. ```html ### 1.0.1 * Fixed a bug that prevented... ### 1.0.0 * Completed all features, tested and stable. ``` -------------------------------- ### Install Session Authentication Component Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/tell_me_about/api/session_authentication.md Use Composer to install the session authentication component. ```bash composer require oxid-esales/session-authentication-component ``` -------------------------------- ### Example Module Directory Structure Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/codeception/write_new_test.md Defines the file and directory layout for an example OXID module. ```php examplemodule ├── src . └── Controller . └── StartController.php ├── views . └── twig . └── extensions . └── themes . └── default . └── layout . └── header.html.twig ├── composer.json └── metadata.php ``` -------------------------------- ### Example metadata.php File Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/skeleton/metadataphp/index.md A comprehensive example of a metadata.php file, illustrating the structure and common keys used for module information, extensions, events, and settings. ```php 'oe_examples_module', 'title' => 'OXID eSales Examples Module', 'description' => 'Module with examples for the most common use cases', 'thumbnail' => 'pictures/logo.png', 'version' => '1.0.0', 'author' => 'OXID eSales AG', 'url' => 'http://www.oxid-esales.com', 'email' => 'info@oxid-esales.com', 'extend' => [ \OxidEsales\Eshop\Application\Controller\StartController::class => \OxidEsales\ExamplesModule\Extension\Controller\StartController::class, \OxidEsales\Eshop\Application\Model\User::class => \OxidEsales\ExamplesModule\Extension\Model\User::class, ], 'events' => [ 'onActivate' => '\OxidEsales\ExamplesModule\Core\ModuleEvents::onActivate', 'onDeactivate' => '\OxidEsales\ExamplesModule\Core\ModuleEvents::onDeactivate' ], 'settings' => [ [ 'group' => 'oeexamplesmodule_main', 'name' => 'oeexamplesmodule_GreetingMode', 'type' => 'select', 'constraints' => 'generic|personal', 'value' => 'generic' ], [ 'group' => 'oeexamplesmodule_main', 'name' => 'oeexamplesmodule_BrandName', 'type' => 'str', 'value' => 'Testshop' ], ], ]; ``` -------------------------------- ### Install Professional Edition Metapackage Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/upgrade/upgrade-from-CE-to-PE.md Install the Professional Edition metapackage using composer. Use the --no-plugins and --no-scripts flags to prevent immediate execution of scripts and plugins during installation. ```bash composer require oxid-esales/oxideshop-metapackage-pe:^7 --no-plugins --no-scripts ``` -------------------------------- ### Example Module StartController Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/codeception/write_new_test.md Custom StartController that adds a greeting message to the template parameters. ```php addTplParam('greeting', $this->getGreetingMessage()); } private function getGreetingMessage(): string { $user = Registry::getSession()->getUser(); if ($user && $user->getId()) { return 'Hello ' . $user->getFieldData('oxusername') . '!'; } else { return 'Hello customer!'; } } } ``` -------------------------------- ### Query Builder Setup and Execution Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/using_database.md Demonstrates how to obtain a Query Builder instance and execute a SELECT query with parameters. ```php $queryBuilder ->select('*') ->from('oxtplblocks') ->where('oxshopid = :shopId') ->andWhere('oxblockname = :name') ->setParameters([ 'shopId' => $shopId, 'name' => $name, ]); $blocksData = $queryBuilder->execute(); $blocksData = $blocksData->fetchAllAssociative(); ``` -------------------------------- ### Example Log File Entry Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/tell_me_about/logging/logging.md This is an example of a typical log entry in `source/log/oxideshop.log` when using the default Monolog formatter, which includes stack traces for errors. ```log [2025-09-10 10:33:32] OXID Logger.ERROR: Controller "foo" cannot be resolved "[object] (OxidEsales\Eshop\Core\Exception\RoutingException(code: 0): Controller \"foo\" cannot be resolved at /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/ShopControl.php:191)\n[stacktrace]\n#0 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/ShopControl.php(867): OxidEsales\EshopCommunity\Core\ShopControl->resolveControllerClass('foo')\n#1 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/ShopControl.php(122): OxidEsales\EshopCommunity\Core\ShopControl->getControllerClass('foo')\n#2 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Oxid.php(27): OxidEsales\EshopCommunity\Core\ShopControl->start()\n#3 /var/www/oxideshop/source/index.php(16): OxidEsales\EshopCommunity\Core\Oxid::run()\n#4 {main}\n" [] ``` -------------------------------- ### Codeception Test Execution Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/codeception/example_module_test.md This output shows a successful Codeception test run for the 'CheckShopFrontendCest' Cest, specifically the 'notLoggedInUserMessage' test. It includes details on module setup and test duration. ```bash user@oxideshop:/var/www/oxideshop$ MODULE_IDS= vendor/bin/codecept run Acceptance -c tests/codeception.yml Building Actor classes for suites: Acceptance -> AcceptanceTesterActions.php generated successfully. 150 methods added \AcceptanceTester includes modules: Asserts, WebDriver, Db, \OxidEsales\Codeception\Module\Oxideshop, \OxidEsales\Codeception\Module\Database, \OxidEsales\Codeception\Module\Translation\TranslationsModule Codeception PHP Testing Framework v2.5.6 Powered by PHPUnit 6.5.14 by Sebastian Bergmann and contributors. Running with seed: Acceptance Tests (1) ---------------------------------------------------------------------------------------------------------------------------------------------- ✔ CheckShopFrontendCest: Test message for not logged in user (8.72s) ------------------------------------------------------------------------------------------------------------------------------------------------------------------- Time: 55.12 seconds, Memory: 12.00MB OK (1 test, 1 assertion) - XML report generated in file:///var/www/oxideshop/vendor/examplevendor/examplemodule/tests/Codeception/_output/report.xml ``` -------------------------------- ### Composer Theme Configuration Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/theme/theme_via_composer.md This JSON configuration is used in `composer.json` to define a theme installable via Composer. It specifies the theme type, author, dependencies, and extra OXID eShop specific settings like asset directories and filters. ```json { "name": "oxid-esales/apex-theme", "description": "APEX Theme", "license": [ "proprietary" ], "type": "oxideshop-theme", "keywords": [ "oxid", "themes", "eShop" ], "authors": [ { "name": "Tino Favetto, c&c concepts and creations GmbH" } ], "homepage": "https://github.com/OXID-eSales/apex-theme", "require": { "php": ">=8.0", "oxid-esales/twig-component": "*" }, "minimum-stability": "dev", "extra": { "oxideshop": { "assets-directory": "out/apex", "blacklist-filter": [ "build/**/*", "grunt/**/*", ".gitignore", "CHANGELOG.md", "composer.json", "Gruntfile.js", "package.json" ], "target-directory": "apex" } } } ``` -------------------------------- ### Install OXID eShop Module (Enterprise Edition Metapackage) Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/getting_started/installation/troubleshooting.md Use this command to install OXID eShop modules when the Enterprise Edition was installed via the metapackage. This is the default path for module installation. ```bash vendor/bin/oe-console oe:module:install-configuration source/modules/oe/graphql-base vendor/bin/oe-console oe:module:install-configuration source/modules/oe/graphql-storefront ``` -------------------------------- ### Control Setup Directory Removal in config.inc.php Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/configincphp.md Set blDelSetupDir to false to prevent the removal of the setup directory after installation. This is typically set to false if manual cleanup is preferred or required. ```php $this->blDelSetupDir = false; ``` -------------------------------- ### Default Session Start Parameters Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/configincphp.md The default configuration array that specifies additional request parameters which, if received, force a new session to be started. ```php array( 'cl' => array( 'register' => true, 'account' => true, ), 'fnc' => array( 'tobasket' => true, 'login_noredirect' => true, 'tocomparelist' => true, ), '_artperpage' => true, 'ldtype' => true, 'listorderby' => true, ); ``` -------------------------------- ### Install Module using oe-console Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/installation_setup/troubleshooting.md Use this command to install a module via the command line. Ensure you provide the correct path to the module's source code. ```bash ./vendor/bin/oe-console oe:module:install ``` -------------------------------- ### Install Module with Composer Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/installation_setup/installation.md Use this command to install an OXID eShop module using Composer. Composer handles all necessary installation steps automatically. ```bash composer require oxid-esales/module-template ``` -------------------------------- ### Example Module Metadata.php Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/codeception/write_new_test.md Module metadata file defining its ID, title, description, and extending core controllers. ```php 'examplevendor_examplemodule', 'title' => 'Example Module', 'description' => 'An OXID example module.', 'extend' => [ \OxidEsales\Eshop\Application\Controller\StartController::class => \ExampleVendor\ExampleModule\Controller\StartController::class, ], ]; ``` -------------------------------- ### Example: Custom CDN Image URL Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/configincphp.md Example demonstrating how to set a custom CDN URL for images. This changes the base path for generated image URLs. ```php $this->sSSLAltImageUrl = 'https://www.mycdn-server.com/myshop-data/'; // Resulting product URL: // https://www.mycdn-server.com/myshops-data/generated/product/1/390_245_75/nopic.jpg ``` -------------------------------- ### Regenerate Documentation with OXID SDK Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/README.rst Run this make command to regenerate the documentation after setting up the SDK and starting the containers. ```bash make generate-docs ``` -------------------------------- ### Install Module with oe-console Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/tutorials/module_setup.md Use this command to install your module into the OXID eShop project. ```bash vendor/bin/oe-console oe:module:install ``` -------------------------------- ### README.md Example Structure Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/certification/documentation.md A sample structure for a module's README.md file, providing essential information about the extension. ```html The ... extension for OXID eShop 6 ================================== ![Alt text for an image](an-image.jpg) ### List of features * List item A * List item B * List item C ### Setup For installation instructions please see... ### Module installation via Composer Install this module... ``` -------------------------------- ### Install JWT Authentication Component Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/tell_me_about/api/jwt_authentication.md Install the JWT Authenticator component using Composer. The component is automatically registered. ```bash composer require oxid-esales/jwt-authentication-component ``` -------------------------------- ### Product API Controller Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/tell_me_about/api/api_controllers.md Example of a simple API controller that returns a list of active products. ```APIDOC ## GET /api/products ### Description Retrieves a list of active products and their total count. ### Method GET ### Endpoint /api/products ### Response #### Success Response (200) - **products** (array) - A list of active products. - **total** (integer) - The total number of active products. #### Response Example { "products": [ { "id": "1", "name": "Example Product" } ], "total": 1 } ``` -------------------------------- ### Setup OXID SDK Sphinx Service Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/README.rst Use this make command to add the Sphinx service for documentation generation, specifying the path to your cloned documentation. ```bash make addsphinxservice docpath='./docs' ``` -------------------------------- ### Implement ProductSearchServiceInterface Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/product_search_service.md Create a custom service class that implements the `ProductSearchServiceInterface`. This example demonstrates the basic structure for the `search` method. ```php namespace MySearchComponentExample\Search; use OxidEsales\EshopCommunity\Internal\Domain\Product\Search\ProductSearchCriteria; use OxidEsales\EshopCommunity\Internal\Domain\Product\Search\ProductSearchResult; use OxidEsales\EshopCommunity\Internal\Domain\Product\Search\ProductSearchServiceInterface; use OxidEsales\EshopCommunity\Internal\Framework\Database\Id; class CustomProductSearchService implements ProductSearchServiceInterface { public function search(ProductSearchCriteria $criteria, array $context = []): ProductSearchResult { $response = $this->externalSearch( $criteria->getTerm()->getValue(), $criteria->getPagination()->getOffset(), $criteria->getPagination()->getLimit() ); $ids = array_map( fn(string $id) => Id::fromString($id), $response->getIds() ); return new ProductSearchResult($ids, $response->getTotal()); } } ``` -------------------------------- ### PHP Object Instantiation Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/certification/terms_conditions_checklist.md Use oxNew for object instantiation within modules. ```php oxNew ``` -------------------------------- ### Example Test Class Declaration Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/certification/software_tests.md An example of a test class declaration following the specified conventions. ```php namespace OxidProfessionalServices\ModuleGenerator\Tests\Unit; class ModuleGeneratorFileSystemTest extends \PHPUnit\Framework\TestCase { } ``` -------------------------------- ### User Login Page Object Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/codeception/oxid_codeception_page_objects.md An example of a Page Object class for the user login page, demonstrating how to define URL, locators, and a login action method. ```php class UserLogin extends Page { // include url of current page public $URL = '/en/my-account/'; // include bread crumb of current page public $breadCrumb = '#breadcrumb'; public $userAccountLoginName = '#loginUser'; public $userAccountLoginPassword = '#loginPwd'; public $userAccountLoginSubmit = '#loginButton'; /** * @param string $userName * @param string $userPassword * * @return UserAccount */ public function login(string $userName, string $userPassword): UserAccount { $I = $this->user; $I->fillField(s$this->userAccountLoginName, $userName); $I->fillField($this->userAccountLoginPassword, $userPassword); $I->click($this->userAccountLoginSubmit); $I->dontSee(Translator::translate('LOGIN')); return new UserAccount($I); } } ``` -------------------------------- ### Start OXID SDK Docker Containers Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/README.rst Start the necessary Docker containers for the Sphinx service in detached mode. ```bash docker-compose up --build -d sphinx ``` -------------------------------- ### Extend Session Start Parameters Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/configincphp.md Extends the default session start parameters by defining additional request parameters and their values that trigger a new session. ```php $this->aRequireSessionWithParams = array( 'parameter_name' => array( 'parameter_value' => true, ) ); ``` -------------------------------- ### Include JavaScript Files with Parameters Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/certification/software_quality.md This example shows how to include JavaScript files with additional parameters like priority and dynamic loading. ```twig {{ script({ include: oViewConf.getModuleUrl('example_module_id', 'js/example.js'), priority: 10, dynamic: __oxid_include_dynamic }) }} ``` -------------------------------- ### Install an OXID eShop Component Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/component.md Use the Composer `require` command to install a package as an OXID eShop component. This action automatically imports the component's `services.yaml` into the Service Container. ```bash composer require vendor/package ``` -------------------------------- ### Example Frontend Language File Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/skeleton/structure.md Defines translations for frontend use. Ensure UTF-8 charset for compatibility with OXID eShop. ```php 'UTF-8',\n\n 'VENDORMYMODULEIDLANGUAGEKEY' => 'my translation of VENDORMYMODULEIDLANGUAGEKEY'\n ); ``` -------------------------------- ### Install and Require a Module with Composer Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/using_namespaces_in_modules.md Configure Composer to use a VCS repository and then require the module. This is typically done in the shop's root directory. ```bash composer config repositories.myvendor/mymodule vcs https://github.com/myvendor/mymodule composer require myvendor/mymodule:dev-main ``` -------------------------------- ### Add New Main Menu Point and Submenu Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/skeleton/menuxml.md Example of introducing a new main menu point with a submenu entry in the admin interface. ```xml \n\n \n \n \n \n \n ``` -------------------------------- ### Example Module Header Template Extension Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/codeception/write_new_test.md Extends the header template to display a greeting message if available. ```twig {% extends 'layout/header.html.twig' %} {% block layout_header_bottom %} {% if greeting %} {{ greeting }} {% endif %} {{ parent() }} {% endblock %} ``` -------------------------------- ### Backwards Compatibility Autoloader Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/system_architecture/autoloading.md Shows how the Backwards Compatibility Autoloader resolves a deprecated class name to its unified namespace equivalent, then delegates to the Composer autoloader. ```php oxArticle ``` -------------------------------- ### Database Transaction with Exception Handling Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/using_database.md Shows how to start a database transaction, commit it, and handle potential exceptions by rolling back. ```php // Start transaction outside try/catch block $database->startTransaction(); try { $database->commitTransaction(); } catch (\Exception $exception) { $database->rollbackTransaction(); if (!$exception instanceof DatabaseException) { throw $exception; } } ``` -------------------------------- ### API Key Authentication Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/tell_me_about/api/api_controllers.md Implement API key authentication by validating a key from the request headers. Ensure the ApiKeyValidatorInterface is correctly implemented and injected. ```php readonly class SecureApiController { public function __construct( private ApiKeyValidatorInterface $apiKeyValidator ) { } #[Route('/api/secure/data', methods: ['GET'])] public function getData(Request $request): Response { $apiKey = $request->headers->get('X-API-Key'); if (!$this->apiKeyValidator->isValid($apiKey)) { return new JsonResponse(['error' => 'Unauthorized'], 401); } // Proceed with authenticated request } } ``` -------------------------------- ### Module Assets Directory Structure Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/skeleton/structure.md Example structure for organizing custom JavaScript, CSS, and image files within the module's assets directory. ```php .\n└── \n └── assets\n └── css\n └── example.css\n └── js\n └── example.js\n └── img\n └── example.jpg ``` -------------------------------- ### Composer Autoloader Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/system_architecture/autoloading.md Illustrates a class name resolved by the Composer autoloader, which handles namespaced classes configured in composer.json. ```php OxidEsales\Eshop\Application\Model\Article ``` -------------------------------- ### Execute Module Activation/Deactivation Commands Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/tell_me_about/console.md Examples of activating or deactivating modules using their IDs. The `--shop-id` flag can be used to specify a subshop. ```bash ./vendor/bin/oe-console oe:module:activate ``` ```bash ./vendor/bin/oe-console oe:module:activate --shop-id= ``` ```bash ./vendor/bin/oe-console oe:module:deactivate --shop-id= ``` -------------------------------- ### Basic Acceptance Test Example in Cest Format Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/codeception/introduction.md Demonstrates a simple acceptance test using the Cest format. It navigates to the home page and checks for a specific translation. ```php class ExampleCest { public function frontPageWorks(AcceptanceTester $I) { $homePage = new \OxidEsales\Codeception\Page\Home($I); $I->amOnPage($homePage->URL); $I->see(\OxidEsales\Codeception\Module\Translation\Translator::translate("HOME")); } } ``` -------------------------------- ### Generate Documentation Locally Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/README.rst Navigate to the cloned repository and run this command to generate the documentation locally. Open the generated index.html file in your browser to view. ```bash cd developer_documentation sphinx-build ./ ./build ``` -------------------------------- ### OXID eShop Module Composer.json Template Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/skeleton/composerjson/module_via_composer.md A complete example of a composer.json file for an OXID eShop module, demonstrating all required fields and common configurations. ```json { "name": "oxid-esales/module-template", "description": "", "type": "oxideshop-module", "keywords": [ "oxid", "modules", "eShop" ], "license": [ "GPL-3.0" ], "prefer-stable": true, "prefer-dist": true, "require": { "php": "^8.0 | ^8.1" }, "minimum-stability": "dev", "require-dev": { "phpstan/phpstan": "^1.9.14", "squizlabs/php_codesniffer": "3.*", "phpmd/phpmd": "^2.11", "oxid-esales/oxideshop-ce": "dev-b-7.0.x" }, "conflict": { "oxid-esales/oxideshop-ce": "<7.0" }, "autoload": { "psr-4": { "OxidEsales\ModuleTemplate\": "src/", "OxidEsales\ModuleTemplate\Tests\": "tests/" } }, "scripts": { "phpcs": "phpcs --standard=tests/phpcs.xml", "phpcbf": "phpcbf --standard=tests/phpcs.xml", "phpstan": "phpstan -ctests/PhpStan/phpstan.neon analyse src/", "phpstan-report": "phpstan -ctests/PhpStan/phpstan.neon analyse src/ --error-format=json > phpstan.report.json", "phpmd": "phpmd src ansi tests/PhpMd/standard.xml", "phpmd-excludestaticaccess": "phpmd src ansi tests/PhpMd/exclude-static-access-rule.xml", "phpmd-report": "phpmd src json tests/PhpMd/standard.xml --reportfile tests/reports/phpmd.report.json", "static": [ "@phpcs", "@phpstan", "@phpmd" ] }, "config": { "allow-plugins": { "oxid-esales/oxideshop-composer-plugin": true, "oxid-esales/oxideshop-unified-namespace-generator": true } } } ``` -------------------------------- ### Prepare Vendor Binaries for Remote Deployment (No Shell Access) Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/getting_started/installation/eshop_installation_without_composer.md On UNIX-based systems, if you lack shell access to the remote server, remove existing symbolic links in `vendor/bin/` and recreate them as executable shell scripts. This ensures the deployment works correctly. ```bash cd ``` ```bash rm vendor/bin/* ``` ```bash cat << 'EOF' >> vendor/bin/oe-eshop-db_views_generate #!/usr/bin/env sh dir=$(d=${0%[/\]*}; cd "$d" > /dev/null; cd "../oxid-esales/oxideshop-db-views-generator" && pwd) dir=$(echo $dir | sed 's/ /\ /g') "${dir}/oe-eshop-db_views_generate" "$@" EOF ``` ```bash cat << 'EOF' >> vendor/bin/oe-eshop-demodata_install #!/usr/bin/env sh dir=$(d=${0%[/\]*}; cd "$d" > /dev/null; cd "../oxid-esales/oxideshop-demodata-installer/bin" && pwd) dir=$(echo $dir | sed 's/ /\ /g') "${dir}/oe-eshop-demodata_install" "$@" EOF ``` ```bash cat << 'EOF' >> vendor/bin/oe-eshop-doctrine_migration #!/usr/bin/env sh dir=$(d=${0%[/\]*}; cd "$d" > /dev/null; cd "../oxid-esales/oxideshop-doctrine-migration-wrapper/bin" && pwd) dir=$(echo $dir | sed 's/ /\ /g') "${dir}/oe-eshop-doctrine_migration" "$@" EOF ``` -------------------------------- ### Default Image URL (No CDN) Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/configincphp.md Example showing the default image URL structure when no external CDN is configured. Images are served from the shop's own domain. ```php $this->sSSLAltImageUrl = ''; // Resulting product URL: // https://www.myshop.com/out/pictures/generated/product/1/390_245_75/nopic.jpg ``` -------------------------------- ### Example Module Configuration File (YAML) Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/module_configuration/modules_configuration.md A sample YAML file for configuring the 'oe_moduletemplate' module. It includes metadata, activation status, class extensions, controllers, events, and module-specific settings. ```yaml id: oe_moduletemplate\nmoduleSource: vendor/oxid-esales/module-template\nversion: 2.0.0\nactivated: true\ntitle:\n en: 'OxidEsales Module Template (OEMT)'\ndescription:\n en: ''\nlang: ''\nthumbnail: pictures/logo.png\nauthor: 'OXID eSales AG'\nurl: ''\nemail: ''\nclassExtensions:\n OxidEsales\Eshop\Application\Model\User: OxidEsales\ModuleTemplate\Model\User\n OxidEsales\Eshop\Application\Controller\StartController: OxidEsales\ModuleTemplate\Controller\StartController\ncontrollers:\n oemtgreeting: OxidEsales\ModuleTemplate\Controller\GreetingController\nevents:\n onActivate: '\OxidEsales\ModuleTemplate\Core\ModuleEvents::onActivate'\n onDeactivate: '\OxidEsales\ModuleTemplate\Core\ModuleEvents::onDeactivate'\nmoduleSettings:\n oemoduletemplate_GreetingMode:\n group: oemoduletemplate_main\n type: select\n value: generic\n constraints:\n - generic\n - personal\n oemoduletemplate_BrandName:\n group: oemoduletemplate_main\n type: str\n value: Testshop ``` -------------------------------- ### Define API Endpoint with Path Parameter Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/tell_me_about/api/api_controllers.md Use #[Route] to define a GET endpoint that accepts a product ID as a path parameter. The parameter is type-hinted as a string. ```php #[Route('/api/products/{id}', methods: ['GET'])] public function getProduct(string $id): Response { $product = $this->productService->getProductById($id); if (!$product) { return new JsonResponse(['error' => 'Product not found'], 404); } return new JsonResponse($product); } ``` -------------------------------- ### Example Environment File for Module Settings Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/module_configuration/modules_configuration_deployment.md This YAML file demonstrates how to specify environment-specific values for module settings, such as passwords for payment providers. It should be placed in the `var/configuration/environment/shops//modules/.yaml` directory. ```yaml moduleSettings: oemoduletemplate_Password: value: staging_environment_password ``` -------------------------------- ### Verify CodeSniffer Installation Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/getting_started/ide/phpstorm/codingstyle.md Check if CodeSniffer is installed and accessible via composer by running this command in your terminal. ```bash vendor/bin/phpcs ``` -------------------------------- ### Example Module YAML Configuration Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/module_configuration/modules_configuration_deployment.md This YAML snippet shows a module configuration file, highlighting the 'activated' option. This option controls whether a module is prepared for activation/deactivation or is already in that state. It can be set to 'true' or 'false'. ```yaml id: oe_moduletemplate activated: true ... ``` -------------------------------- ### Install EE Metapackage with Composer Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/upgrade/upgrade-from-PE-to-EE.md Install the Enterprise Edition metapackage without executing any scripts. This ensures only the package is added to your dependencies. ```bash composer require oxid-esales/oxideshop-metapackage-ee:^7 --no-plugins --no-scripts ``` -------------------------------- ### Language Dependent Text Assertion Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/codeception/oxid_codeception_modules.md Example of asserting a text directly, which would only work in the specified language (German in this case). ```php $I->see('Vielen Dank für Ihre Nachricht an'); ``` -------------------------------- ### Module Structure with menu.xml Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/skeleton/menuxml.md Illustrates the placement of the menu.xml file within a module's root directory. ```text .\n├── composer.json\n├── metadata.php\n├── menu.xml\n├── ...\n ``` -------------------------------- ### Enable Shop Demo Mode in config.inc.php Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/configincphp.md Set blDemoShop to true to activate the shop's demo mode. This is often used for testing or showcasing features without affecting live data. ```php $this->blDemoShop= true; ``` -------------------------------- ### Page Object Component Trait Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/codeception/oxid_codeception_page_objects.md An example of a Page Object Component using a trait to encapsulate reusable UI elements and actions, like those in a footer. ```php namespace OxidEsales\Codeception\Page\Component\Footer; use OxidEsales\Codeception\Page\Checkout\Basket; use OxidEsales\Codeception\Page\PrivateSales\Invitation; /** * Trait for service menu widget in footer * @package OxidEsales\Codeception\Page\Component\Footer */ trait ServiceWidget { public $privateSalesInvitation = '//ul[@class="services list-unstyled"]'; /** * @return Basket */ public function openBasket() { ... } /** * @return Invitation */ public function openPrivateSalesInvitationPage() { ... } } ``` -------------------------------- ### Log Debug Message Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/configincphp.md Example demonstrating how a debug message would not be logged if sLogLevel is set to 'warning'. Set sLogLevel to 'debug' to enable logging of such messages. ```php $logger->debug('Some debug message', [__CLASS__, __FUNCTION__]); ``` -------------------------------- ### Directory Structure for Environment Overrides Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/module_configuration/modules_environment_configuration.md Illustrates the directory structure for placing environment-specific configuration files to override default module settings. ```text .\└── var\n └── configuration\n └── environment\n └── shops\n └── 1\n └── 2\n └── ...\n └── shops\n └── 1\n └── 2\n └── ... ``` -------------------------------- ### Force Session Start Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/configincphp.md Enables forcing session start on the first page view, especially for browsers that do not accept cookies. Appends 'sid' parameter to URLs when enabled. ```php $this->blForceSessionStart = false; ``` -------------------------------- ### Create Product Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/tell_me_about/api/api_controllers.md Creates a new product. Accepts data in the request body. ```APIDOC ## POST /api/products ### Description Creates a new product. Requires product data in the request body. ### Method POST ### Endpoint /api/products ### Parameters #### Request Body - **(object)** - Required - Contains the data for the new product. - **name** (string) - Required - The name of the product. - **price** (float) - Required - The price of the product. ### Request Example ```json { "name": "New Gadget", "price": 99.99 } ``` ### Response #### Success Response (201) - **id** (string) - The unique identifier of the newly created product. #### Response Example ```json { "id": "newProd123" } ``` ``` -------------------------------- ### Install Deployment Tools Composer Command Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/module_configuration/modules_configuration_deployment.md This command installs the OXID eSales deployment tools package using Composer. This package provides the necessary utilities for deploying module configurations. ```bash composer require oxid-esales/deployment-tools ``` -------------------------------- ### Example Class Extension Chain Configuration (YAML) Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/module_configuration/modules_configuration.md A YAML configuration file defining class extension chains for a specific shop. It maps base classes to their respective extensions provided by modules. ```yaml OxidEsales\Eshop\Application\Model\User:\n - OxidEsales\ModuleTemplate\Model\User ``` -------------------------------- ### PHP Unit Test Class Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/certification/terms_conditions_checklist.md Example of a PHP unit test class extending UnitTestCase for module testing. Ensure one test class per module class. ```php Class MODULKLASSETest extends UnitTestCase ``` -------------------------------- ### Database Transaction Management in Tests Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/integration.md Implement database transaction management within your test setup and teardown methods to ensure data consistency. This involves beginning a transaction in `setUp` and rolling it back in `tearDown`. ```php use DatabaseTrait; public function setUp(): void { parent::setUp(); $this->beginTransaction(); } public function tearDown(): void { $this->rollBackTransaction(); parent::tearDown(); } ``` -------------------------------- ### Configure ShopSetup Codeception Module Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/acceptance.md Enable the ShopSetup module in your Codeception suite configuration to manage database population and fixtures. Ensure it is enabled before the Db module. ```yaml modules: enabled: - \OxidEsales\Codeception\Module\ShopSetup: dump: '%DUMP_PATH%' fixtures: '%FIXTURES_PATH%' license: '%license_key%' - Db: ..... ``` -------------------------------- ### Initialize Codeception Acceptance Tests Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/codeception/write_new_test.md Command to initialize Codeception acceptance tests within a module directory. ```shell cd ./vendor/bin/codecept init Acceptance --path / ``` -------------------------------- ### Install OXID eShop Module (Community Edition Upgrade Path) Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/getting_started/installation/troubleshooting.md If you upgraded from Community Edition to Enterprise Edition, use this alternative path to install OXID eShop modules. This path is typically required when the Community Edition was the root package. ```bash bin/oe-console oe:module:install-configuration source/modules/oe/graphql-base bin/oe-console oe:module:install-configuration source/modules/oe/graphql-storefront ``` -------------------------------- ### GET /api/profile Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/tell_me_about/api/jwt_authentication.md Retrieves the profile information of the currently authenticated user. ```APIDOC ## GET /api/profile ### Description Returns the authenticated user’s profile. Requires `IS_AUTHENTICATED`. ### Method GET ### Endpoint /api/profile ### Parameters #### Header Parameters - **Authorization** (string) - Required - The JWT token in the format `Bearer `. ### Request Example ```bash curl -X GET https://your-shop.com/api/profile \ -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGc..." ``` ### Response #### Success Response (200) - **username** (string) - The username of the authenticated user. - **roles** (array) - An array of roles assigned to the user. #### Response Example ```json { "username": "user@example.com", "roles": ["ROLE_USER"] } ``` ``` -------------------------------- ### Set Module Author Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/skeleton/metadataphp/amodule/author.md Example of how to set the author metadata for a module in the configuration. ```php 'author' => 'OXID eSales AG', ``` -------------------------------- ### Run Shop Integration Tests Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/integration.md Execute integration tests for the shop using the PHPUnit command. This command requires a specific configuration file and bootstrap script. ```bash vendor/bin/phpunit -c phpunit.xml --bootstrap tests/bootstrap.php tests/Integration ``` -------------------------------- ### Default Template Inheritance Chain Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/using_twig_in_module_templates.md Illustrates the default template inheritance order for three modules extending the same shop template, based on alphabetical sorting of module IDs. ```php get the "PARENT" template: shop/page/some-template.html.twig extended it by module-3/page/some-template.html.twig extended it by module-2/page/some-template.html.twig extended it by template module-1/page/some-template.html.twig ``` -------------------------------- ### Load Runtime Fixtures with Fixtures Helper Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/codeception/oxid_codeception_modules.md Instantiate the FixturesHelper and use its loadRuntimeFixtures method to load fixture data from PHP arrays. ```php loadRuntimeFixtures(dirname(__FILE__).'/../_data/fixtures.php'); $helper->loadRuntimeFixtures(dirname(__FILE__).'/../_data/additionaldata.php'); ``` -------------------------------- ### PHP Method Visibility Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/certification/terms_conditions_checklist.md When extending methods, do not change their visibility (public, protected, private). ```php ::parent call ``` -------------------------------- ### Controller Decoration Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/tell_me_about/controller_as_service.md Decorate a controller service to extend its functionality. Inherit from AbstractControllerDecorator for cleaner code. ```php namespace MyModule; use OxidEsales\EshopCommunity\Internal\Framework\Controller\AbstractControllerDecorator; use OxidEsales\EshopCommunity\Internal\Framework\Controller\ViewControllerInterface; class ControllerAsServiceDecorator extends AbstractControllerDecorator { public function __construct(protected readonly ViewControllerInterface $originalController) { } public function init() { $this->doSomethingExtra(); // and don't forget to call original method! $this->originalController->init(); } } ``` -------------------------------- ### Deploy All Module Configurations Console Command Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/module_configuration/modules_configuration_deployment.md This command deploys module configurations for all subshops, typically used for OXID eShop Professional Edition or when configuring all shops in an Enterprise Edition. Omit the --shop-id parameter to apply to all shops. ```bash vendor/bin/oe-console oe:module:deploy-configurations ``` -------------------------------- ### Get Category Product Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/tell_me_about/api/api_controllers.md Retrieves a specific product within a category using both category and product IDs. ```APIDOC ## GET /api/categories/{categoryId}/products/{productId} ### Description Retrieves a specific product identified by its `productId` within a given `categoryId`. ### Method GET ### Endpoint /api/categories/{categoryId}/products/{productId} ### Parameters #### Path Parameters - **categoryId** (string) - Required - The unique identifier of the category. - **productId** (string) - Required - The unique identifier of the product. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **product** (object) - Details of the requested product within the category. #### Response Example ```json { "id": "prod123", "name": "Specific Product", "categoryId": "catABC" } ``` ``` -------------------------------- ### Run All Acceptance Tests Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/acceptance.md Execute all acceptance tests using the Codeception runner. Ensure the correct configuration file is specified. ```bash vendor/bin/codecept run Acceptance -c tests/codeception.yml ``` -------------------------------- ### Escape String with escape Filter Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/project/twig_template_engine/twig_extensions.md Applies various escaping strategies to a string. The 'mail' escaper is shown as an example. ```twig {{ 'example@me.com'|escape('mail') }} ``` -------------------------------- ### Activate a Module for a Sub Shop via Command Line Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/installation_setup/setup.md Use this command to activate a specific module for a particular sub shop, specifying both the module ID and the shop ID. ```bash vendor/bin/oe-console oe:module:activate --shop-id= ``` -------------------------------- ### Get Product by ID Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/tell_me_about/api/api_controllers.md Retrieves a specific product using its ID. Supports path parameters and route requirements. ```APIDOC ## GET /api/products/{id} ### Description Retrieves a specific product by its unique identifier. ### Method GET ### Endpoint /api/products/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the product. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **product** (object) - Details of the requested product. #### Response Example ```json { "id": "abc123", "name": "Example Product", "price": 19.99 } ``` ``` -------------------------------- ### Registering Headers in ApplicationExitEvent Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/tell_me_about/event/ShopGeneralEvents/ApplicationExitEvent.md Modules should register headers using the provided Registry path. Actual sending of headers should be left to the shop. This is crucial for scenarios like reverse proxy configurations. ```php \OxidEsales\EshopCommunity\Internal\Transition\ShopEvents\ApplicationExitEvent ``` ```php \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Core\Header::class); ``` -------------------------------- ### Constructor Injection Example Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/tell_me_about/controller_as_service.md Use constructor injection to inject dependent services into your controller. Avoid using ContainerFacade directly. ```php class MyModuleController extends BaseController { public function __construct( private readonly ContextInterface $context ) {} public function helloWorld(): void { $this->context->...; } } ``` -------------------------------- ### Configure Oxideshop Module with Dependencies Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/testing/codeception/oxid_codeception_modules.md Enable the Oxideshop module and its dependencies (WebDriver, Db) in the `acceptance.suite.yml`. Configure WebDriver and Db modules with necessary parameters like shop URL, browser, and database credentials. ```yaml modules: enabled: - \OxidEsales\Codeception\Module\Oxideshop: depends: - WebDriver - Db - WebDriver: url: '%SHOP_URL%' browser: firefox port: '%SELENIUM_SERVER_PORT%' window_size: 1920x1080 clear_cookies: true - Db: dsn: 'mysql:host=%DB_HOST%;dbname=%DB_NAME%;charset=utf8' user: '%DB_USERNAME%' password: '%DB_PASSWORD%' port: '%DB_PORT%' dump: '%DUMP_PATH%' mysql_config: '%MYSQL_CONFIG_PATH%' populate: true # run populator before all tests cleanup: true # run populator before each test populator: 'mysql --defaults-file=$mysql_config --default-character-set=utf8 $dbname < $dump' initial_queries: - 'SET @@SESSION.sql_mode=""' ``` -------------------------------- ### Create Tar Archive for Deployment Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/getting_started/installation/eshop_installation_without_composer.md Use this command to create a tar archive of your project's root directory on your local machine for deployment. ```bash # create tar archive in the local environment tar -cvzf oxid-eshop.tar.gz ``` -------------------------------- ### Assign DOM Element for Widget Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/certification/software_quality.md This example shows how to assign a DOM element for a widget and trigger its behavior, such as showing a modal. ```twig {{ script({ add: "const myModal = new bootstrap.Modal('#isRootCatChanged');myModal.show();" }) }} ``` -------------------------------- ### Define Service Interface and Implementation Source: https://github.com/oxid-esales/developer_documentation/blob/b-7.5.x/development/modules_components_themes/module/module_services.md Define the interface for a service and its concrete implementation. This example shows a `PriceCalculatorInterface` and an `ERPPriceCalculator` class. ```php interface PriceCalculatorInterface { public function getPrice(string $productId, int $amount): Price; } class ERPPriceCalculator implements PriceCalculatorInterface { public function getPrice(string $productId, int $amount): Price { $this->doSomeCalculation(); // ... return $price } } ```