├── .github └── ISSUE_TEMPLATE │ └── config.yml ├── .gitignore ├── LICENSE.md ├── README.md ├── api_module ├── .gitignore ├── .php-cs-fixer.dist.php ├── LICENSE.md ├── README.md ├── api_module.php ├── composer.json ├── composer.lock ├── config.xml ├── config │ └── services.yml ├── example.png ├── src │ ├── ApiPlatform │ │ ├── Resources │ │ │ ├── Cat.php │ │ │ └── Horse.php │ │ └── State │ │ │ ├── CatProcessor.php │ │ │ ├── CatProvider.php │ │ │ ├── HorseProcessor.php │ │ │ └── HorseProvider.php │ ├── Database │ │ └── DBInstaller.php │ ├── Entity │ │ ├── Hamster.php │ │ └── Horse.php │ ├── Repository │ │ └── HorseRepository.php │ └── Resources │ │ └── data │ │ ├── data.json │ │ └── install.sql └── tests │ ├── phpstan.sh │ └── phpstan │ └── phpstan-nightly.neon ├── demo_grid ├── .gitignore ├── README.md ├── composer.json ├── config.xml ├── config │ ├── routes.yml │ └── services.yml ├── demo_grid.php ├── demo_grid_screenshot.png ├── logo.png ├── src │ ├── Controller │ │ └── Admin │ │ │ └── IndexController.php │ └── Grid │ │ ├── Definition │ │ └── Factory │ │ │ └── ProductGridDefinitionFactory.php │ │ ├── Filters │ │ └── ProductFilters.php │ │ └── Query │ │ └── ProductQueryBuilder.php └── views │ ├── demo_grid.js │ └── templates │ └── admin │ └── index.html.twig ├── democonsolecommand ├── README.md ├── composer.json ├── composer.lock ├── config.xml ├── config │ └── services.yml ├── democonsolecommand-screenshot.png ├── democonsolecommand.php ├── logo.png └── src │ └── Command │ └── ListManufacturersCommand.php ├── democontrollertabs ├── .gitignore ├── README.md ├── composer.json ├── config.xml ├── config │ ├── routes.yml │ └── services.yml ├── democontrollertabs-screenshot.jpeg ├── democontrollertabs.php ├── logo.png ├── src │ └── Controller │ │ └── Admin │ │ ├── ConfigureController.php │ │ ├── ManualTabController.php │ │ ├── MinimalistController.php │ │ └── SecuredController.php └── views │ └── templates │ └── admin │ ├── configure.html.twig │ ├── layout.html.twig │ ├── manual_tab.html.twig │ ├── minimalist.html.twig │ └── secured.html.twig ├── demodoctrine ├── .gitignore ├── README.md ├── Resources │ └── data │ │ ├── install.sql │ │ └── quotes.json ├── composer.json ├── config.xml ├── config │ ├── common.yml │ ├── front │ │ └── services.yml │ ├── routes.yml │ └── services.yml ├── demodoctrine-screenshot.png ├── demodoctrine.php ├── js │ ├── .webpack │ │ ├── common.js │ │ ├── dev.js │ │ └── prod.js │ ├── package-lock.json │ ├── package.json │ ├── quotes │ │ ├── form.js │ │ └── index.js │ └── webpack.config.js ├── logo.png ├── src │ ├── Controller │ │ └── Admin │ │ │ └── QuotesController.php │ ├── Database │ │ ├── QuoteGenerator.php │ │ └── QuoteInstaller.php │ ├── Entity │ │ ├── Quote.php │ │ └── QuoteLang.php │ ├── Form │ │ ├── QuoteFormDataHandler.php │ │ ├── QuoteFormDataProvider.php │ │ └── QuoteType.php │ ├── Grid │ │ ├── Definition │ │ │ └── Factory │ │ │ │ └── QuoteGridDefinitionFactory.php │ │ ├── Filters │ │ │ └── QuoteFilters.php │ │ └── Query │ │ │ └── QuoteQueryBuilder.php │ └── Repository │ │ └── QuoteRepository.php └── views │ ├── css │ └── quotes.css │ ├── js │ ├── quote_form.bundle.js │ └── quotes.bundle.js │ └── templates │ ├── admin │ ├── create.html.twig │ ├── edit.html.twig │ ├── form.html.twig │ ├── generate.html.twig │ └── index.html.twig │ └── front │ └── home.tpl ├── demoextendgrid ├── .gitignore ├── README.md ├── composer.json ├── config.xml ├── config │ └── routes.yml ├── demoextendgrid.php ├── extend_grid_screenshot.png ├── logo.png ├── mark-action-screenshot.png ├── src │ ├── Controller │ │ └── DemoOrderController.php │ └── Install │ │ └── Installer.php └── views │ └── js │ └── orders-listing.js ├── demoextendsymfonyform1 ├── .gitignore ├── README.md ├── composer.json ├── config.xml ├── config │ ├── routes.yml │ └── services.yml ├── demo_form.png ├── demo_list.png ├── demoextendsymfonyform1.php ├── logo.png └── src │ ├── Controller │ └── Admin │ │ └── CustomerReviewController.php │ ├── Entity │ └── Reviewer.php │ ├── Exception │ ├── CannotCreateReviewerException.php │ ├── CannotToggleAllowedToReviewStatusException.php │ └── ReviewerException.php │ └── Repository │ └── ReviewerRepository.php ├── demoextendsymfonyform2 ├── .gitignore ├── README.md ├── composer.json ├── config.xml ├── config │ ├── routes.yml │ └── services.yml ├── demoextendedsymfonyform2-screenshot.jpeg ├── demoextendsymfonyform2.php ├── logo.png └── src │ ├── Controller │ └── DemoSupplierController.php │ ├── Entity │ └── SupplierExtraImage.php │ ├── Install │ └── Installer.php │ ├── Repository │ └── SupplierExtraImageRepository.php │ ├── Sql │ └── SqlQueries.php │ ├── Uploader │ └── SupplierExtraImageUploader.php │ └── View │ └── upload_image.html.twig ├── demoextendsymfonyform3 ├── .gitignore ├── README.md ├── composer.json ├── config.xml ├── config │ ├── routes.yml │ └── services.yml ├── democqrshooksusage_form.png ├── democqrshooksusage_list.png ├── demoextendsymfonyform3.php ├── logo.png └── src │ ├── Controller │ └── Admin │ │ └── CustomerReviewController.php │ ├── Domain │ └── Reviewer │ │ ├── Command │ │ ├── ToggleIsAllowedToReviewCommand.php │ │ └── UpdateIsAllowedToReviewCommand.php │ │ ├── CommandHandler │ │ ├── AbstractReviewerHandler.php │ │ ├── ToggleIsAllowedToReviewHandler.php │ │ └── UpdateIsAllowedToReviewHandler.php │ │ ├── Exception │ │ ├── CannotCreateReviewerException.php │ │ ├── CannotToggleAllowedToReviewStatusException.php │ │ └── ReviewerException.php │ │ ├── Query │ │ └── GetReviewerSettingsForForm.php │ │ ├── QueryHandler │ │ └── GetReviewerSettingsForFormHandler.php │ │ └── QueryResult │ │ └── ReviewerSettingsForForm.php │ ├── Entity │ └── Reviewer.php │ └── Repository │ └── ReviewerRepository.php ├── demoextendtemplates ├── .gitignore ├── README.md ├── composer.json ├── config.xml ├── config │ └── services.yml ├── demoextendedtemplates-screenshot.jpeg ├── demoextendtemplates.php ├── logo.png ├── src │ └── Controller │ │ └── DecoratedOrderController.php └── views │ ├── PrestaShop │ └── Admin │ │ ├── Sell │ │ └── Order │ │ │ └── Order │ │ │ └── index.html.twig │ │ └── layout.html.twig │ └── css │ └── layout.css ├── demofiltermodules ├── .gitignore ├── README.md ├── composer.json ├── config │ ├── common.yml │ ├── front │ │ └── services.yml │ └── services.yml ├── demofiltermodules.php └── src │ └── Service │ └── CustomModuleList.php ├── demoformdataproviders ├── config.xml ├── demoformdataproviders.php └── index.php ├── demojsrouting ├── .gitignore ├── README.md ├── composer.json ├── config.xml ├── config │ ├── routes.yml │ └── services.yml ├── demojsrouting.php ├── demojsrouting_screenshot.jpeg ├── logo.png ├── src │ ├── Controller │ │ └── DemoPageController.php │ └── Install │ │ └── Installer.php └── views │ ├── js │ └── demo-page.js │ └── templates │ └── admin │ └── demo_page.html.twig ├── demomoduleroutes ├── README.md ├── config.xml ├── controllers │ ├── front │ │ ├── index.php │ │ ├── list.php │ │ └── show.php │ └── index.php ├── demomoduleroutes.php ├── index.php └── views │ └── templates │ └── front │ ├── list.tpl │ └── show.tpl ├── demomultistoreform ├── .gitignore ├── README.md ├── Resources │ ├── contentBlocks.json │ └── install.sql ├── composer.json ├── config.xml ├── config │ ├── index.php │ ├── routes.yml │ └── services.yml ├── demomultistore_screenshot.png ├── demomultistoreform.php ├── logo.png ├── src │ ├── Controller │ │ ├── DemoMultistoreController.php │ │ └── index.php │ ├── Database │ │ ├── ContentBlockGenerator.php │ │ └── ContentBlockInstaller.php │ ├── Entity │ │ ├── ContentBlock.php │ │ └── index.php │ ├── Form │ │ ├── ContentBlockConfigurationFormDataProvider.php │ │ ├── ContentBlockConfigurationType.php │ │ ├── ContentBlockDataConfiguration.php │ │ ├── ContentBlockFormDataHandler.php │ │ ├── ContentBlockFormDataProvider.php │ │ ├── ContentBlockType.php │ │ └── index.php │ ├── Grid │ │ ├── Definition │ │ │ ├── Factory │ │ │ │ ├── ContentBlockGridDefinitionFactory.php │ │ │ │ └── index.php │ │ │ └── index.php │ │ └── Query │ │ │ ├── ContentBlockQueryBuilder.php │ │ │ └── index.php │ └── index.php └── views │ ├── index.php │ ├── js │ ├── createForm.js │ ├── form.js │ └── index.php │ └── templates │ ├── admin │ ├── form.html.twig │ ├── index.html.twig │ └── index.php │ ├── hook │ └── displayBlockContent.tpl │ └── index.php ├── demooverrideobjectmodel ├── .gitignore ├── README.md ├── composer.json ├── config.xml ├── demooverrideobjectmodel.php ├── logo.png ├── override │ └── classes │ │ └── Manufacturer.php └── src │ └── Install │ ├── Installer.php │ ├── install.sql │ └── uninstall.sql ├── demoproductextracontent ├── config.xml ├── demoproductextracontent.php └── index.php ├── demoproductform ├── .gitignore ├── .php-cs-fixer.dist.php ├── README.md ├── composer.json ├── config.xml ├── config │ └── services.yml ├── demoproductform.php ├── logo.png ├── src │ ├── CQRS │ │ ├── Command │ │ │ └── UpdateCustomProductCommand.php │ │ ├── CommandBuilder │ │ │ └── CustomProductCommandsBuilder.php │ │ └── CommandHandler │ │ │ └── UpdateCustomProductCommandHandler.php │ ├── Entity │ │ ├── CustomCombination.php │ │ └── CustomProduct.php │ ├── Form │ │ ├── Modifier │ │ │ ├── CombinationFormModifier.php │ │ │ └── ProductFormModifier.php │ │ └── Type │ │ │ ├── CustomTabContentType.php │ │ │ └── CustomTabType.php │ └── Install │ │ ├── Installer.php │ │ ├── install.sql │ │ └── uninstall.sql └── views │ └── templates │ └── admin │ ├── FormTheme │ └── product_tab_content_form_theme.html.twig │ └── extra_module.html.twig ├── demosymfonyform ├── .gitignore ├── README.md ├── composer.json ├── config.xml ├── config │ ├── index.php │ ├── routes.yml │ └── services.yml ├── demosymfonyform-screenshot.jpeg ├── demosymfonyform.php ├── logo.png ├── src │ ├── Controller │ │ ├── DemoConfigurationController.php │ │ ├── DemoConfigurationMultipleFormsController.php │ │ ├── DemoGeoCoordinatesFormController.php │ │ └── index.php │ ├── Form │ │ ├── DemoConfigurationChoiceDataConfiguration.php │ │ ├── DemoConfigurationChoiceFormDataProvider.php │ │ ├── DemoConfigurationChoiceType.php │ │ ├── DemoConfigurationGeoCoordinatesType.php │ │ ├── DemoConfigurationOtherDataConfiguration.php │ │ ├── DemoConfigurationOtherFormDataProvider.php │ │ ├── DemoConfigurationOtherType.php │ │ ├── DemoConfigurationTextDataConfiguration.php │ │ ├── DemoConfigurationTextFormDataProvider.php │ │ ├── DemoConfigurationTextType.php │ │ └── index.php │ └── index.php └── views │ ├── index.php │ ├── js │ ├── form.js │ ├── index.php │ └── multipleForms.js │ └── templates │ ├── admin │ ├── form.html.twig │ ├── formGeoCoordinates.html.twig │ ├── index.php │ └── multipleForms.html.twig │ └── index.php ├── demosymfonyformsimple ├── README.md ├── composer.json ├── composer.lock ├── config.xml ├── config │ ├── routes.yml │ └── services.yml ├── demosymfonyformsimple.php ├── src │ ├── Controller │ │ └── DemoConfigurationController.php │ └── Form │ │ ├── DemoConfigurationFormType.php │ │ ├── DemoConfigurationTextDataConfiguration.php │ │ └── DemoConfigurationTextFormDataProvider.php └── views │ └── templates │ └── admin │ └── form.html.twig ├── demovieworderhooks ├── .gitignore ├── README.md ├── composer.json ├── config.xml ├── config │ └── services.yml ├── demovieworderhooks.php ├── logo.png ├── signatures │ └── john_doe.png ├── src │ ├── Collection │ │ └── OrderCollection.php │ ├── DTO │ │ └── Order.php │ ├── Entity │ │ ├── OrderReview.php │ │ ├── OrderSignature.php │ │ └── PackageLocation.php │ ├── Install │ │ ├── FixturesInstaller.php │ │ ├── Installer.php │ │ └── InstallerFactory.php │ ├── Presenter │ │ ├── OrderLinkPresenter.php │ │ ├── OrderReviewPresenter.php │ │ ├── OrderSignaturePresenter.php │ │ ├── OrdersPresenter.php │ │ └── PackageLocationsPresenter.php │ └── Repository │ │ ├── OrderRepository.php │ │ ├── OrderReviewRepository.php │ │ ├── OrderSignatureRepository.php │ │ └── PackageLocationRepository.php ├── tests │ └── phpstan │ │ ├── bootstrap.php │ │ └── phpstan.neon └── views │ └── templates │ └── admin │ ├── card.html.twig │ ├── customer_delivered_orders.html.twig │ ├── customer_orders.html.twig │ ├── customer_satisfaction.html.twig │ ├── customer_signature.html.twig │ ├── order_navigation.html.twig │ ├── tracking.html.twig │ └── tracking_link.html.twig ├── demowsextend ├── README.md ├── config.xml ├── demowsextend.php ├── index.php └── src │ └── Entity │ └── Article.php └── example_module_mailtheme ├── .gitignore ├── LICENSE ├── README.md ├── composer.json ├── composer.lock ├── config.xml ├── config ├── routes.yml └── services.yml ├── example_module_mailtheme.php ├── index.php ├── logo.png ├── mails ├── layouts │ ├── customized_classic_layout.html.twig │ ├── customized_dark_modern_layout.html.twig │ ├── customized_modern_layout.html.twig │ ├── extended_dark_modern_order_conf_layout.html.twig │ └── extended_modern_order_conf_layout.html.twig └── themes │ └── dark_modern │ ├── assets │ ├── baseline-credit_card-24px.png │ ├── baseline-local_shipping-24px.png │ └── baseline-location_on-24px.png │ ├── components │ ├── footer.html.twig │ ├── header.html.twig │ ├── layout.html.twig │ └── order_layout.html.twig │ ├── core │ ├── account.html.twig │ ├── backoffice_order.html.twig │ ├── bankwire.html.twig │ ├── cheque.html.twig │ ├── contact.html.twig │ ├── contact_form.html.twig │ ├── credit_slip.html.twig │ ├── download_product.html.twig │ ├── employee_password.html.twig │ ├── forward_msg.html.twig │ ├── guest_to_customer.html.twig │ ├── import.html.twig │ ├── in_transit.html.twig │ ├── log_alert.html.twig │ ├── newsletter.html.twig │ ├── order_canceled.html.twig │ ├── order_changed.html.twig │ ├── order_conf.html.twig │ ├── order_customer_comment.html.twig │ ├── order_merchant_comment.html.twig │ ├── order_return_state.html.twig │ ├── outofstock.html.twig │ ├── password.html.twig │ ├── password_query.html.twig │ ├── payment.html.twig │ ├── payment_error.html.twig │ ├── preparation.html.twig │ ├── productoutofstock.html.twig │ ├── refund.html.twig │ ├── reply_msg.html.twig │ ├── shipped.html.twig │ ├── test.html.twig │ ├── voucher.html.twig │ └── voucher_new.html.twig │ └── modules │ ├── followup │ ├── followup_1.html.twig │ ├── followup_2.html.twig │ ├── followup_3.html.twig │ └── followup_4.html.twig │ ├── ps_emailalerts │ ├── customer_qty.html.twig │ ├── new_order.html.twig │ ├── order_changed.html.twig │ ├── productcoverage.html.twig │ ├── productoutofstock.html.twig │ └── return_slip.html.twig │ ├── ps_emailsubscription │ ├── newsletter_conf.html.twig │ ├── newsletter_verif.html.twig │ └── newsletter_voucher.html.twig │ └── referralprogram │ ├── referralprogram-congratulations.html.twig │ ├── referralprogram-invitation.html.twig │ └── referralprogram-voucher.html.twig ├── src ├── Controller │ └── Admin │ │ └── DarkThemeController.php ├── DarkThemeSettings.php ├── Form │ └── DarkThemeSettingsType.php └── MailTemplate │ └── Transformation │ └── CustomMessageColorTransformation.php └── views ├── js └── form.js └── templates └── admin └── index.html.twig /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Start a discussion 4 | url: https://github.com/PrestaShop/PrestaShop/discussions/new?category=q-a 5 | about: We use Discussions to discuss example modules, tutorials, ask questions, and more. -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | vendor 3 | -------------------------------------------------------------------------------- /api_module/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | .php-cs-fixer.cache 3 | -------------------------------------------------------------------------------- /api_module/.php-cs-fixer.dist.php: -------------------------------------------------------------------------------- 1 | setUsingCache(true)->getFinder(); 7 | $finder->in(__DIR__)->exclude('vendor'); 8 | 9 | return $config; 10 | -------------------------------------------------------------------------------- /api_module/README.md: -------------------------------------------------------------------------------- 1 | API Module Example 2 | ===================== 3 | 4 | ## About 5 | 6 | This example module demonstrates how to modify PrestaShop's new API. 7 | 8 | ![](example.png) 9 | 10 | ## Install 11 | 12 | 1. Copy the `api_modules` directory into PrestaShop's `modules` directory. 13 | 2. `composer install --node -o` in the module's directory. (`[...]/modules/api_module`) 14 | 3. `bin/console prestashop:module install api_module` in PrestaShop's directory. 15 | 16 | ## License 17 | 18 | This module is released under the [Academic Free License 3.0][AFL-3.0] 19 | 20 | [report-issue]: https://github.com/PrestaShop/PrestaShop/issues/new/choose 21 | [AFL-3.0]: https://opensource.org/licenses/AFL-3.0 22 | -------------------------------------------------------------------------------- /api_module/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/api_module", 3 | "description": "PrestaShop - API Module Example", 4 | "homepage": "https://github.com/PrestaShop", 5 | "license": "AFL-3.0", 6 | "authors": [ 7 | { 8 | "name": "PrestaShop SA", 9 | "email": "contact@prestashop.com" 10 | } 11 | ], 12 | "autoload": { 13 | "psr-4": { 14 | "PrestaShop\\Module\\ApiModule\\": "src/" 15 | } 16 | }, 17 | "require-dev": { 18 | "prestashop/php-dev-tools": "^4.3", 19 | "phpstan/phpstan": "^1.9" 20 | }, 21 | "config": { 22 | "preferred-install": "dist", 23 | "classmap-authoritative": true, 24 | "optimize-autoloader": true, 25 | "prepend-autoloader": false 26 | }, 27 | "type": "prestashop-module" 28 | } 29 | -------------------------------------------------------------------------------- /api_module/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | api_module 4 | 5 | 6 | 7 | 8 | 9 | 0 10 | 0 11 | -------------------------------------------------------------------------------- /api_module/config/services.yml: -------------------------------------------------------------------------------- 1 | services: 2 | PrestaShop\Module\ApiModule\Repository\HorseRepository: 3 | arguments: 4 | - '@doctrine.dbal.default_connection' 5 | - '%database_prefix%' 6 | 7 | PrestaShop\Module\ApiModule\ApiPlatform\State\HorseProvider: 8 | autowire: true 9 | tags: [ 'api_platform.state_provider' ] 10 | 11 | PrestaShop\Module\ApiModule\ApiPlatform\State\HorseProcessor: 12 | autowire: true 13 | 14 | PrestaShop\Module\ApiModule\ApiPlatform\State\CatProvider: 15 | tags: [ 'api_platform.state_provider' ] 16 | 17 | PrestaShop\Module\ApiModule\ApiPlatform\State\CatProcessor: 18 | tags: [ 'api_platform.state_processor' ] 19 | -------------------------------------------------------------------------------- /api_module/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/api_module/example.png -------------------------------------------------------------------------------- /api_module/src/Resources/data/data.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "uuid": "9284ca1e-9403-42c1-9a3f-81e5384a6925", 4 | "name": "Grumpy Cat" 5 | }, 6 | { 7 | "uuid": "7f0be8a6-8d7c-4404-9733-8e81106d2874", 8 | "name": "Garfield" 9 | }, 10 | { 11 | "uuid": "9232bd16-ce13-4dcc-afa3-aa4190f861e6", 12 | "name": "Hello Kitty" 13 | }, 14 | { 15 | "uuid": "02bc0196-5e15-4dd1-94a1-6f6f7f12d25c", 16 | "name": "Grominet" 17 | }, 18 | { 19 | "uuid": "a1399187-668a-45ef-9262-b5e1dc7b927f", 20 | "name": "Tom" 21 | }, 22 | { 23 | "uuid": "8ad8dbb2-5c2c-46bd-b490-3a6d294c91bd", 24 | "name": "Lucifer" 25 | } 26 | ] -------------------------------------------------------------------------------- /api_module/src/Resources/data/install.sql: -------------------------------------------------------------------------------- 1 | -- Hamster (Doctrine entity) 2 | CREATE TABLE IF NOT EXISTS `PREFIX_hamster` (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(64) NOT NULL, description VARCHAR(64) NOT NULL, weight FLOAT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB 3 | 4 | -- Horse (legacy ObjectModel) 5 | CREATE TABLE IF NOT EXISTS `PREFIX_horse` (id_horse INT AUTO_INCREMENT NOT NULL, name VARCHAR(64) NOT NULL, coat_color VARCHAR(64) NOT NULL, weight FLOAT NOT NULL, PRIMARY KEY(id_horse)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB 6 | -------------------------------------------------------------------------------- /api_module/tests/phpstan.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | PS_VERSION=$1 3 | 4 | set -e 5 | 6 | # Docker images prestashop/prestashop may be used, even if the shop remains uninstalled 7 | echo "Pull PrestaShop files (Tag ${PS_VERSION})" 8 | 9 | docker rm -f temp-ps || true 10 | docker volume rm -f ps-volume || true 11 | 12 | docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:$PS_VERSION 13 | 14 | # The nightly image needs more time to unzip the PrestaShop archive 15 | while [[ -z "$(docker exec -t temp-ps ls)" ]]; do sleep 5; done 16 | 17 | # Clear previous instance of the module in the PrestaShop volume 18 | echo "Clear previous module" 19 | 20 | docker exec -t temp-ps rm -rf /var/www/html/modules/keycloak_connector_demo 21 | 22 | # Run a container for PHPStan, having access to the module content and PrestaShop sources. 23 | # This tool is outside the composer.json because of the compatibility with PHP 5.6 24 | echo "Run PHPStan using phpstan-${PS_VERSION}.neon file" 25 | 26 | docker run --rm --volumes-from temp-ps \ 27 | -v $PWD:/var/www/html/modules/keycloak_connector_demo \ 28 | -e _PS_ROOT_DIR_=/var/www/html \ 29 | --workdir=/var/www/html/modules/keycloak_connector_demo ghcr.io/phpstan/phpstan:1.9.8 \ 30 | analyse \ 31 | --configuration=/var/www/html/modules/keycloak_connector_demo/tests/phpstan/phpstan-${PS_VERSION}.neon 32 | -------------------------------------------------------------------------------- /api_module/tests/phpstan/phpstan-nightly.neon: -------------------------------------------------------------------------------- 1 | includes: 2 | - %currentWorkingDirectory%/vendor/prestashop/php-dev-tools/phpstan/ps-module-extension.neon 3 | 4 | parameters: 5 | paths: 6 | - %currentWorkingDirectory% 7 | excludePaths: 8 | - %currentWorkingDirectory%/vendor/ 9 | # We consider that the extension file will be stored the folder test/phpstan 10 | # From Phpstan 0.12, paths are relative to the .neon file. 11 | # - ../../classes 12 | # - ../../controllers 13 | reportUnmatchedIgnoredErrors: false 14 | level: max 15 | -------------------------------------------------------------------------------- /demo_grid/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | .idea 4 | js/node_modules 5 | -------------------------------------------------------------------------------- /demo_grid/README.md: -------------------------------------------------------------------------------- 1 | # Module Demo Grid 2 | 3 | ## About 4 | 5 | This module demonstrates how to use Grid in PrestaShop 9.0.0 and later. 6 | Please note this module is an example only, not a mandatory structure. 7 | 8 | ![Demo Grid screenshot](demo_grid_screenshot.png) 9 | 10 | ### Supported PrestaShop versions 11 | 12 | PrestaShop 9.0.0 and later 13 | 14 | ### Requirements 15 | 16 | 1. Composer, see [Composer](https://getcomposer.org/) to learn more 17 | 18 | #### How to install 19 | 20 | 1. Download or clone module into `modules` directory of your PrestaShop installation 21 | 2. Rename the directory to make sure that module directory is named `demo_grid`* 22 | 3. `cd` into module's directory and run following commands: 23 | - `composer install` - to download dependencies into vendor folder 24 | 4. Install module: 25 | - from Back Office in Module Manager 26 | - using the command `php ./bin/console prestashop:module install demo_grid` 27 | 5. Now you can see an example grid in the Back Office after opening module's configuration page 28 | _* Because the name of the directory and the name of the main module file must match._ 29 | -------------------------------------------------------------------------------- /demo_grid/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/demogrid", 3 | "license": "AFL-3.0", 4 | "authors": [ 5 | { 6 | "name": "PrestaShop Core Team" 7 | } 8 | ], 9 | "require": { 10 | "php": ">=8.1" 11 | }, 12 | "autoload": { 13 | "psr-4": { 14 | "Module\\DemoGrid\\": "src/" 15 | }, 16 | "config": { 17 | "prepend-autoloader": false 18 | }, 19 | "type": "prestashop-module" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /demo_grid/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demo_grid 4 | 5 | 6 | 7 | 8 | 9 | 1 10 | 1 11 | -------------------------------------------------------------------------------- /demo_grid/config/routes.yml: -------------------------------------------------------------------------------- 1 | # @see https://devdocs.prestashop.com/1.7/modules/concepts/controllers/admin-controllers/#how-to-map-an-action-of-your-controller-to-a-uri 2 | demo_grid_index: 3 | path: /demo-grid 4 | methods: [GET] 5 | defaults: 6 | _controller: 'Module\DemoGrid\Controller\Admin\IndexController::indexAction' 7 | _legacy_controller: 'AdminDemoGrid' 8 | _legacy_link: 'AdminDemoGrid' 9 | 10 | demo_grid_search: 11 | path: /demo-grid 12 | methods: [POST] 13 | defaults: 14 | _controller: 'Module\DemoGrid\Controller\Admin\IndexController::searchAction' 15 | _legacy_controller: 'AdminDemoGrid' 16 | _legacy_link: 'AdminDemoGrid:search' 17 | -------------------------------------------------------------------------------- /demo_grid/config/services.yml: -------------------------------------------------------------------------------- 1 | services: 2 | Module\DemoGrid\Controller\Admin\IndexController: 3 | autoconfigure: true 4 | autowire: true 5 | 6 | # Grid services 7 | Module\DemoGrid\Grid\Definition\Factory\ProductGridDefinitionFactory: 8 | parent: 'prestashop.core.grid.definition.factory.abstract_grid_definition' 9 | 10 | Module\DemoGrid\Grid\Query\ProductQueryBuilder: 11 | parent: 'prestashop.core.grid.abstract_query_builder' 12 | autowire: true 13 | 14 | demo_grid.grid.data_provider.products: 15 | class: '%prestashop.core.grid.data.factory.doctrine_grid_data_factory%' 16 | arguments: 17 | - '@Module\DemoGrid\Grid\Query\ProductQueryBuilder' 18 | - '@prestashop.core.hook.dispatcher' 19 | - '@prestashop.core.grid.query.doctrine_query_parser' 20 | - 'product' 21 | 22 | demo_grid.grid.factory.products: 23 | class: 'PrestaShop\PrestaShop\Core\Grid\GridFactory' 24 | public: true 25 | arguments: 26 | - '@Module\DemoGrid\Grid\Definition\Factory\ProductGridDefinitionFactory' 27 | - '@demo_grid.grid.data_provider.products' 28 | - '@prestashop.core.grid.filter.form_factory' 29 | - '@prestashop.core.hook.dispatcher' 30 | -------------------------------------------------------------------------------- /demo_grid/demo_grid_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demo_grid/demo_grid_screenshot.png -------------------------------------------------------------------------------- /demo_grid/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demo_grid/logo.png -------------------------------------------------------------------------------- /demo_grid/src/Grid/Filters/ProductFilters.php: -------------------------------------------------------------------------------- 1 | 17 | * @copyright Since 2007 PrestaShop SA and Contributors 18 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 19 | */ 20 | 21 | declare(strict_types=1); 22 | 23 | namespace Module\DemoGrid\Grid\Filters; 24 | 25 | use Module\DemoGrid\Grid\Definition\Factory\ProductGridDefinitionFactory; 26 | use PrestaShop\PrestaShop\Core\Search\Filters; 27 | 28 | class ProductFilters extends Filters 29 | { 30 | protected $filterId = ProductGridDefinitionFactory::GRID_ID; 31 | 32 | /** 33 | * {@inheritdoc} 34 | */ 35 | public static function getDefaults() 36 | { 37 | return [ 38 | 'limit' => 10, 39 | 'offset' => 0, 40 | 'orderBy' => 'id_product', 41 | 'sortOrder' => 'asc', 42 | 'filters' => [], 43 | ]; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /demo_grid/views/demo_grid.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright since 2007 PrestaShop SA and Contributors 3 | * PrestaShop is an International Registered Trademark & Property of PrestaShop SA 4 | * 5 | * NOTICE OF LICENSE 6 | * 7 | * This source file is subject to the Academic Free License version 3.0 8 | * that is bundled with this package in the file LICENSE.md. 9 | * It is also available through the world-wide-web at this URL: 10 | * https://opensource.org/licenses/AFL-3.0 11 | * If you did not receive a copy of the license and are unable to 12 | * obtain it through the world-wide-web, please send an email 13 | * to license@prestashop.com so we can send you a copy immediately. 14 | * 15 | * @author PrestaShop SA and Contributors 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 18 | */ 19 | 20 | $(() => { 21 | const grid = new window.prestashop.component.Grid('product'); 22 | grid.addExtension(new window.prestashop.component.GridExtensions.SortingExtension()); 23 | grid.addExtension(new window.prestashop.component.GridExtensions.FiltersResetExtension()); 24 | }); 25 | -------------------------------------------------------------------------------- /demo_grid/views/templates/admin/index.html.twig: -------------------------------------------------------------------------------- 1 | {#** 2 | * Copyright since 2007 PrestaShop SA and Contributors 3 | * PrestaShop is an International Registered Trademark & Property of PrestaShop SA 4 | * 5 | * NOTICE OF LICENSE 6 | * 7 | * This source file is subject to the Academic Free License version 3.0 8 | * that is bundled with this package in the file LICENSE.md. 9 | * It is also available through the world-wide-web at this URL: 10 | * https://opensource.org/licenses/AFL-3.0 11 | * If you did not receive a copy of the license and are unable to 12 | * obtain it through the world-wide-web, please send an email 13 | * to license@prestashop.com so we can send you a copy immediately. 14 | * 15 | * @author PrestaShop SA and Contributors 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 18 | *#} 19 | 20 | {% extends '@PrestaShop/Admin/layout.html.twig' %} 21 | 22 | {% block content %} 23 | {% block quotes_list_panel %} 24 |
25 |
26 | {% include '@PrestaShop/Admin/Common/Grid/grid_panel.html.twig' with {'grid': quoteGrid} %} 27 |
28 |
29 | {% endblock %} 30 | {% endblock %} 31 | 32 | {% block javascripts %} 33 | {{ parent() }} 34 | 35 | 36 | 37 | {% endblock %} 38 | -------------------------------------------------------------------------------- /democonsolecommand/README.md: -------------------------------------------------------------------------------- 1 | # Module DemoConsoleCommand 2 | 3 | ## About 4 | 5 | Example module showing how to implement Symfony console command. For more info check Symfony docs https://symfony.com/doc/current/console. 6 | 7 | ![Demo Console Command Screenshot](democonsolecommand-screenshot.png) 8 | 9 | ### Supported PrestaShop versions 10 | 11 | PrestaShop 1.7.7 to PrestaShop 8.1.0 12 | 13 | ### Requirements 14 | 15 | 1. Composer, see [Composer](https://getcomposer.org/) to learn more 16 | 17 | #### How to install: 18 | 1. Copy the module into `modules` directory of your PrestaShop installation 19 | 2. `cd` into the module's directory and run `composer install` to download dependencies into vendor directory 20 | 3. Install the module from the Back Office 21 | 22 | ### How to use the module? 23 | 24 | Run `php bin/console demo:list-manufacturers` from PrestaShop root directory to see the output 25 | -------------------------------------------------------------------------------- /democonsolecommand/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/democonsolecommand", 3 | "license": "AFL-3.0", 4 | "authors": [ 5 | { 6 | "name": "Julius Zukauskas", 7 | "email": "julius.zukauskas@invertus.eu" 8 | }, 9 | { 10 | "name": "PrestaShop Core team" 11 | } 12 | ], 13 | "autoload": { 14 | "psr-4": { 15 | "PrestaShop\\Module\\DemoConsoleCommand\\": "src/" 16 | }, 17 | "config": { 18 | "prepend-autoloader": false 19 | }, 20 | "type": "prestashop-module" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /democonsolecommand/composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "3cbf7d0951fc01a71a06575d5646926a", 8 | "packages": [], 9 | "packages-dev": [], 10 | "aliases": [], 11 | "minimum-stability": "stable", 12 | "stability-flags": [], 13 | "prefer-stable": false, 14 | "prefer-lowest": false, 15 | "platform": [], 16 | "platform-dev": [], 17 | "plugin-api-version": "2.0.0" 18 | } 19 | -------------------------------------------------------------------------------- /democonsolecommand/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | democonsolecommand 4 | 5 | 6 | 7 | 8 | 9 | 0 10 | 1 11 | -------------------------------------------------------------------------------- /democonsolecommand/config/services.yml: -------------------------------------------------------------------------------- 1 | services: 2 | PrestaShop\Module\DemoConsoleCommand\Command\ListManufacturersCommand: 3 | tags: [ console.command ] 4 | -------------------------------------------------------------------------------- /democonsolecommand/democonsolecommand-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/democonsolecommand/democonsolecommand-screenshot.png -------------------------------------------------------------------------------- /democonsolecommand/democonsolecommand.php: -------------------------------------------------------------------------------- 1 | 17 | * @copyright Since 2007 PrestaShop SA and Contributors 18 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 19 | */ 20 | 21 | declare(strict_types=1); 22 | 23 | if (!defined('_PS_VERSION_')) { 24 | exit; 25 | } 26 | 27 | class DemoConsoleCommand extends Module 28 | { 29 | public function __construct() 30 | { 31 | $this->name = 'democonsolecommand'; 32 | $this->author = 'PrestaShop'; 33 | $this->version = '1.0.0'; 34 | $this->ps_versions_compliancy = ['min' => '9.0.0', 'max' => '9.99.99']; 35 | 36 | parent::__construct(); 37 | 38 | $this->displayName = $this->trans('Demo - implement Symfony command for console', [], 'Modules.DemoConsoleCommand.Admin'); 39 | $this->description = $this->trans('Shows example how to implement Symfony command for console', [], 'Modules.DemoConsoleCommand.Admin'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /democonsolecommand/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/democonsolecommand/logo.png -------------------------------------------------------------------------------- /democontrollertabs/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | .idea 4 | js/node_modules 5 | -------------------------------------------------------------------------------- /democontrollertabs/README.md: -------------------------------------------------------------------------------- 1 | # Demo Controller Tabs 2 | 3 | ## About 4 | 5 | This module demonstrates how to create modern Controllers and associate Tabs, it was designed for test purposes and as an example. 6 | 7 | Please note this module is an example only, not a mandatory structure. 8 | 9 | 1. Symfony Controller with permission 10 | 2. Symfony Controller without security 11 | 3. Automatic Tab creation 12 | 4. Manual Tab creation 13 | 5. Silent Tab creation for other controllers (not visible) 14 | 15 | ![Demo Controller Tabs Screenshot](democontrollertabs-screenshot.jpeg) 16 | 17 | ### Supported PrestaShop versions 18 | 19 | PrestaShop 9.0.0 and above. 20 | 21 | ## Requirements 22 | 23 | 1. Composer, see [Composer](https://getcomposer.org/) to learn more 24 | 25 | ## How to install 26 | 27 | 1. Download or clone module into `modules` directory of your PrestaShop installation 28 | 2. Rename the directory to make sure that module directory is named `democontrollertabs`* 29 | 3. `cd` into module's directory and run following commands: 30 | - `composer install` - to download dependencies into vendor folder 31 | 4. Install module: 32 | - from Back Office in Module Manager 33 | - using the command `php ./bin/console prestashop:module install democontrollertabs` 34 | 5. Open the module configuration page to see the example tabs 35 | 36 | *Because the name of the directory and the name of the main module file must match.* 37 | 38 | -------------------------------------------------------------------------------- /democontrollertabs/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/democontrollertabs", 3 | "license": "AFL-3.0", 4 | "authors": [ 5 | { 6 | "name": "Jonathan Lelievre", 7 | "email": "jonathan.lelievre@prestashop.com" 8 | }, 9 | { 10 | "name": "PrestaShop Core Team" 11 | } 12 | ], 13 | "require": { 14 | "php": ">=8.1" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "PrestaShop\\Module\\DemoControllerTabs\\": "src/" 19 | }, 20 | "config": { 21 | "prepend-autoloader": false 22 | }, 23 | "type": "prestashop-module" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /democontrollertabs/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | democontrollertabs 4 | 5 | 6 | 7 | 8 | 9 | 1 10 | 1 11 | -------------------------------------------------------------------------------- /democontrollertabs/config/routes.yml: -------------------------------------------------------------------------------- 1 | # @see https://devdocs.prestashop-project.org/9/modules/concepts/controllers/admin-controllers/#how-to-map-an-action-of-your-controller-to-a-uri 2 | ps_controller_tabs_configure: 3 | path: /configure-tabs 4 | methods: [GET] 5 | defaults: 6 | _controller: 'PrestaShop\Module\DemoControllerTabs\Controller\Admin\ConfigureController::indexAction' 7 | _legacy_controller: 'AdminDemoControllerTabsConfigure' 8 | _legacy_link: 'AdminDemoControllerTabsConfigure' 9 | 10 | ps_controller_tabs_minimalist: 11 | path: /configure-tabs/minimalist 12 | methods: [GET] 13 | defaults: 14 | _controller: 'PrestaShop\Module\DemoControllerTabs\Controller\Admin\MinimalistController::indexAction' 15 | 16 | ps_controller_tabs_secured: 17 | path: /configure-tabs/secured 18 | methods: [GET] 19 | defaults: 20 | _controller: 'PrestaShop\Module\DemoControllerTabs\Controller\Admin\SecuredController::indexAction' 21 | _legacy_controller: 'AdminDemoControllerTabsSecured' 22 | 23 | ps_controller_tabs_manual_tab: 24 | path: /configure-tabs/manual_tab 25 | methods: [GET] 26 | defaults: 27 | _controller: 'PrestaShop\Module\DemoControllerTabs\Controller\Admin\ManualTabController::indexAction' 28 | -------------------------------------------------------------------------------- /democontrollertabs/config/services.yml: -------------------------------------------------------------------------------- 1 | services: 2 | PrestaShop\Module\DemoControllerTabs\Controller\Admin\ConfigureController: 3 | autowire: true 4 | autoconfigure: true 5 | 6 | PrestaShop\Module\DemoControllerTabs\Controller\Admin\ManualTabController: 7 | autowire: true 8 | autoconfigure: true 9 | 10 | PrestaShop\Module\DemoControllerTabs\Controller\Admin\MinimalistController: 11 | autowire: true 12 | autoconfigure: true 13 | 14 | PrestaShop\Module\DemoControllerTabs\Controller\Admin\SecuredController: 15 | autowire: true 16 | autoconfigure: true 17 | -------------------------------------------------------------------------------- /democontrollertabs/democontrollertabs-screenshot.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/democontrollertabs/democontrollertabs-screenshot.jpeg -------------------------------------------------------------------------------- /democontrollertabs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/democontrollertabs/logo.png -------------------------------------------------------------------------------- /demodoctrine/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | .idea 4 | js/node_modules 5 | -------------------------------------------------------------------------------- /demodoctrine/README.md: -------------------------------------------------------------------------------- 1 | # Demo Doctrine 2 | 3 | ## About 4 | 5 | This module demonstrates how to use Doctrine entities in PrestaShop 1.7.7 and above. 6 | 7 | Please note this module is an example only, not a mandatory structure. 8 | 9 | ![Demo Doctrine Screenshot](demodoctrine-screenshot.png) 10 | 11 | ### Supported PrestaShop versions 12 | 13 | PrestaShop 9.0.0 and above. 14 | 15 | ## Requirements 16 | 17 | 1. Composer, see [Composer](https://getcomposer.org/) to learn more 18 | 19 | ## How to install 20 | 21 | 1. Download or clone module into `modules` directory of your PrestaShop installation 22 | 2. Rename the directory to make sure that module directory is named `demodoctrine`* 23 | 3. `cd` into module's directory and run following commands: 24 | - `composer install` - to download dependencies into vendor folder 25 | 4. Install module: 26 | - from Back Office in Module Catalog 27 | - using the command `php ./bin/console prestashop:module install demodoctrine` 28 | 29 | *Because the name of the directory and the name of the main module file must match.* 30 | 31 | ## Other examples 32 | 33 | In this module, we also demonstrated other usecases that you might find useful for building a module. However, they are not mandatory to use in your module. 34 | 35 | ### Using Doctrine ORM to handle persisted models 36 | 37 | We used [Doctrine ORM](https://github.com/doctrine/orm) to manage the persistence of multiple models, instead of PrestaShop ObjectModel ORM. 38 | -------------------------------------------------------------------------------- /demodoctrine/Resources/data/install.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS `PREFIX_quote` (id_quote INT AUTO_INCREMENT NOT NULL, author VARCHAR(255) NOT NULL, date_add DATETIME NOT NULL, date_upd DATETIME NOT NULL, PRIMARY KEY(id_quote)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB 2 | CREATE TABLE IF NOT EXISTS `PREFIX_quote_lang` (id_quote INT NOT NULL, id_lang INT NOT NULL, content LONGTEXT NULL, INDEX IDX_4D76F37E85F48AC4 (id_quote), INDEX IDX_4D76F37EBA299860 (id_lang), PRIMARY KEY(id_quote, id_lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB 3 | -------------------------------------------------------------------------------- /demodoctrine/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/demodoctrine", 3 | "license": "AFL-3.0", 4 | "authors": [ 5 | { 6 | "name": "Jonathan Lelievre", 7 | "email": "jonathan.lelievre@prestashop.com" 8 | }, 9 | { 10 | "name": "PrestaShop Core Team" 11 | } 12 | ], 13 | "require": { 14 | "php": ">=8.1" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "Module\\DemoDoctrine\\": "src/" 19 | }, 20 | "config": { 21 | "prepend-autoloader": false 22 | }, 23 | "type": "prestashop-module" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /demodoctrine/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demodoctrine 4 | 5 | 6 | 7 | 8 | 9 | 1 10 | 1 11 | -------------------------------------------------------------------------------- /demodoctrine/config/common.yml: -------------------------------------------------------------------------------- 1 | services: 2 | Module\DemoDoctrine\Repository\QuoteRepository: 3 | public: true 4 | factory: ['@doctrine.orm.default_entity_manager', getRepository] 5 | arguments: 6 | - Module\DemoDoctrine\Entity\Quote 7 | 8 | Module\DemoDoctrine\Database\QuoteInstaller: 9 | public: true 10 | arguments: 11 | - '@doctrine.dbal.default_connection' 12 | - '%database_prefix%' 13 | -------------------------------------------------------------------------------- /demodoctrine/config/front/services.yml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: ../common.yml } 3 | -------------------------------------------------------------------------------- /demodoctrine/demodoctrine-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demodoctrine/demodoctrine-screenshot.png -------------------------------------------------------------------------------- /demodoctrine/js/.webpack/dev.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const common = require('./common.js'); 3 | 4 | /** 5 | * Returns the development webpack config, 6 | * by merging development specific configuration with the common one. 7 | */ 8 | function devConfig() { 9 | let dev = Object.assign( 10 | common, 11 | { 12 | devtool: 'inline-source-map', 13 | devServer: { 14 | hot: true, 15 | contentBase: path.resolve(__dirname, '/../public'), 16 | publicPath: '/', 17 | }, 18 | } 19 | ); 20 | 21 | return dev; 22 | } 23 | 24 | module.exports = devConfig; 25 | -------------------------------------------------------------------------------- /demodoctrine/js/.webpack/prod.js: -------------------------------------------------------------------------------- 1 | const common = require('./common.js'); 2 | const webpack = require('webpack'); 3 | const keepLicense = require('uglify-save-license'); 4 | 5 | /** 6 | * Returns the production webpack config, 7 | * by merging production specific configuration with the common one. 8 | * 9 | * @param {Boolean} analyze If true, bundle analyze plugin will launch 10 | */ 11 | function prodConfig(analyze) { 12 | let prod = Object.assign( 13 | common, 14 | { 15 | stats: 'minimal', 16 | } 17 | ); 18 | 19 | prod.plugins.push( 20 | new webpack.optimize.UglifyJsPlugin({ 21 | sourceMap: true, 22 | uglifyOptions: { 23 | compress: { 24 | drop_console: true 25 | }, 26 | output: { 27 | comments: keepLicense 28 | } 29 | }, 30 | }) 31 | ); 32 | 33 | return prod; 34 | 35 | } 36 | 37 | module.exports = prodConfig; 38 | -------------------------------------------------------------------------------- /demodoctrine/js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop-demo-doctrine", 3 | "version": "1.0.0", 4 | "description": "PrestaShop Demo Module for Doctrine Entities", 5 | "main": "index.js", 6 | "dependencies": {}, 7 | "devDependencies": { 8 | "babel-core": "^6.26.3", 9 | "babel-loader": "^6", 10 | "babel-preset-env": "^1.6.0", 11 | "babel-preset-es2015": "^6.3.13", 12 | "babel-register": "^6.26.0", 13 | "clean-webpack-plugin": "^0.1.19", 14 | "exports-loader": "^0.6.3", 15 | "expose-loader": "^0.7.5", 16 | "extract-text-webpack-plugin": "^2.1.2", 17 | "file-loader": "^0.10", 18 | "imports-loader": "^0.8.0", 19 | "loader-utils": "^1.4.2", 20 | "uglify-save-license": "^0.4.1", 21 | "uglifyjs-webpack-plugin": "^1.3.0", 22 | "webpack": "^2.7" 23 | }, 24 | "scripts": { 25 | "build": "NODE_ENV=production webpack --progress --colors --debug --display-chunks", 26 | "dev": "webpack --progress --colors --debug --display-chunks --watch", 27 | "watch": "npm run dev", 28 | "test": "echo \"Error: no test specified\" && exit 1" 29 | }, 30 | "author": "", 31 | "license": "AFL-3.0" 32 | } 33 | -------------------------------------------------------------------------------- /demodoctrine/js/quotes/form.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 2007-2020 PrestaShop SA and Contributors 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0). 7 | * It is also available through the world-wide-web at this URL: https://opensource.org/licenses/AFL-3.0 8 | */ 9 | 10 | // Since PrestaShop 1.7.8 you can import components below directly from the window object. 11 | // This is the recommended way to use them as you won't have to do any extra configuration or compilation. 12 | // We keep the old way of importing them for backward compatibility. 13 | // @see: https://devdocs.prestashop-project.org/1.7/development/components/global-components/ 14 | import TranslatableInput from '@components/translatable-input'; 15 | 16 | const $ = window.$; 17 | 18 | $(() => { 19 | new TranslatableInput(); 20 | }); 21 | -------------------------------------------------------------------------------- /demodoctrine/js/webpack.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 2007-2020 PrestaShop SA and Contributors 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0). 7 | * It is also available through the world-wide-web at this URL: https://opensource.org/licenses/AFL-3.0 8 | */ 9 | 10 | /** 11 | * Three mode available: 12 | * build = production mode 13 | * build:analyze = production mode with bundler analyzer 14 | * dev = development mode 15 | */ 16 | module.exports = () => ( 17 | process.env.NODE_ENV === 'production' ? 18 | require('./.webpack/prod.js')() : 19 | require('./.webpack/dev.js')() 20 | ); 21 | -------------------------------------------------------------------------------- /demodoctrine/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demodoctrine/logo.png -------------------------------------------------------------------------------- /demodoctrine/src/Form/QuoteFormDataProvider.php: -------------------------------------------------------------------------------- 1 | repository->findOneById($quoteId); 32 | 33 | $quoteData = [ 34 | 'author' => $quote->getAuthor(), 35 | ]; 36 | foreach ($quote->getQuoteLangs() as $quoteLang) { 37 | $quoteData['content'][$quoteLang->getLang()->getId()] = $quoteLang->getContent(); 38 | } 39 | 40 | return $quoteData; 41 | } 42 | 43 | /** 44 | * {@inheritdoc} 45 | */ 46 | public function getDefaultData() 47 | { 48 | return [ 49 | 'author' => '', 50 | 'content' => [], 51 | ]; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /demodoctrine/src/Grid/Filters/QuoteFilters.php: -------------------------------------------------------------------------------- 1 | 10, 28 | 'offset' => 0, 29 | 'orderBy' => 'id_quote', 30 | 'sortOrder' => 'asc', 31 | 'filters' => [], 32 | ]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /demodoctrine/views/css/quotes.css: -------------------------------------------------------------------------------- 1 | .demo-doctrine-quotes .blockquote { 2 | background-color: #ffffff; 3 | } 4 | 5 | .demo-doctrine-quotes .blockquote-footer { 6 | color: #7a7a7a; 7 | } 8 | -------------------------------------------------------------------------------- /demodoctrine/views/templates/admin/create.html.twig: -------------------------------------------------------------------------------- 1 | {#** 2 | * 2007-2020 PrestaShop SA and Contributors 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0). 7 | * It is also available through the world-wide-web at this URL: https://opensource.org/licenses/AFL-3.0 8 | *#} 9 | 10 | {% extends '@!PrestaShop/Admin/layout.html.twig' %} 11 | {# Since PS 8.0.0 you can use @PrestaShopCore instead of @!Prestashop 12 | (https://devdocs.prestashop-project.org/8/modules/concepts/templating/admin-views/#override-templates) #} 13 | 14 | {% block content %} 15 |
16 |
17 | {% include '@Modules/demodoctrine/views/templates/admin/form.html.twig' %} 18 |
19 |
20 | {% endblock %} 21 | 22 | {% block javascripts %} 23 | {{ parent() }} 24 | 25 | 26 | {% endblock %} 27 | -------------------------------------------------------------------------------- /demodoctrine/views/templates/admin/edit.html.twig: -------------------------------------------------------------------------------- 1 | {#** 2 | * 2007-2020 PrestaShop SA and Contributors 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0). 7 | * It is also available through the world-wide-web at this URL: https://opensource.org/licenses/AFL-3.0 8 | *#} 9 | 10 | {% extends '@!PrestaShop/Admin/layout.html.twig' %} 11 | {# Since PS 8.0.0 you can use @PrestaShopCore instead of @!Prestashop 12 | (https://devdocs.prestashop-project.org/8/modules/concepts/templating/admin-views/#override-templates) #} 13 | 14 | {% block content %} 15 |
16 |
17 | {% include '@Modules/demodoctrine/views/templates/admin/form.html.twig' %} 18 |
19 |
20 | {% endblock %} 21 | 22 | {% block javascripts %} 23 | {{ parent() }} 24 | 25 | 26 | {% endblock %} 27 | -------------------------------------------------------------------------------- /demodoctrine/views/templates/admin/form.html.twig: -------------------------------------------------------------------------------- 1 | {#** 2 | * 2007-2020 PrestaShop SA and Contributors 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0). 7 | * It is also available through the world-wide-web at this URL: https://opensource.org/licenses/AFL-3.0 8 | *#} 9 | 10 | {% import '@PrestaShop/Admin/macros.html.twig' as ps %} 11 | 12 | {% block contact_form %} 13 | {{ form_start(quoteForm) }} 14 |
15 |

16 | mail_outline 17 | {{ 'Quotes'|trans({}, 'Modules.Demodoctrine.Admin') }} 18 |

19 |
20 |
21 | {{ form_errors(quoteForm) }} 22 | 23 | {% block quote_form_rest %} 24 | {{ form_rest(quoteForm) }} 25 | {% endblock %} 26 |
27 |
28 | 36 |
37 | {{ form_end(quoteForm) }} 38 | {% endblock %} 39 | -------------------------------------------------------------------------------- /demodoctrine/views/templates/admin/index.html.twig: -------------------------------------------------------------------------------- 1 | {#** 2 | * 2007-2020 PrestaShop SA and Contributors 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0). 7 | * It is also available through the world-wide-web at this URL: https://opensource.org/licenses/AFL-3.0 8 | *#} 9 | 10 | {% extends '@!PrestaShop/Admin/layout.html.twig' %} 11 | {# Since PS 8.0.0 you can use @PrestaShopCore instead of @!Prestashop 12 | (https://devdocs.prestashop-project.org/8/modules/concepts/templating/admin-views/#override-templates) #} 13 | 14 | {% block content %} 15 | {% block quotes_list_panel %} 16 |
17 |
18 | {% include '@PrestaShop/Admin/Common/Grid/grid_panel.html.twig' with {'grid': quoteGrid} %} 19 |
20 |
21 | {% endblock %} 22 | {% endblock %} 23 | 24 | {% block javascripts %} 25 | {{ parent() }} 26 | 27 | 28 | 29 | {% endblock %} 30 | -------------------------------------------------------------------------------- /demodoctrine/views/templates/front/home.tpl: -------------------------------------------------------------------------------- 1 | {** 2 | * 2007-2018 PrestaShop. 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Academic Free License (AFL 3.0) 7 | * that is bundled with this package in the file LICENSE.txt. 8 | * It is also available through the world-wide-web at this URL: 9 | * http://opensource.org/licenses/afl-3.0.php 10 | * If you did not receive a copy of the license and are unable to 11 | * obtain it through the world-wide-web, please send an email 12 | * to license@prestashop.com so we can send you a copy immediately. 13 | * 14 | * DISCLAIMER 15 | * 16 | * Do not edit or add to this file if you wish to upgrade PrestaShop to newer 17 | * versions in the future. If you wish to customize PrestaShop for your 18 | * needs please refer to http://www.prestashop.com for more information. 19 | * 20 | * @author PrestaShop SA 21 | * @copyright 2007-2018 PrestaShop SA 22 | * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 23 | * International Registered Trademark & Property of PrestaShop SA 24 | *} 25 | 26 |
27 | {foreach $quotes as $quote} 28 |
29 |
30 |

{$quote->getQuoteContent()}

31 |
{$quote->getAuthor()}
32 |
33 |
34 | {/foreach} 35 |
36 | -------------------------------------------------------------------------------- /demoextendgrid/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | .idea 4 | js/node_modules 5 | -------------------------------------------------------------------------------- /demoextendgrid/README.md: -------------------------------------------------------------------------------- 1 | # Demonstration of how to extend grids 2 | 3 | ## About 4 | 5 | This module demonstrates: 6 | * how to insert an additional row action to existing grid 7 | * how to register javascript in admin controller 8 | 9 | The above items are done to add a small 'mark' action in Back Office Orders listing: 10 | 11 | ![Extend Grid Screenshot](extend_grid_screenshot.png) 12 | 13 | ### Supported PrestaShop versions 14 | 15 | PrestaShop 1.7.7 to PrestaShop 8.1. 16 | 17 | ### Requirements 18 | 19 | 1. Composer, see [Composer](https://getcomposer.org/) to learn more 20 | 21 | ### How to install 22 | 23 | 1. Download or clone module into `modules` directory of your PrestaShop installation 24 | 2. Rename the directory to make sure that module directory is named `demoextendgrid`* 25 | 3. `cd` into module's directory and run following commands: 26 | - `composer install` - to download dependencies into vendor folder 27 | 4. Install module from Back Office 28 | 29 | _* Because the name of the directory and the name of the main module file must match._ 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /demoextendgrid/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/demoextendgrid", 3 | "license": "AFL-3.0", 4 | "authors": [ 5 | { 6 | "name": "Julius Zukauskas", 7 | "email": "julius.zukauskas@invertus.eu" 8 | }, 9 | { 10 | "name": "PrestaShop Core team" 11 | } 12 | ], 13 | "autoload": { 14 | "psr-4": { 15 | "PrestaShop\\Module\\DemoExtendGrid\\": "src/" 16 | }, 17 | "config": { 18 | "prepend-autoloader": false 19 | }, 20 | "type": "prestashop-module" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /demoextendgrid/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demoextendgrid 4 | 5 | 6 | 7 | 8 | 9 | 0 10 | 1 11 | -------------------------------------------------------------------------------- /demoextendgrid/config/routes.yml: -------------------------------------------------------------------------------- 1 | demo_admin_orders_mark_order: 2 | path: demoextendgrid/{orderId}/mark-order 3 | methods: [POST] 4 | defaults: 5 | _controller: PrestaShop\Module\DemoExtendGrid\Controller\DemoOrderController::markOrderAction 6 | requirements: 7 | orderId: \d+ 8 | -------------------------------------------------------------------------------- /demoextendgrid/extend_grid_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demoextendgrid/extend_grid_screenshot.png -------------------------------------------------------------------------------- /demoextendgrid/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demoextendgrid/logo.png -------------------------------------------------------------------------------- /demoextendgrid/mark-action-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demoextendgrid/mark-action-screenshot.png -------------------------------------------------------------------------------- /demoextendgrid/src/Controller/DemoOrderController.php: -------------------------------------------------------------------------------- 1 | 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 18 | */ 19 | 20 | declare(strict_types=1); 21 | 22 | namespace PrestaShop\Module\DemoExtendGrid\Controller; 23 | 24 | use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController; 25 | use Symfony\Component\HttpFoundation\Response; 26 | 27 | class DemoOrderController extends FrameworkBundleAdminController 28 | { 29 | /** 30 | * @param int $orderId 31 | * 32 | * @return Response 33 | */ 34 | public function markOrderAction(int $orderId): Response 35 | { 36 | // Do what you need depending on use case 37 | return $this->json(sprintf('Marked order %d', $orderId)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /demoextendgrid/views/js/orders-listing.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright since 2007 PrestaShop SA and Contributors 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0) 7 | * that is bundled with this package in the file LICENSE.txt. 8 | * It is also available through the world-wide-web at this URL: 9 | * https://opensource.org/licenses/AFL-3.0 10 | * If you did not receive a copy of the license and are unable to 11 | * obtain it through the world-wide-web, please send an email 12 | * to license@prestashop.com so we can send you a copy immediately. 13 | * 14 | * @author PrestaShop SA and Contributors 15 | * @copyright Since 2007 PrestaShop SA and Contributors 16 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 17 | */ 18 | $(() => { 19 | $(document).on('click', '.grid-mark-row-link, .js-submit-row-action', (event) => { 20 | event.preventDefault(); 21 | var $currentTarget = $(event.currentTarget) 22 | $.post($currentTarget.data('url')).then((response) => { 23 | // For example we mark the icon by green color when the ajax succeeds 24 | $currentTarget.find('i').addClass('text-success'); 25 | $.growl({ message: response }); 26 | }); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /demoextendsymfonyform1/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | .idea 4 | js/node_modules 5 | -------------------------------------------------------------------------------- /demoextendsymfonyform1/README.md: -------------------------------------------------------------------------------- 1 | # Demonstration of how to insert an input inside a Symfony form 2 | 3 | Learn using identifiable object and grid hooks. 4 | 5 | ## About 6 | 7 | This module adds a new field to Customer: a yes/no field "is allowed to review". 8 | This new field appears: 9 | - in the Customers listing as a new column 10 | - in the Customers Add/Edit form as a new field you can manage 11 | 12 | This modules demonstrates 13 | - how to add this field, manage its content and its 14 | properties using modern hooks in Symfony pages 15 | - how to use Translator inside modern Symfony module 16 | 17 | ![Demo Extended Symfony Form Screenshot - List view](demo_list.png) 18 | ![Demo Extended Symfony Form Screenshot - Form view](demo_form.png) 19 | 20 | ### Details 21 | 22 | This module uses an ObjectModel entity to persist the data submitted by the user. 23 | [Other modules](https://github.com/PrestaShop/example-modules/tree/master/demoextendsymfonyform2) demonstrate 24 | how to use DoctrineORM. 25 | 26 | ### Supported PrestaShop versions 27 | 28 | PrestaShop 9.0.0 and later. 29 | 30 | ### Requirements 31 | 32 | 1. Composer, see [Composer](https://getcomposer.org/) to learn more 33 | 34 | ### How to install 35 | 36 | 1. Download or clone module into `modules` directory of your PrestaShop installation 37 | 2. Rename the directory to make sure that module directory is named `demoextendsymfonyform1`* 38 | 3. `cd` into module's directory and run following commands: 39 | - `composer install` - to download dependencies into vendor folder 40 | 4. Install module from Back Office 41 | 42 | *Because the name of the directory and the name of the main module file must match. 43 | -------------------------------------------------------------------------------- /demoextendsymfonyform1/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/demoextendsymfonyform1", 3 | "license": "AFL-3.0", 4 | "authors": [ 5 | { 6 | "name": "Tomas Ilginis" 7 | }, 8 | { 9 | "name": "PrestaShop Core Team" 10 | } 11 | ], 12 | "require": { 13 | "php": ">=8.1" 14 | }, 15 | "description": "Help developers to understand how to create module using Symfony hooks", 16 | "autoload": { 17 | "psr-4": { 18 | "PrestaShop\\Module\\DemoHowToExtendSymfonyForm\\": "src/" 19 | } 20 | }, 21 | "type": "prestashop-module", 22 | "config": { 23 | "prepend-autoloader": false 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /demoextendsymfonyform1/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demoextendsymfonyform1 4 | 5 | 6 | 7 | 8 | 9 | 0 10 | 0 11 | -------------------------------------------------------------------------------- /demoextendsymfonyform1/config/routes.yml: -------------------------------------------------------------------------------- 1 | # @see https://devdocs.prestashop.com/1.7/modules/concepts/controllers/admin-controllers/#how-to-map-an-action-of-your-controller-to-a-uri 2 | ps_demoextendsymfonyform_toggle_is_allowed_for_review: 3 | path: ps_demoextendsymfonyform/{customerId}/toggle-is-allowed-for-review 4 | methods: [POST] 5 | defaults: 6 | _controller: 'PrestaShop\Module\DemoHowToExtendSymfonyForm\Controller\Admin\CustomerReviewController::toggleIsAllowedForReviewAction' 7 | requirements: 8 | customerId: \d+ 9 | -------------------------------------------------------------------------------- /demoextendsymfonyform1/config/services.yml: -------------------------------------------------------------------------------- 1 | services: 2 | _defaults: 3 | public: true 4 | PrestaShop\Module\DemoHowToExtendSymfonyForm\Repository\ReviewerRepository: 5 | arguments: 6 | - '@doctrine.dbal.default_connection' 7 | - '%database_prefix%' 8 | PrestaShop\Module\DemoHowToExtendSymfonyForm\Controller\Admin\CustomerReviewController: 9 | autoconfigure: true 10 | autowire: true 11 | -------------------------------------------------------------------------------- /demoextendsymfonyform1/demo_form.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demoextendsymfonyform1/demo_form.png -------------------------------------------------------------------------------- /demoextendsymfonyform1/demo_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demoextendsymfonyform1/demo_list.png -------------------------------------------------------------------------------- /demoextendsymfonyform1/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demoextendsymfonyform1/logo.png -------------------------------------------------------------------------------- /demoextendsymfonyform1/src/Entity/Reviewer.php: -------------------------------------------------------------------------------- 1 | 'demoextendsymfonyform_reviewer', 26 | 'primary' => 'id_reviewer', 27 | 'fields' => [ 28 | 'id_customer' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'], 29 | 'is_allowed_for_review' => ['type' => self::TYPE_BOOL, 'validate' => 'isBool'], 30 | ], 31 | ]; 32 | } 33 | -------------------------------------------------------------------------------- /demoextendsymfonyform1/src/Exception/CannotCreateReviewerException.php: -------------------------------------------------------------------------------- 1 | =8.1" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "PrestaShop\\Module\\DemoExtendSymfonyForm\\": "src/" 19 | }, 20 | "config": { 21 | "prepend-autoloader": false 22 | }, 23 | "type": "prestashop-module" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /demoextendsymfonyform2/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demoextendsymfonyform2 4 | 5 | 6 | 7 | 8 | 9 | 0 10 | 1 11 | -------------------------------------------------------------------------------- /demoextendsymfonyform2/config/routes.yml: -------------------------------------------------------------------------------- 1 | admin_suppliers_delete_image: 2 | path: demoextendsymfonyform/{supplierId}/delete-image 3 | methods: [POST] 4 | defaults: 5 | _controller: PrestaShop\Module\DemoExtendSymfonyForm\Controller\DemoSupplierController::deleteExtraImageAction 6 | requirements: 7 | categoryId: \d+ 8 | -------------------------------------------------------------------------------- /demoextendsymfonyform2/config/services.yml: -------------------------------------------------------------------------------- 1 | services: 2 | _defaults: 3 | public: true 4 | 5 | PrestaShop\Module\DemoExtendSymfonyForm\Uploader\SupplierExtraImageUploader: 6 | autowire: true 7 | 8 | PrestaShop\Module\DemoExtendSymfonyForm\Repository\SupplierExtraImageRepository: 9 | factory: ['@doctrine.orm.entity_manager', getRepository] 10 | arguments: 11 | - PrestaShop\Module\DemoExtendSymfonyForm\Entity\SupplierExtraImage 12 | 13 | PrestaShop\Module\DemoExtendSymfonyForm\Controller\DemoSupplierController: 14 | autowire: true 15 | autoconfigure: true 16 | 17 | -------------------------------------------------------------------------------- /demoextendsymfonyform2/demoextendedsymfonyform2-screenshot.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demoextendsymfonyform2/demoextendedsymfonyform2-screenshot.jpeg -------------------------------------------------------------------------------- /demoextendsymfonyform2/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demoextendsymfonyform2/logo.png -------------------------------------------------------------------------------- /demoextendsymfonyform2/src/Repository/SupplierExtraImageRepository.php: -------------------------------------------------------------------------------- 1 | findOneBy(['supplierId' => $supplierId]); 28 | if (!$supplierExtraImage) { 29 | $supplierExtraImage = new SupplierExtraImage(); 30 | $supplierExtraImage->setSupplierId($supplierId); 31 | } 32 | $supplierExtraImage->setImageName($imageName); 33 | 34 | $em = $this->getEntityManager(); 35 | $em->persist($supplierExtraImage); 36 | $em->flush(); 37 | } 38 | 39 | public function deleteExtraImage(SupplierExtraImage $supplierExtraImage) 40 | { 41 | $em = $this->getEntityManager(); 42 | if ($supplierExtraImage) { 43 | $em->remove($supplierExtraImage); 44 | $em->flush(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /demoextendsymfonyform2/src/Sql/SqlQueries.php: -------------------------------------------------------------------------------- 1 | 10 |
11 |
12 | 13 |
14 |
15 | 21 |
22 |
23 | 24 | -------------------------------------------------------------------------------- /demoextendsymfonyform3/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | .idea 4 | js/node_modules 5 | -------------------------------------------------------------------------------- /demoextendsymfonyform3/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/demoextendsymfonyform3", 3 | "description": "Help developers to understand how to create module using new hooks and apply best practices when using CQRS", 4 | "license": "AFL-3.0", 5 | "require": { 6 | "php": ">=8.1" 7 | }, 8 | "autoload": { 9 | "psr-4": { 10 | "DemoCQRSHooksUsage\\": "src/" 11 | } 12 | }, 13 | "type": "prestashop-module" 14 | } 15 | -------------------------------------------------------------------------------- /demoextendsymfonyform3/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demoextendsymfonyform3 4 | 5 | 6 | 7 | 8 | 9 | 0 10 | 0 11 | -------------------------------------------------------------------------------- /demoextendsymfonyform3/config/routes.yml: -------------------------------------------------------------------------------- 1 | # @see https://devdocs.prestashop.com/1.7/modules/concepts/controllers/admin-controllers/#how-to-map-an-action-of-your-controller-to-a-uri 2 | ps_democqrshooksusage_toggle_is_allowed_for_review: 3 | path: demo-cqrs-hook-usage/{customerId}/toggle-is-allowed-for-review 4 | methods: [POST] 5 | defaults: 6 | _controller: 'DemoCQRSHooksUsage\Controller\Admin\CustomerReviewController::toggleIsAllowedForReviewAction' 7 | requirements: 8 | customerId: \d+ 9 | -------------------------------------------------------------------------------- /demoextendsymfonyform3/config/services.yml: -------------------------------------------------------------------------------- 1 | services: 2 | _defaults: 3 | public: true 4 | 5 | democqrshooksusage.domain.reviewer.command_handler.toggle_is_allowed_to_review_handler: 6 | class: 'DemoCQRSHooksUsage\Domain\Reviewer\CommandHandler\ToggleIsAllowedToReviewHandler' 7 | autowire: true 8 | autoconfigure: true 9 | 10 | democqrshooksusage.domain.reviewer.query_handler.get_reviewer_settings_for_form_handler: 11 | class: 'DemoCQRSHooksUsage\Domain\Reviewer\QueryHandler\GetReviewerSettingsForFormHandler' 12 | autowire: true 13 | autoconfigure: true 14 | 15 | democqrshooksusage.domain.reviewer.command_handler.update_is_allowed_to_review_handler: 16 | class: 'DemoCQRSHooksUsage\Domain\Reviewer\CommandHandler\UpdateIsAllowedToReviewHandler' 17 | autowire: true 18 | autoconfigure: true 19 | 20 | DemoCQRSHooksUsage\Repository\ReviewerRepository: 21 | arguments: 22 | - '@doctrine.dbal.default_connection' 23 | - '%database_prefix%' 24 | democqrshooksusage.repository.reviewer: 25 | alias: DemoCQRSHooksUsage\Repository\ReviewerRepository 26 | 27 | DemoCQRSHooksUsage\Controller\Admin\CustomerReviewController: 28 | autowire: true 29 | autoconfigure: true 30 | -------------------------------------------------------------------------------- /demoextendsymfonyform3/democqrshooksusage_form.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demoextendsymfonyform3/democqrshooksusage_form.png -------------------------------------------------------------------------------- /demoextendsymfonyform3/democqrshooksusage_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demoextendsymfonyform3/democqrshooksusage_list.png -------------------------------------------------------------------------------- /demoextendsymfonyform3/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demoextendsymfonyform3/logo.png -------------------------------------------------------------------------------- /demoextendsymfonyform3/src/Domain/Reviewer/Command/ToggleIsAllowedToReviewCommand.php: -------------------------------------------------------------------------------- 1 | customerId = new CustomerId($customerId); 30 | } 31 | 32 | public function getCustomerId(): CustomerId 33 | { 34 | return $this->customerId; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /demoextendsymfonyform3/src/Domain/Reviewer/Command/UpdateIsAllowedToReviewCommand.php: -------------------------------------------------------------------------------- 1 | customerId = new CustomerId($customerId); 32 | } 33 | 34 | public function getCustomerId(): CustomerId 35 | { 36 | return $this->customerId; 37 | } 38 | 39 | public function isAllowedToReview(): bool 40 | { 41 | return $this->isAllowedToReview; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /demoextendsymfonyform3/src/Domain/Reviewer/Exception/CannotCreateReviewerException.php: -------------------------------------------------------------------------------- 1 | customerId = null !== $customerId ? new CustomerId((int) $customerId) : null; 27 | } 28 | 29 | public function getCustomerId(): ?CustomerId 30 | { 31 | return $this->customerId; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /demoextendsymfonyform3/src/Domain/Reviewer/QueryHandler/GetReviewerSettingsForFormHandler.php: -------------------------------------------------------------------------------- 1 | getCustomerId()) { 32 | return new ReviewerSettingsForForm(false); 33 | } 34 | 35 | return new ReviewerSettingsForForm( 36 | $this->reviewerRepository->getIsAllowedToReviewStatus($query->getCustomerId()->getValue()) 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /demoextendsymfonyform3/src/Domain/Reviewer/QueryResult/ReviewerSettingsForForm.php: -------------------------------------------------------------------------------- 1 | isAllowedForReview; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /demoextendsymfonyform3/src/Entity/Reviewer.php: -------------------------------------------------------------------------------- 1 | 'democqrshooksusage_reviewer', 26 | 'primary' => 'id_reviewer', 27 | 'fields' => [ 28 | 'id_customer' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'], 29 | 'is_allowed_for_review' => ['type' => self::TYPE_BOOL, 'validate' => 'isBool'], 30 | ], 31 | ]; 32 | } 33 | -------------------------------------------------------------------------------- /demoextendtemplates/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | -------------------------------------------------------------------------------- /demoextendtemplates/README.md: -------------------------------------------------------------------------------- 1 | # Module demoextendtemplates 2 | 3 | ## About 4 | 5 | This is example module explaining various extendability options of templates 6 | 1. Customize Order page by creating twig template following original order page template path in your module 7 | 2. Override twig blocks that are rendered directly in extended page 8 | 3. Override twig blocks that are used by including other templates in extended page 9 | 4. Add custom flash message type (also includes decoration of controller to show example of custom flash message) 10 | 5. Override flash messages html using macro 11 | 12 | ![Demo Extend Templates Screenshot](demoextendedtemplates-screenshot.jpeg) 13 | 14 | ### Supported PrestaShop versions 15 | 16 | Compatible with 9.0.0 and above versions. 17 | 18 | ### Requirements 19 | 20 | 1. Composer, see [Composer](https://getcomposer.org/) to learn more 21 | 22 | #### How to install: 23 | 1. Copy the module into `modules` directory of your PrestaShop installation 24 | 2. `cd` into the module's directory and run `composer install` to download dependencies into vendor directory 25 | 3. Install the module from Back Office 26 | -------------------------------------------------------------------------------- /demoextendtemplates/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/demoextendtemplates", 3 | "authors": [ 4 | { 5 | "name": "Julius Zukauskas", 6 | "email": "julius.zukauskas@invertus.eu" 7 | }, 8 | { 9 | "name": "PrestaShop Core team" 10 | } 11 | ], 12 | "require": { 13 | "php": ">=8.1" 14 | }, 15 | "autoload": { 16 | "psr-4": { 17 | "PrestaShop\\Module\\DemoExtendTemplates\\": "src/" 18 | }, 19 | "config": { 20 | "prepend-autoloader": false 21 | }, 22 | "type": "prestashop-module" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /demoextendtemplates/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demoextendtemplates 4 | 5 | 6 | 7 | 8 | 9 | 0 10 | 1 11 | 12 | -------------------------------------------------------------------------------- /demoextendtemplates/config/services.yml: -------------------------------------------------------------------------------- 1 | # https://devdocs.prestashop.com/8/modules/concepts/services/ 2 | services: 3 | # The decoration is defined thanks to the #[MapDecorated] attribute in the class itself 4 | PrestaShop\Module\DemoExtendTemplates\Controller\DecoratedOrderController: 5 | autowire: true 6 | autoconfigure: true 7 | -------------------------------------------------------------------------------- /demoextendtemplates/demoextendedtemplates-screenshot.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demoextendtemplates/demoextendedtemplates-screenshot.jpeg -------------------------------------------------------------------------------- /demoextendtemplates/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demoextendtemplates/logo.png -------------------------------------------------------------------------------- /demoextendtemplates/views/css/layout.css: -------------------------------------------------------------------------------- 1 | .alert-demoextendtemplates-success { 2 | background: greenyellow; 3 | } 4 | -------------------------------------------------------------------------------- /demofiltermodules/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | .idea 4 | js/node_modules 5 | -------------------------------------------------------------------------------- /demofiltermodules/README.md: -------------------------------------------------------------------------------- 1 | # Demo filter modules 2 | 3 | ## About 4 | 5 | This module demonstrates how to use a new feature introduced in PrestaShop 8.2.1 to handle filtering of the modules in the front office. 6 | 7 | In this example module, we demonstrate how to filter the list of modules executed for a given hook based on the module's name. Specifically, the module filters `ps_linklist` from the `displayFooter` hook, and both `ps_contactinfo` and `ps_customeraccountlinks` from the `displayFooter` hook when the visited page is the contact page. 8 | 9 | ### Supported PrestaShop versions 10 | 11 | PrestaShop 8.2.1+ 12 | 13 | ## Requirements 14 | 15 | 1. Composer, see [Composer](https://getcomposer.org/) to learn more 16 | 17 | ## How to install 18 | 19 | 1. Download or clone module into `modules` directory of your PrestaShop installation 20 | 2. Rename the directory to make sure that module directory is named `demofiltermodules`* 21 | 3. `cd` into module's directory and run following commands: 22 | - `composer install` - to download dependencies into vendor folder 23 | 4. Install module: 24 | - from Back Office in Module Catalog 25 | - using the command `php ./bin/console prestashop:module install demofiltermodules` 26 | -------------------------------------------------------------------------------- /demofiltermodules/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/demofiltermodules", 3 | "license": "AFL-3.0", 4 | "authors": [ 5 | { 6 | "name": "Krystian Podemski", 7 | "email": "krystian.podemski@prestashop.com" 8 | }, 9 | { 10 | "name": "PrestaShop Team" 11 | } 12 | ], 13 | "autoload": { 14 | "psr-4": { 15 | "Module\\DemoFilterModules\\": "src/" 16 | }, 17 | "config": { 18 | "prepend-autoloader": false 19 | }, 20 | "type": "prestashop-module" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /demofiltermodules/config/common.yml: -------------------------------------------------------------------------------- 1 | services: 2 | Module\DemoFilterModules\Service\CustomModuleList: 3 | tags: 4 | - 'core.hook_module_exec_filter' 5 | -------------------------------------------------------------------------------- /demofiltermodules/config/front/services.yml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: ../common.yml } 3 | -------------------------------------------------------------------------------- /demofiltermodules/config/services.yml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: ./common.yml } 3 | -------------------------------------------------------------------------------- /demofiltermodules/demofiltermodules.php: -------------------------------------------------------------------------------- 1 | name = 'demofiltermodules'; 22 | $this->author = 'PrestaShop'; 23 | $this->version = '1.0.0'; 24 | $this->ps_versions_compliancy = ['min' => '8.2.1', 'max' => '9.99.99']; 25 | 26 | parent::__construct(); 27 | 28 | $this->displayName = $this->l('Demo filter modules'); 29 | $this->description = $this->l('Demonstration of filtering modules in the front office'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /demofiltermodules/src/Service/CustomModuleList.php: -------------------------------------------------------------------------------- 1 | $module) { 18 | if ($module['module'] == 'ps_linklist') { 19 | unset($modules[$index]); 20 | } 21 | 22 | if (\Tools::getValue('controller') == 'contact') { 23 | if ($module['module'] == 'ps_contactinfo' || $module['module'] == 'ps_customeraccountlinks') { 24 | unset($modules[$index]); 25 | } 26 | } 27 | } 28 | } 29 | 30 | return $modules; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /demoformdataproviders/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demoformdataproviders 4 | 5 | 6 | 7 | 8 | 9 | 0 10 | 1 11 | 12 | -------------------------------------------------------------------------------- /demoformdataproviders/index.php: -------------------------------------------------------------------------------- 1 | =8.1" 17 | }, 18 | "autoload": { 19 | "psr-4": { 20 | "PrestaShop\\Module\\DemoJsRouting\\": "src/" 21 | }, 22 | "config": { 23 | "prepend-autoloader": false 24 | }, 25 | "type": "prestashop-module" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /demojsrouting/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demojsrouting 4 | 5 | 6 | 7 | 8 | 9 | 1 10 | 1 11 | -------------------------------------------------------------------------------- /demojsrouting/config/routes.yml: -------------------------------------------------------------------------------- 1 | demo_page_index: 2 | path: demo-page/ 3 | methods: [GET] 4 | defaults: 5 | _controller: PrestaShop\Module\DemoJsRouting\Controller\DemoPageController::indexAction 6 | _legacy_controller: 'DemoPageController' 7 | _legacy_link: 'DemoPageController' 8 | -------------------------------------------------------------------------------- /demojsrouting/config/services.yml: -------------------------------------------------------------------------------- 1 | services: 2 | _defaults: 3 | public: true 4 | 5 | PrestaShop\Module\DemoJsRouting\Controller\DemoPageController: 6 | autowire: true 7 | autoconfigure: true 8 | -------------------------------------------------------------------------------- /demojsrouting/demojsrouting_screenshot.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demojsrouting/demojsrouting_screenshot.jpeg -------------------------------------------------------------------------------- /demojsrouting/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demojsrouting/logo.png -------------------------------------------------------------------------------- /demojsrouting/src/Controller/DemoPageController.php: -------------------------------------------------------------------------------- 1 | 17 | * @copyright Since 2007 PrestaShop SA and Contributors 18 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 19 | */ 20 | 21 | declare(strict_types=1); 22 | 23 | namespace PrestaShop\Module\DemoJsRouting\Controller; 24 | 25 | use PrestaShopBundle\Controller\Admin\PrestaShopAdminController; 26 | use Symfony\Component\HttpFoundation\Response; 27 | 28 | class DemoPageController extends PrestaShopAdminController 29 | { 30 | public function indexAction(): Response 31 | { 32 | return $this->render('@Modules/demojsrouting/views/templates/admin/demo_page.html.twig'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /demojsrouting/src/Install/Installer.php: -------------------------------------------------------------------------------- 1 | 17 | * @copyright Since 2007 PrestaShop SA and Contributors 18 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 19 | */ 20 | declare(strict_types=1); 21 | 22 | namespace PrestaShop\Module\DemoJsRouting\Install; 23 | 24 | use Module; 25 | 26 | class Installer 27 | { 28 | /** 29 | * Module's installation entry point. 30 | */ 31 | public function install(Module $module): bool 32 | { 33 | if (!$this->registerHooks($module)) { 34 | return false; 35 | } 36 | 37 | return true; 38 | } 39 | 40 | /** 41 | * Register hooks for the module. 42 | * 43 | * @see https://devdocs.prestashop-project.org/9/modules/concepts/hooks/ 44 | */ 45 | private function registerHooks(Module $module): bool 46 | { 47 | $hooks = []; 48 | 49 | return (bool) $module->registerHook($hooks); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /demojsrouting/views/templates/admin/demo_page.html.twig: -------------------------------------------------------------------------------- 1 | {% extends '@PrestaShop/Admin/layout.html.twig' %} 2 | 3 | {% block content %} 4 |
5 |
6 |

Demo JS Routing

7 |
8 |
9 |
10 | 11 | 12 |
13 |
14 | 15 |
16 | 17 |
18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
EmailFullname
29 |
30 |
31 |
32 | {% endblock %} 33 | 34 | {% block javascripts %} 35 | {{ parent() }} 36 | 37 | {% endblock %} 38 | -------------------------------------------------------------------------------- /demomoduleroutes/README.md: -------------------------------------------------------------------------------- 1 | # Demo Moduleroutes 2 | 3 | ## About 4 | 5 | This module illustrates using the [moduleRoutes hook](https://devdocs.prestashop-project.org/8/modules/concepts/hooks/list-of-hooks/moduleroutes/) in a module. 6 | 7 | It creates two `ModuleFrontController` controllers, extends default PrestaShop routes with two custom ones, and maps them to those controllers. 8 | 9 | You can find more information in [moduleRoutes hook on the devdocs](https://devdocs.prestashop-project.org/8/modules/concepts/hooks/list-of-hooks/moduleroutes/). 10 | 11 | ## Supported PrestaShop versions 12 | 13 | `hookModuleRoutes` was added in PrestaShop 1.5.3, but this module is compatible with 8.0.0 and above versions. 14 | 15 | ### How to install 16 | 17 | - Copy the module into `modules` directory of your PrestaShop installation 18 | - Install the module from Back Office or from CLI 19 | 20 | ### How to test 21 | 22 | - Enable `Friendly URL` in Back Office > Shop Parameters > Traffic & Seo 23 | - Access: 24 | - _yourdomain_/_installdir_/demomoduleroutes/list 25 | - _yourdomain_/_installdir_/demomoduleroutes/show/1/abc -------------------------------------------------------------------------------- /demomoduleroutes/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demomoduleroutes 4 | 5 | 6 | 7 | 8 | 9 | 0 10 | 1 11 | -------------------------------------------------------------------------------- /demomoduleroutes/controllers/front/index.php: -------------------------------------------------------------------------------- 1 | 23 | * @copyright Since 2007 PrestaShop SA and Contributors 24 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 25 | */ 26 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 27 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 28 | 29 | header('Cache-Control: no-store, no-cache, must-revalidate'); 30 | header('Cache-Control: post-check=0, pre-check=0', false); 31 | header('Pragma: no-cache'); 32 | 33 | header('Location: ../'); 34 | exit; 35 | -------------------------------------------------------------------------------- /demomoduleroutes/controllers/front/list.php: -------------------------------------------------------------------------------- 1 | setTemplate('module:demomoduleroutes/views/templates/front/list.tpl'); 12 | } 13 | } -------------------------------------------------------------------------------- /demomoduleroutes/controllers/front/show.php: -------------------------------------------------------------------------------- 1 | context->smarty->assign( 12 | // remember that it's just a demo module, always sanitize the input data! 13 | [ 14 | 'id' => Tools::getValue('id'), 15 | 'slug' => Tools::getValue('slug') 16 | ] 17 | ); 18 | 19 | $this->setTemplate('module:demomoduleroutes/views/templates/front/show.tpl'); 20 | } 21 | } -------------------------------------------------------------------------------- /demomoduleroutes/controllers/index.php: -------------------------------------------------------------------------------- 1 | 23 | * @copyright Since 2007 PrestaShop SA and Contributors 24 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 25 | */ 26 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 27 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 28 | 29 | header('Cache-Control: no-store, no-cache, must-revalidate'); 30 | header('Cache-Control: post-check=0, pre-check=0', false); 31 | header('Pragma: no-cache'); 32 | 33 | header('Location: ../'); 34 | exit; 35 | -------------------------------------------------------------------------------- /demomoduleroutes/index.php: -------------------------------------------------------------------------------- 1 | 23 | * @copyright Since 2007 PrestaShop SA and Contributors 24 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 25 | */ 26 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 27 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 28 | 29 | header('Cache-Control: no-store, no-cache, must-revalidate'); 30 | header('Cache-Control: post-check=0, pre-check=0', false); 31 | header('Pragma: no-cache'); 32 | 33 | header('Location: ../'); 34 | exit; 35 | -------------------------------------------------------------------------------- /demomoduleroutes/views/templates/front/list.tpl: -------------------------------------------------------------------------------- 1 | List template -------------------------------------------------------------------------------- /demomoduleroutes/views/templates/front/show.tpl: -------------------------------------------------------------------------------- 1 | Show template, id is {$id}, slug is {$slug} -------------------------------------------------------------------------------- /demomultistoreform/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | js/node_modules 4 | -------------------------------------------------------------------------------- /demomultistoreform/Resources/contentBlocks.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "title": "First block title", 4 | "description": "Description first block", 5 | "enable": true 6 | }, 7 | { 8 | "title": "Second block title", 9 | "description": "Description second block", 10 | "enable": true 11 | }, 12 | { 13 | "title": "Third block title", 14 | "description": "Description third block", 15 | "enable": false 16 | }, 17 | { 18 | "title": "Fourth block title", 19 | "description": "Description Fourth block", 20 | "enable": false 21 | }, 22 | { 23 | "title": "Fifth block title", 24 | "description": "Description Fifth block", 25 | "enable": false 26 | } 27 | ] 28 | -------------------------------------------------------------------------------- /demomultistoreform/Resources/install.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS PREFIX_content_block (id_content_block INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, description LONGTEXT NOT NULL, enable TINYINT(1) NOT NULL, PRIMARY KEY(id_content_block)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB; 2 | CREATE TABLE IF NOT EXISTS PREFIX_content_block_shop (id_content_block INT NOT NULL, id_shop INT NOT NULL, INDEX IDX_80518F36D6F01295 (id_content_block), INDEX IDX_80518F36274A50A0 (id_shop), PRIMARY KEY(id_content_block, id_shop)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB; 3 | ALTER TABLE PREFIX_content_block_shop ADD CONSTRAINT FK_80518F36D6F01295 FOREIGN KEY (id_content_block) REFERENCES PREFIX_content_block (id_content_block); 4 | ALTER TABLE PREFIX_content_block_shop ADD CONSTRAINT FK_80518F36274A50A0 FOREIGN KEY (id_shop) REFERENCES PREFIX_shop (id_shop) ON DELETE CASCADE; 5 | -------------------------------------------------------------------------------- /demomultistoreform/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/demomultistoreform", 3 | "description": "PrestaShop - multistore form example", 4 | "homepage": "https://github.com/PrestaShop/example-modules", 5 | "license": "AFL-3.0", 6 | "authors": [ 7 | { 8 | "name": "PrestaShop Core Team" 9 | } 10 | ], 11 | "autoload": { 12 | "psr-4": { 13 | "PrestaShop\\Module\\DemoMultistoreForm\\": "src/" 14 | } 15 | }, 16 | "require": { 17 | "php": ">=8.1" 18 | }, 19 | "config": { 20 | "preferred-install": "dist", 21 | "prepend-autoloader": false 22 | }, 23 | "type": "prestashop-module" 24 | } 25 | -------------------------------------------------------------------------------- /demomultistoreform/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demomultistoreform 4 | 5 | 6 | 7 | 8 | 9 | 1 10 | 0 11 | -------------------------------------------------------------------------------- /demomultistoreform/config/index.php: -------------------------------------------------------------------------------- 1 | 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 18 | */ 19 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 20 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 21 | 22 | header('Cache-Control: no-store, no-cache, must-revalidate'); 23 | header('Cache-Control: post-check=0, pre-check=0', false); 24 | header('Pragma: no-cache'); 25 | 26 | header('Location: ../'); 27 | exit; 28 | -------------------------------------------------------------------------------- /demomultistoreform/demomultistore_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demomultistoreform/demomultistore_screenshot.png -------------------------------------------------------------------------------- /demomultistoreform/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demomultistoreform/logo.png -------------------------------------------------------------------------------- /demomultistoreform/src/Controller/index.php: -------------------------------------------------------------------------------- 1 | 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 18 | */ 19 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 20 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 21 | 22 | header('Cache-Control: no-store, no-cache, must-revalidate'); 23 | header('Cache-Control: post-check=0, pre-check=0', false); 24 | header('Pragma: no-cache'); 25 | 26 | header('Location: ../'); 27 | exit; 28 | -------------------------------------------------------------------------------- /demomultistoreform/src/Entity/index.php: -------------------------------------------------------------------------------- 1 | 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 18 | */ 19 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 20 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 21 | 22 | header('Cache-Control: no-store, no-cache, must-revalidate'); 23 | header('Cache-Control: post-check=0, pre-check=0', false); 24 | header('Pragma: no-cache'); 25 | 26 | header('Location: ../'); 27 | exit; 28 | -------------------------------------------------------------------------------- /demomultistoreform/src/Form/index.php: -------------------------------------------------------------------------------- 1 | 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 18 | */ 19 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 20 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 21 | 22 | header('Cache-Control: no-store, no-cache, must-revalidate'); 23 | header('Cache-Control: post-check=0, pre-check=0', false); 24 | header('Pragma: no-cache'); 25 | 26 | header('Location: ../'); 27 | exit; 28 | -------------------------------------------------------------------------------- /demomultistoreform/src/Grid/Definition/Factory/index.php: -------------------------------------------------------------------------------- 1 | 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 18 | */ 19 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 20 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 21 | 22 | header('Cache-Control: no-store, no-cache, must-revalidate'); 23 | header('Cache-Control: post-check=0, pre-check=0', false); 24 | header('Pragma: no-cache'); 25 | 26 | header('Location: ../'); 27 | exit; 28 | -------------------------------------------------------------------------------- /demomultistoreform/src/Grid/Definition/index.php: -------------------------------------------------------------------------------- 1 | 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 18 | */ 19 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 20 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 21 | 22 | header('Cache-Control: no-store, no-cache, must-revalidate'); 23 | header('Cache-Control: post-check=0, pre-check=0', false); 24 | header('Pragma: no-cache'); 25 | 26 | header('Location: ../'); 27 | exit; 28 | -------------------------------------------------------------------------------- /demomultistoreform/src/Grid/Query/index.php: -------------------------------------------------------------------------------- 1 | 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 18 | */ 19 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 20 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 21 | 22 | header('Cache-Control: no-store, no-cache, must-revalidate'); 23 | header('Cache-Control: post-check=0, pre-check=0', false); 24 | header('Pragma: no-cache'); 25 | 26 | header('Location: ../'); 27 | exit; 28 | -------------------------------------------------------------------------------- /demomultistoreform/src/index.php: -------------------------------------------------------------------------------- 1 | 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 18 | */ 19 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 20 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 21 | 22 | header('Cache-Control: no-store, no-cache, must-revalidate'); 23 | header('Cache-Control: post-check=0, pre-check=0', false); 24 | header('Pragma: no-cache'); 25 | 26 | header('Location: ../'); 27 | exit; 28 | -------------------------------------------------------------------------------- /demomultistoreform/views/index.php: -------------------------------------------------------------------------------- 1 | 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 18 | */ 19 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 20 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 21 | 22 | header('Cache-Control: no-store, no-cache, must-revalidate'); 23 | header('Cache-Control: post-check=0, pre-check=0', false); 24 | header('Pragma: no-cache'); 25 | 26 | header('Location: ../'); 27 | exit; 28 | -------------------------------------------------------------------------------- /demomultistoreform/views/js/createForm.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright since 2007 PrestaShop SA and Contributors 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0) 7 | * that is bundled with this package in the file LICENSE.txt. 8 | * It is also available through the world-wide-web at this URL: 9 | * https://opensource.org/licenses/AFL-3.0 10 | * If you did not receive a copy of the license and are unable to 11 | * obtain it through the world-wide-web, please send an email 12 | * to license@prestashop.com so we can send you a copy immediately. 13 | * 14 | * @author PrestaShop SA and Contributors 15 | * @copyright Since 2007 PrestaShop SA and Contributors 16 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 17 | */ 18 | 19 | $(document).ready(function () { 20 | const choiceTree = new window.prestashop.component.ChoiceTree('#content_block_shop_association'); 21 | choiceTree.enableAutoCheckChildren(); 22 | }); 23 | -------------------------------------------------------------------------------- /demomultistoreform/views/js/form.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright since 2007 PrestaShop SA and Contributors 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0) 7 | * that is bundled with this package in the file LICENSE.txt. 8 | * It is also available through the world-wide-web at this URL: 9 | * https://opensource.org/licenses/AFL-3.0 10 | * If you did not receive a copy of the license and are unable to 11 | * obtain it through the world-wide-web, please send an email 12 | * to license@prestashop.com so we can send you a copy immediately. 13 | * 14 | * @author PrestaShop SA and Contributors 15 | * @copyright Since 2007 PrestaShop SA and Contributors 16 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 17 | */ 18 | 19 | $(document).ready(function () { 20 | window.prestashop.component.initComponents( 21 | [ 22 | 'MultistoreConfigField', 23 | 'Grid', 24 | ], 25 | ); 26 | const contentBlockGrid = new window.prestashop.component.Grid('block_content'); 27 | contentBlockGrid.addExtension(new prestashop.component.GridExtensions.AsyncToggleColumnExtension()); 28 | }); 29 | -------------------------------------------------------------------------------- /demomultistoreform/views/js/index.php: -------------------------------------------------------------------------------- 1 | 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 18 | */ 19 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 20 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 21 | 22 | header('Cache-Control: no-store, no-cache, must-revalidate'); 23 | header('Cache-Control: post-check=0, pre-check=0', false); 24 | header('Pragma: no-cache'); 25 | 26 | header('Location: ../'); 27 | exit; 28 | -------------------------------------------------------------------------------- /demomultistoreform/views/templates/admin/index.php: -------------------------------------------------------------------------------- 1 | 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 18 | */ 19 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 20 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 21 | 22 | header('Cache-Control: no-store, no-cache, must-revalidate'); 23 | header('Cache-Control: post-check=0, pre-check=0', false); 24 | header('Pragma: no-cache'); 25 | 26 | header('Location: ../'); 27 | exit; 28 | -------------------------------------------------------------------------------- /demomultistoreform/views/templates/hook/displayBlockContent.tpl: -------------------------------------------------------------------------------- 1 | {foreach from=$contentBlockList item=contentBlock} 2 |
3 |

{$contentBlock.title}

4 |

5 | {$contentBlock.description} 6 |

7 |
8 | {/foreach} 9 | -------------------------------------------------------------------------------- /demomultistoreform/views/templates/index.php: -------------------------------------------------------------------------------- 1 | 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 18 | */ 19 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 20 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 21 | 22 | header('Cache-Control: no-store, no-cache, must-revalidate'); 23 | header('Cache-Control: post-check=0, pre-check=0', false); 24 | header('Pragma: no-cache'); 25 | 26 | header('Location: ../'); 27 | exit; 28 | -------------------------------------------------------------------------------- /demooverrideobjectmodel/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | .idea 4 | -------------------------------------------------------------------------------- /demooverrideobjectmodel/README.md: -------------------------------------------------------------------------------- 1 | # Module DemoOverrideObjectModel 2 | 3 | ## About 4 | 5 | Example module showing how to override an ObjectModel (in this case the manufacturer) and add a custom field in the database table. 6 | 7 | ### Supported PrestaShop versions 8 | 9 | Tested on 9.0.0, but same principle applies to all versions. 10 | 11 | ### Requirements 12 | 13 | 1. Composer, see [Composer](https://getcomposer.org/) to learn more 14 | 15 | #### How to install: 16 | 1. Copy the module into `modules` directory of your PrestaShop installation 17 | 2. `cd` into the module's directory and run `composer install` to download dependencies into vendor directory 18 | 3. Install the module from Back Office 19 | -------------------------------------------------------------------------------- /demooverrideobjectmodel/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/demooverrideobjectmodel", 3 | "authors": [ 4 | { 5 | "name": "Julius Zukauskas", 6 | "email": "julius.zukauskas@invertus.eu" 7 | }, 8 | { 9 | "name": "PrestaShop Core team" 10 | } 11 | ], 12 | "require": { 13 | "php": ">=8.1" 14 | }, 15 | "autoload": { 16 | "psr-4": { 17 | "PrestaShop\\Module\\DemoOverrideObjectModel\\": "src/" 18 | }, 19 | "config": { 20 | "prepend-autoloader": false 21 | }, 22 | "type": "prestashop-module" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /demooverrideobjectmodel/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demooverrideobjectmodel 4 | 5 | 6 | 7 | 8 | 9 | 0 10 | 1 11 | -------------------------------------------------------------------------------- /demooverrideobjectmodel/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demooverrideobjectmodel/logo.png -------------------------------------------------------------------------------- /demooverrideobjectmodel/override/classes/Manufacturer.php: -------------------------------------------------------------------------------- 1 | self::TYPE_STRING, 'size' => 64]; 21 | parent::__construct($id, $idLang); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /demooverrideobjectmodel/src/Install/install.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE _DB_PREFIX_manufacturer ADD `code` VARCHAR(64) NOT NULL DEFAULT ''; 2 | -------------------------------------------------------------------------------- /demooverrideobjectmodel/src/Install/uninstall.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE _DB_PREFIX_manufacturer DROP COLUMN `code`; 2 | -------------------------------------------------------------------------------- /demoproductextracontent/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demoproductextracontent 4 | 5 | 6 | 7 | 8 | 9 | 0 10 | 1 11 | -------------------------------------------------------------------------------- /demoproductextracontent/index.php: -------------------------------------------------------------------------------- 1 | in([ 6 | __DIR__.'/src', 7 | ]); 8 | 9 | return (new PhpCsFixer\Config()) 10 | ->setRiskyAllowed(true) 11 | ->setRules([ 12 | '@Symfony' => true, 13 | 'array_indentation' => true, 14 | 'cast_spaces' => [ 15 | 'space' => 'single', 16 | ], 17 | 'combine_consecutive_issets' => true, 18 | 'concat_space' => [ 19 | 'spacing' => 'one', 20 | ], 21 | 'error_suppression' => [ 22 | 'mute_deprecation_error' => false, 23 | 'noise_remaining_usages' => false, 24 | 'noise_remaining_usages_exclude' => [], 25 | ], 26 | 'function_to_constant' => false, 27 | 'method_chaining_indentation' => true, 28 | 'no_alias_functions' => false, 29 | 'no_superfluous_phpdoc_tags' => false, 30 | 'non_printable_character' => [ 31 | 'use_escape_sequences_in_strings' => true, 32 | ], 33 | 'phpdoc_align' => [ 34 | 'align' => 'left', 35 | ], 36 | 'phpdoc_summary' => false, 37 | 'protected_to_private' => false, 38 | 'psr_autoloading' => false, 39 | 'self_accessor' => false, 40 | 'yoda_style' => false, 41 | 'single_line_throw' => false, 42 | 'no_alias_language_construct_call' => false, 43 | ]) 44 | ->setFinder($finder) 45 | ->setCacheFile(__DIR__.'/.php_cs.cache'); 46 | -------------------------------------------------------------------------------- /demoproductform/README.md: -------------------------------------------------------------------------------- 1 | # Module demoproductform 2 | 3 | ## About 4 | 5 | This is example module explaining various extendability options in product page form (from v9.0.0): 6 | 1. Add custom text field in product form basic tab 7 | 2. Save custom text field into database using dedicated object model 8 | 3. Show how to use ProductCommandsBuilder (specific to new Product page) 9 | 4. Use Module [modern translation system](https://devdocs.prestashop.com/8/modules/creation/module-translation/new-system/) 10 | 11 | ### Supported PrestaShop versions 12 | 13 | Compatible with 9.0.0 and above versions. 14 | 15 | ### Requirements 16 | 17 | 1. Composer, see [Composer](https://getcomposer.org/) to learn more 18 | 19 | #### How to install: 20 | 1. Copy the module into `modules` directory of your PrestaShop installation 21 | 2. `cd` into the module's directory and run `composer install --no-dev` (the --no-dev is important) to download dependencies into vendor directory 22 | 3. Install the module from Back Office 23 | -------------------------------------------------------------------------------- /demoproductform/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/demoproductform", 3 | "authors": [ 4 | { 5 | "name": "Julius Zukauskas", 6 | "email": "julius.zukauskas@invertus.eu" 7 | }, 8 | { 9 | "name": "PrestaShop Core team" 10 | } 11 | ], 12 | "autoload": { 13 | "psr-4": { 14 | "PrestaShop\\Module\\DemoProductForm\\": "src/" 15 | }, 16 | "config": { 17 | "prepend-autoloader": false 18 | }, 19 | "type": "prestashop-module" 20 | }, 21 | "require-dev": { 22 | "friendsofphp/php-cs-fixer": "^3.14" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /demoproductform/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demoproductform 4 | 5 | 6 | 7 | 8 | 9 | 0 10 | 1 11 | 12 | -------------------------------------------------------------------------------- /demoproductform/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demoproductform/logo.png -------------------------------------------------------------------------------- /demoproductform/src/Install/install.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS `PREFIX_demoproductform_custom_product` 2 | ( 3 | `id` INT(11) UNSIGNED NOT NULL UNIQUE, 4 | `custom_field` VARCHAR(255) NOT NULL DEFAULT '', 5 | `custom_price` decimal(20, 6) NOT NULL DEFAULT '0.000000', 6 | `date_add` DATETIME NOT NULL, 7 | `date_upd` DATETIME NOT NULL, 8 | PRIMARY KEY(`id`) 9 | ) ENGINE = ENGINE_TYPE DEFAULT CHARSET = utf8; 10 | 11 | CREATE TABLE IF NOT EXISTS `PREFIX_demoproductform_custom_product_attribute` 12 | ( 13 | `id` INT(11) UNSIGNED NOT NULL UNIQUE, 14 | `custom_field` VARCHAR(255) NOT NULL DEFAULT '', 15 | `custom_price` decimal(20, 6) NOT NULL DEFAULT '0.000000', 16 | `date_add` DATETIME NOT NULL, 17 | `date_upd` DATETIME NOT NULL, 18 | PRIMARY KEY(`id`) 19 | ) ENGINE = ENGINE_TYPE DEFAULT CHARSET = utf8; 20 | -------------------------------------------------------------------------------- /demoproductform/src/Install/uninstall.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `PREFIX_demoproductform_custom_product`; 2 | DROP TABLE IF EXISTS `PREFIX_demoproductform_custom_product_attribute`; 3 | -------------------------------------------------------------------------------- /demoproductform/views/templates/admin/FormTheme/product_tab_content_form_theme.html.twig: -------------------------------------------------------------------------------- 1 | {#** 2 | * Copyright since 2007 PrestaShop SA and Contributors 3 | * PrestaShop is an International Registered Trademark & Property of PrestaShop SA 4 | * 5 | * NOTICE OF LICENSE 6 | * 7 | * This source file is subject to the Academic Free License version 3.0 8 | * that is bundled with this package in the file LICENSE.md. 9 | * It is also available through the world-wide-web at this URL: 10 | * https://opensource.org/licenses/AFL-3.0 11 | * If you did not receive a copy of the license and are unable to 12 | * obtain it through the world-wide-web, please send an email 13 | * to license@prestashop.com so we can send you a copy immediately. 14 | * 15 | * @author PrestaShop SA and Contributors 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 18 | *#} 19 | 20 | {% extends '@PrestaShop/Admin/TwigTemplateForm/prestashop_ui_kit_base.html.twig' %} 21 | 22 | {% block custom_tab_content_widget %} 23 |
24 | {{ 'This is your custom tab content'|trans({}, 'Modules.Demoproductform.Admin') }} 25 |
26 | 27 |

28 | {{ 'Custom price'|trans({}, 'Modules.Demoproductform.Admin') }}: {{ custom_price }} 29 |

30 | {% endblock %} 31 | -------------------------------------------------------------------------------- /demoproductform/views/templates/admin/extra_module.html.twig: -------------------------------------------------------------------------------- 1 | {#** 2 | * Copyright since 2007 PrestaShop SA and Contributors 3 | * PrestaShop is an International Registered Trademark & Property of PrestaShop SA 4 | * 5 | * NOTICE OF LICENSE 6 | * 7 | * This source file is subject to the Academic Free License version 3.0 8 | * that is bundled with this package in the file LICENSE.md. 9 | * It is also available through the world-wide-web at this URL: 10 | * https://opensource.org/licenses/AFL-3.0 11 | * If you did not receive a copy of the license and are unable to 12 | * obtain it through the world-wide-web, please send an email 13 | * to license@prestashop.com so we can send you a copy immediately. 14 | * 15 | * @author PrestaShop SA and Contributors 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 18 | *#} 19 | 20 |
21 |

{{ 'Custom product details'|trans({}, 'Modules.Demoproductform.Admin') }}

22 | 23 |
24 | 25 |
{{ customProduct.custom_field }}
26 |
27 |
28 | 29 |
{{ customProduct.custom_price|price_format }}
30 |
31 |
32 | -------------------------------------------------------------------------------- /demosymfonyform/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | .idea 4 | js/node_modules 5 | -------------------------------------------------------------------------------- /demosymfonyform/README.md: -------------------------------------------------------------------------------- 1 | # Demonstration of how to use PrestaShop Symfony form types 2 | 3 | ## About 4 | 5 | This module demonstrates how to use existing PrestaShop Symfony form types inside a new page. 6 | 7 | It provides two demo pages where all possible [form types](https://symfony.com/doc/current/reference/forms/types.html) 8 | are being used. You can use these pages as examples of how to integrate these inputs in a module. 9 | 10 | ![Demo Symfony Form Screenshot](demosymfonyform-screenshot.jpeg) 11 | 12 | ### Supported PrestaShop versions 13 | 14 | This module is compatible with PS >= 9.0 versions only. 15 | 16 | ### Requirements 17 | 18 | 1. Composer, see [Composer](https://getcomposer.org/) to learn more 19 | 20 | ### How to install 21 | 22 | 1. Download or clone module into `modules` directory of your PrestaShop installation 23 | 2. Rename the directory to make sure that module directory is named `demosymfonyform`* 24 | 3. `cd` into module's directory and run following commands: 25 | - `composer install` - to download dependencies into vendor folder 26 | 4. Install module from Back Office 27 | 28 | _* Because the name of the directory and the name of the main module file must match._ 29 | -------------------------------------------------------------------------------- /demosymfonyform/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/demosymfonyform", 3 | "description": "PrestaShop - Form Examples", 4 | "license": "AFL-3.0", 5 | "authors": [ 6 | { 7 | "name": "PrestaShop Core Team" 8 | } 9 | ], 10 | "autoload": { 11 | "psr-4": { 12 | "PrestaShop\\Module\\DemoSymfonyForm\\": "src/" 13 | } 14 | }, 15 | "require": { 16 | "php": ">=7.1.0" 17 | }, 18 | "config": { 19 | "preferred-install": "dist", 20 | "prepend-autoloader": false 21 | }, 22 | "type": "prestashop-module" 23 | } 24 | -------------------------------------------------------------------------------- /demosymfonyform/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demosymfonyform 4 | 5 | 6 | 7 | 8 | 9 | 1 10 | 0 11 | -------------------------------------------------------------------------------- /demosymfonyform/config/index.php: -------------------------------------------------------------------------------- 1 | 17 | * @copyright Since 2007 PrestaShop SA and Contributors 18 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 19 | */ 20 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 21 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 22 | 23 | header('Cache-Control: no-store, no-cache, must-revalidate'); 24 | header('Cache-Control: post-check=0, pre-check=0', false); 25 | header('Pragma: no-cache'); 26 | 27 | header('Location: ../'); 28 | exit; 29 | -------------------------------------------------------------------------------- /demosymfonyform/config/routes.yml: -------------------------------------------------------------------------------- 1 | demo_configuration_form: 2 | path: /demosymfonyform/configuration 3 | methods: [GET, POST] 4 | defaults: 5 | _controller: 'PrestaShop\Module\DemoSymfonyForm\Controller\DemoConfigurationController::index' 6 | # Needed to work with tab system 7 | _legacy_controller: AdminDemoSymfonyForm 8 | _legacy_link: AdminDemoSymfonyForm 9 | 10 | demo_configuration_multiple_forms: 11 | path: /demosymfonyform/configurationMultipleForms 12 | methods: [GET] 13 | defaults: 14 | _controller: 'PrestaShop\Module\DemoSymfonyForm\Controller\DemoConfigurationMultipleFormsController::index' 15 | _legacy_controller: AdminDemoSymfonyFormMultipleForms 16 | _legacy_link: AdminDemoSymfonyFormMultipleForms 17 | 18 | demo_configuration_choices_form_save: 19 | path: /demosymfonyform/configurationMultipleForms/saveChoices 20 | methods: [ POST ] 21 | defaults: 22 | _controller: 'PrestaShop\Module\DemoSymfonyForm\Controller\DemoConfigurationMultipleFormsController::saveChoicesForm' 23 | 24 | demo_configuration_other_form_save: 25 | path: /demosymfonyform/configurationMultipleForms/saveOther 26 | methods: [ POST ] 27 | defaults: 28 | _controller: 'PrestaShop\Module\DemoSymfonyForm\Controller\DemoConfigurationMultipleFormsController::saveOtherForm' 29 | 30 | demo_geocoordinates_form: 31 | path: /demosymfonyform/geoCoordinatesForm 32 | methods: [GET, POST] 33 | defaults: 34 | _controller: 'PrestaShop\Module\DemoSymfonyForm\Controller\DemoGeoCoordinatesFormController::index' 35 | # Needed to work with tab system 36 | _legacy_controller: AdminDemoSymfonyForm 37 | _legacy_link: AdminDemoSymfonyForm -------------------------------------------------------------------------------- /demosymfonyform/demosymfonyform-screenshot.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demosymfonyform/demosymfonyform-screenshot.jpeg -------------------------------------------------------------------------------- /demosymfonyform/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demosymfonyform/logo.png -------------------------------------------------------------------------------- /demosymfonyform/src/Controller/index.php: -------------------------------------------------------------------------------- 1 | 17 | * @copyright Since 2007 PrestaShop SA and Contributors 18 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 19 | */ 20 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 21 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 22 | 23 | header('Cache-Control: no-store, no-cache, must-revalidate'); 24 | header('Cache-Control: post-check=0, pre-check=0', false); 25 | header('Pragma: no-cache'); 26 | 27 | header('Location: ../'); 28 | exit; 29 | -------------------------------------------------------------------------------- /demosymfonyform/src/Form/index.php: -------------------------------------------------------------------------------- 1 | 17 | * @copyright Since 2007 PrestaShop SA and Contributors 18 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 19 | */ 20 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 21 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 22 | 23 | header('Cache-Control: no-store, no-cache, must-revalidate'); 24 | header('Cache-Control: post-check=0, pre-check=0', false); 25 | header('Pragma: no-cache'); 26 | 27 | header('Location: ../'); 28 | exit; 29 | -------------------------------------------------------------------------------- /demosymfonyform/src/index.php: -------------------------------------------------------------------------------- 1 | 23 | * @copyright Since 2007 PrestaShop SA and Contributors 24 | * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) 25 | */ 26 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 27 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 28 | 29 | header('Cache-Control: no-store, no-cache, must-revalidate'); 30 | header('Cache-Control: post-check=0, pre-check=0', false); 31 | header('Pragma: no-cache'); 32 | 33 | header('Location: ../'); 34 | exit; 35 | -------------------------------------------------------------------------------- /demosymfonyform/views/index.php: -------------------------------------------------------------------------------- 1 | 17 | * @copyright Since 2007 PrestaShop SA and Contributors 18 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 19 | */ 20 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 21 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 22 | 23 | header('Cache-Control: no-store, no-cache, must-revalidate'); 24 | header('Cache-Control: post-check=0, pre-check=0', false); 25 | header('Pragma: no-cache'); 26 | 27 | header('Location: ../'); 28 | exit; 29 | -------------------------------------------------------------------------------- /demosymfonyform/views/js/form.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright since 2007 PrestaShop SA and Contributors 3 | * PrestaShop is an International Registered Trademark & Property of PrestaShop SA 4 | * 5 | * NOTICE OF LICENSE 6 | * 7 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0) 8 | * that is bundled with this package in the file LICENSE.md. 9 | * It is also available through the world-wide-web at this URL: 10 | * https://opensource.org/licenses/AFL-3.0 11 | * If you did not receive a copy of the license and are unable to 12 | * obtain it through the world-wide-web, please send an email 13 | * to license@prestashop.com so we can send you a copy immediately. 14 | * 15 | * @author PrestaShop SA 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 18 | */ 19 | 20 | $(document).ready(function () { 21 | // Learn more about components in documentation 22 | // https://devdocs.prestashop.com/1.7/development/components/global-components/ 23 | window.prestashop.component.initComponents( 24 | [ 25 | 'TranslatableField', 26 | 'TinyMCEEditor', 27 | 'TranslatableInput', 28 | 'GeneratableInput', 29 | 'TextWithLengthCounter', 30 | ], 31 | ); 32 | 33 | window.prestashop.instance.generatableInput.attachOn('.js-generator-btn'); 34 | new window.prestashop.component.ChoiceTree('#form_category_choice_tree_type'); 35 | }); 36 | -------------------------------------------------------------------------------- /demosymfonyform/views/js/index.php: -------------------------------------------------------------------------------- 1 | 17 | * @copyright Since 2007 PrestaShop SA and Contributors 18 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 19 | */ 20 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 21 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 22 | 23 | header('Cache-Control: no-store, no-cache, must-revalidate'); 24 | header('Cache-Control: post-check=0, pre-check=0', false); 25 | header('Pragma: no-cache'); 26 | 27 | header('Location: ../'); 28 | exit; 29 | -------------------------------------------------------------------------------- /demosymfonyform/views/js/multipleForms.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright since 2007 PrestaShop SA and Contributors 3 | * PrestaShop is an International Registered Trademark & Property of PrestaShop SA 4 | * 5 | * NOTICE OF LICENSE 6 | * 7 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0) 8 | * that is bundled with this package in the file LICENSE.md. 9 | * It is also available through the world-wide-web at this URL: 10 | * https://opensource.org/licenses/AFL-3.0 11 | * If you did not receive a copy of the license and are unable to 12 | * obtain it through the world-wide-web, please send an email 13 | * to license@prestashop.com so we can send you a copy immediately. 14 | * 15 | * @author PrestaShop SA 16 | * @copyright Since 2007 PrestaShop SA and Contributors 17 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 18 | */ 19 | 20 | $(document).ready(function () { 21 | window.prestashop.component.initComponents( 22 | [ 23 | 'ChoiceTable', 24 | 'MultipleChoiceTable' 25 | ], 26 | ); 27 | 28 | new window.prestashop.component.ChoiceTree('#form_category_choice_tree_type'); 29 | new window.prestashop.component.ChoiceTree('#form_material_choice_tree_type'); 30 | new window.prestashop.component.ChoiceTree('#form_shop_choices_tree_type').enableAutoCheckChildren(); 31 | }); 32 | 33 | -------------------------------------------------------------------------------- /demosymfonyform/views/templates/admin/index.php: -------------------------------------------------------------------------------- 1 | 17 | * @copyright Since 2007 PrestaShop SA and Contributors 18 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 19 | */ 20 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 21 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 22 | 23 | header('Cache-Control: no-store, no-cache, must-revalidate'); 24 | header('Cache-Control: post-check=0, pre-check=0', false); 25 | header('Pragma: no-cache'); 26 | 27 | header('Location: ../'); 28 | exit; 29 | -------------------------------------------------------------------------------- /demosymfonyform/views/templates/index.php: -------------------------------------------------------------------------------- 1 | 17 | * @copyright Since 2007 PrestaShop SA and Contributors 18 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 19 | */ 20 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 21 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 22 | 23 | header('Cache-Control: no-store, no-cache, must-revalidate'); 24 | header('Cache-Control: post-check=0, pre-check=0', false); 25 | header('Pragma: no-cache'); 26 | 27 | header('Location: ../'); 28 | exit; 29 | -------------------------------------------------------------------------------- /demosymfonyformsimple/README.md: -------------------------------------------------------------------------------- 1 | # Demonstration of how to use Symfony form types for Module configuration pages 2 | 3 | ## About 4 | 5 | In this module, you will learn how to utilize Symfony form types to create configuration pages for your module. 6 | 7 | [This module has been created by following a guide from the developer documentation](https://devdocs.prestashop-project.org/8/modules/creation/adding-configuration-page-modern/). 8 | 9 | It provides a simple configuration page for a module with a Text Field. This text field value is stored [using the Configuration component](https://devdocs.prestashop-project.org/8/development/components/configuration/). 10 | 11 | ## Supported PrestaShop versions 12 | 13 | This module has been tested with PrestaShop 9. 14 | 15 | ## Requirements 16 | 17 | Composer 18 | 19 | ## How to install 20 | 21 | Download or clone the module into the modules directory of your PrestaShop installation. 22 | 23 | `cd` into module's directory and run following commands: 24 | 25 | `composer install` - to download dependencies into vendor folder 26 | 27 | Install the module from Back Office or via CLI. 28 | -------------------------------------------------------------------------------- /demosymfonyformsimple/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/demosymfonyformsimple", 3 | "description": "PrestaShop - Settings Form Examples", 4 | "license": "AFL-3.0", 5 | "authors": [ 6 | { 7 | "name": "PrestaShop Core Team" 8 | } 9 | ], 10 | "autoload": { 11 | "psr-4": { 12 | "PrestaShop\\Module\\DemoSymfonyFormSimple\\": "src/" 13 | } 14 | }, 15 | "require": { 16 | "php": ">=7.2.5" 17 | }, 18 | "config": { 19 | "preferred-install": "dist", 20 | "prepend-autoloader": false 21 | }, 22 | "type": "prestashop-module" 23 | } -------------------------------------------------------------------------------- /demosymfonyformsimple/composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "f3d3c88cd3861737a48999c0f383fa15", 8 | "packages": [], 9 | "packages-dev": [], 10 | "aliases": [], 11 | "minimum-stability": "stable", 12 | "stability-flags": {}, 13 | "prefer-stable": false, 14 | "prefer-lowest": false, 15 | "platform": { 16 | "php": ">=7.2.5" 17 | }, 18 | "platform-dev": {}, 19 | "plugin-api-version": "2.6.0" 20 | } 21 | -------------------------------------------------------------------------------- /demosymfonyformsimple/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demosymfonyformsimple 4 | 5 | 6 | 7 | 8 | 9 | 1 10 | 0 11 | -------------------------------------------------------------------------------- /demosymfonyformsimple/config/routes.yml: -------------------------------------------------------------------------------- 1 | demo_configuration_form_simple: 2 | path: /demosymfonyformsimple/configuration 3 | methods: [GET, POST] 4 | defaults: 5 | _controller: 'PrestaShop\Module\DemoSymfonyFormSimple\Controller\DemoConfigurationController::index' 6 | # Needed to work with tab system 7 | _legacy_controller: AdminDemoSymfonyFormSimple 8 | _legacy_link: AdminDemoSymfonyFormSimple -------------------------------------------------------------------------------- /demosymfonyformsimple/config/services.yml: -------------------------------------------------------------------------------- 1 | services: 2 | _defaults: 3 | public: true 4 | 5 | PrestaShop\Module\DemoSymfonyFormSimple\Controller\DemoConfigurationController: 6 | autowire: true 7 | autoconfigure: true 8 | 9 | # Demo configuration text form 10 | prestashop.module.demosymfonyformsimple.form.type.demo_configuration_text: 11 | class: 'PrestaShop\Module\DemoSymfonyFormSimple\Form\DemoConfigurationFormType' 12 | parent: 'form.type.translatable.aware' 13 | public: true 14 | tags: 15 | - { name: form.type } 16 | 17 | prestashop.module.demosymfonyformsimple.form.demo_configuration_text_data_configuration: 18 | class: PrestaShop\Module\DemoSymfonyFormSimple\Form\DemoConfigurationTextDataConfiguration 19 | arguments: ['@prestashop.adapter.legacy.configuration'] 20 | 21 | prestashop.module.demosymfonyformsimple.form.demo_configuration_text_form_data_provider: 22 | class: 'PrestaShop\Module\DemoSymfonyFormSimple\Form\DemoConfigurationTextFormDataProvider' 23 | arguments: 24 | - '@prestashop.module.demosymfonyformsimple.form.demo_configuration_text_data_configuration' 25 | 26 | prestashop.module.demosymfonyformsimple.form.demo_configuration_text_form_data_handler: 27 | class: 'PrestaShop\PrestaShop\Core\Form\Handler' 28 | arguments: 29 | - '@form.factory' 30 | - '@prestashop.core.hook.dispatcher' 31 | - '@prestashop.module.demosymfonyformsimple.form.demo_configuration_text_form_data_provider' 32 | - 'PrestaShop\Module\DemoSymfonyFormSimple\Form\DemoConfigurationFormType' 33 | - 'DemoConfiguration' 34 | -------------------------------------------------------------------------------- /demosymfonyformsimple/demosymfonyformsimple.php: -------------------------------------------------------------------------------- 1 | name = 'demosymfonyformsimple'; 12 | $this->author = 'PrestaShop'; 13 | $this->version = '1.0.0'; 14 | $this->need_instance = 0; 15 | 16 | $this->bootstrap = true; 17 | parent::__construct(); 18 | 19 | $this->displayName = $this->trans('Demo of the Symfony-based configuration form', [], 'Modules.DemoSymfonyFormSimple.Admin'); 20 | $this->description = $this->trans( 21 | 'Module demonstrates a simple module\'s configuration page made with Symfony.', 22 | [], 23 | 'Modules.DemoSymfonyFormSimple.Admin' 24 | ); 25 | 26 | $this->ps_versions_compliancy = ['min' => '9.0.0', 'max' => '9.99.99']; 27 | } 28 | 29 | public function getContent() 30 | { 31 | $route = $this->get('router')->generate('demo_configuration_form_simple'); 32 | Tools::redirectAdmin($route); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /demosymfonyformsimple/src/Form/DemoConfigurationFormType.php: -------------------------------------------------------------------------------- 1 | add('config_text', TextType::class, [ 18 | 'label' => $this->trans('Configuration text', 'Modules.DemoSymfonyFormSimple.Admin'), 19 | 'help' => $this->trans('Maximum 32 characters', 'Modules.DemoSymfonyFormSimple.Admin'), 20 | ]); 21 | } 22 | 23 | public function configureOptions(OptionsResolver $resolver) 24 | { 25 | parent::configureOptions($resolver); 26 | $resolver->setDefaults([ 27 | 'form_theme' => '@PrestaShop/Admin/TwigTemplateForm/prestashop_ui_kit.html.twig', 28 | ]); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /demosymfonyformsimple/src/Form/DemoConfigurationTextFormDataProvider.php: -------------------------------------------------------------------------------- 1 | demoConfigurationTextDataConfiguration = $demoConfigurationTextDataConfiguration; 25 | } 26 | 27 | public function getData(): array 28 | { 29 | return $this->demoConfigurationTextDataConfiguration->getConfiguration(); 30 | } 31 | 32 | public function setData(array $data): array 33 | { 34 | return $this->demoConfigurationTextDataConfiguration->updateConfiguration($data); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /demosymfonyformsimple/views/templates/admin/form.html.twig: -------------------------------------------------------------------------------- 1 | {% extends '@PrestaShop/Admin/layout.html.twig' %} 2 | 3 | {% block content %} 4 | {{ form_start(demoConfigurationForm) }} 5 |
6 |

7 | settings {{ 'Text form types'|trans({}, 'Modules.DemoSymfonyFormSimple.Admin') }} 8 |

9 |
10 |
11 | {{ form_widget(demoConfigurationForm) }} 12 |
13 |
14 | 21 |
22 | {{ form_end(demoConfigurationForm) }} 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /demovieworderhooks/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | .idea -------------------------------------------------------------------------------- /demovieworderhooks/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/demovieworderhooks", 3 | "description": "Demonstration of new hooks in PrestaShop 1.7.7 order view page.", 4 | "license": "AFL-3.0", 5 | "authors": [ 6 | { 7 | "name": "Rokas Zygmantas", 8 | "email": "rokas.zygmantas@invertus.eu" 9 | }, 10 | { 11 | "name": "Tadas Davidsonas", 12 | "email": "tadas.davidsonas@invertus.eu" 13 | }, 14 | { 15 | "name": "PrestaShop Core Team" 16 | } 17 | ], 18 | "require": { 19 | "php": ">=8.1", 20 | "joshtronic/php-loremipsum": "^1.0" 21 | }, 22 | "autoload": { 23 | "psr-4": { 24 | "PrestaShop\\Module\\DemoViewOrderHooks\\": "src/" 25 | }, 26 | "config": { 27 | "prepend-autoloader": false 28 | }, 29 | "type": "prestashop-module" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /demovieworderhooks/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demovieworderhooks 4 | 5 | 6 | 7 | 8 | 9 | 0 10 | 1 11 | 12 | -------------------------------------------------------------------------------- /demovieworderhooks/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demovieworderhooks/logo.png -------------------------------------------------------------------------------- /demovieworderhooks/signatures/john_doe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/demovieworderhooks/signatures/john_doe.png -------------------------------------------------------------------------------- /demovieworderhooks/src/Collection/OrderCollection.php: -------------------------------------------------------------------------------- 1 | orderId; 30 | } 31 | 32 | public function getReference(): string 33 | { 34 | return $this->reference; 35 | } 36 | 37 | public function getOrderStateId(): int 38 | { 39 | return $this->orderStateId; 40 | } 41 | 42 | public function getOrderDate(): DateTimeImmutable 43 | { 44 | return $this->orderDate; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /demovieworderhooks/src/Install/InstallerFactory.php: -------------------------------------------------------------------------------- 1 | $orderId ? $this->urlGenerator->generate('admin_orders_view', ['orderId' => $orderId]) : null, 31 | 'enabled' => $orderId !== null, 32 | 'text' => $order->reference, 33 | ]; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /demovieworderhooks/src/Presenter/OrderReviewPresenter.php: -------------------------------------------------------------------------------- 1 | $orderReview->getComment(), 23 | 'score' => $orderReview->getScore(), 24 | ]; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /demovieworderhooks/src/Presenter/OrderSignaturePresenter.php: -------------------------------------------------------------------------------- 1 | getOrderId()); 29 | $customer = $order->getCustomer(); 30 | $gender = new Gender($customer->id_gender, $languageId); 31 | 32 | return [ 33 | 'firstName' => $customer->firstname, 34 | 'lastName' => $customer->lastname, 35 | 'gender' => $gender->name, 36 | 'imagePath' => $this->signatureImgDir.$orderSignature->getFilename() 37 | ]; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /demovieworderhooks/src/Repository/OrderReviewRepository.php: -------------------------------------------------------------------------------- 1 | findOneBy(['orderId' => $orderId]); 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /demovieworderhooks/src/Repository/PackageLocationRepository.php: -------------------------------------------------------------------------------- 1 | 12 |
13 |

14 | {% block card_title %} 15 | {% endblock %} 16 |

17 |
18 | 19 |
20 | {% block card_body %} 21 | {% endblock %} 22 |
23 |
24 | -------------------------------------------------------------------------------- /demovieworderhooks/views/templates/admin/customer_orders.html.twig: -------------------------------------------------------------------------------- 1 | {#** 2 | * 2007-2020 PrestaShop 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0). 7 | * It is also available through the world-wide-web at this URL: https://opensource.org/licenses/AFL-3.0 8 | *#} 9 | 10 | {% extends '@Modules/demovieworderhooks/views/templates/admin/card.html.twig' %} 11 | 12 | {% block card_title %} 13 | {{ 'Other orders from this customer'|trans }} 14 | {% endblock %} 15 | 16 | {% block card_body %} 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | {% for order in orders %} 29 | 30 | 35 | 42 | 45 | 48 | 49 | {% endfor %} 50 | 51 |
{{ 'Reference'|trans }}{{ 'Status'|trans }}{{ 'Total paid'|trans }}{{ 'Placed at'|trans }}
31 | 32 | {{ order.reference }} 33 | 34 | 36 | 39 | {{ order.status.name }} 40 | 41 | 43 | {{ order.totalPaid }} 44 | 46 | {{ order.placedAt|date_format_full }} 47 |
52 |
53 | {% endblock %} 54 | -------------------------------------------------------------------------------- /demovieworderhooks/views/templates/admin/customer_satisfaction.html.twig: -------------------------------------------------------------------------------- 1 | {#** 2 | * 2007-2020 PrestaShop 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0). 7 | * It is also available through the world-wide-web at this URL: https://opensource.org/licenses/AFL-3.0 8 | *#} 9 | 10 | {% extends '@Modules/demovieworderhooks/views/templates/admin/card.html.twig' %} 11 | 12 | {% block card_title %} 13 | {{ 'Customer\'s review'|trans }} 14 | {% endblock %} 15 | 16 | {% block card_body %} 17 |
18 |
19 |
20 |
{{ 'Review:'|trans }}
21 |
22 | 23 | {% if orderReview.score == 0 %} 24 | sentiment_very_dissatisfied 25 | {% elseif orderReview.score == 1 %} 26 | sentiment_dissatisfied 27 | {% elseif orderReview.score == 2 %} 28 | sentiment_satisfied 29 | {% else %} 30 | sentiment_very_satisfied 31 | {% endif %} 32 | ({{ '%score% out of 3'|trans({ '%score%': orderReview.score }) }}) 33 |
34 |
35 |
{{ 'Comment:'|trans }}
36 |
37 |
38 | {{ orderReview.comment }} 39 |
40 |
41 |
42 |
43 | {% endblock %} 44 | -------------------------------------------------------------------------------- /demovieworderhooks/views/templates/admin/customer_signature.html.twig: -------------------------------------------------------------------------------- 1 | {#** 2 | * 2007-2020 PrestaShop 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0). 7 | * It is also available through the world-wide-web at this URL: https://opensource.org/licenses/AFL-3.0 8 | *#} 9 | 10 | {% extends '@Modules/demovieworderhooks/views/templates/admin/card.html.twig' %} 11 | 12 | {% block card_title %} 13 | {{ 'Signature'|trans }} 14 | {% endblock %} 15 | 16 | {% block card_body %} 17 |
18 |
19 | {{ signature.gender }} {{ signature.firstName }} {{ signature.lastName }} 20 |
21 |
22 | 23 |
24 |
25 | {% endblock %} 26 | -------------------------------------------------------------------------------- /demovieworderhooks/views/templates/admin/order_navigation.html.twig: -------------------------------------------------------------------------------- 1 | {#** 2 | * 2007-2020 PrestaShop 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0). 7 | * It is also available through the world-wide-web at this URL: https://opensource.org/licenses/AFL-3.0 8 | *#} 9 | 10 | {% trans_default_domain 'Module.Demovieworderhooks.Admin' %} 11 | 12 |
13 |
14 | {% if previousOrder.enabled %} 15 | 16 | {{ 'Previous'|trans }} ({{ previousOrder.text }}) 17 | arrow_back 18 | 19 | {% endif %} 20 |
21 | 22 |
23 | {% if nextOrder.enabled %} 24 | 25 | {{ 'Next'|trans }} ({{ nextOrder.text }}) 26 | arrow_forward 27 | 28 | {% endif %} 29 |
30 |
31 | -------------------------------------------------------------------------------- /demovieworderhooks/views/templates/admin/tracking.html.twig: -------------------------------------------------------------------------------- 1 | {#** 2 | * 2007-2020 PrestaShop 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0). 7 | * It is also available through the world-wide-web at this URL: https://opensource.org/licenses/AFL-3.0 8 | *#} 9 | 10 | {% trans_default_domain 'Module.Demovieworderhooks.Admin' %} 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | {% if packageLocations is empty %} 22 | 23 | 24 | 25 | 26 | {% else %} 27 | {% for packageLocation in packageLocations %} 28 | 29 | 30 | 39 | 40 | {% endfor %} 41 | {% endif %} 42 | 43 |
{{ 'Location'|trans }}{{ 'Arrival date'|trans }}
--
{{ packageLocation.location }} 31 | {% if not packageLocation.hasArrived %} 32 | 33 | {{ packageLocation.date }} 34 | 35 | {% else %} 36 | {{ packageLocation.date }} 37 | {% endif %} 38 |
44 |
45 | -------------------------------------------------------------------------------- /demovieworderhooks/views/templates/admin/tracking_link.html.twig: -------------------------------------------------------------------------------- 1 | {#** 2 | * 2007-2020 PrestaShop 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Academic Free License 3.0 (AFL-3.0). 7 | * It is also available through the world-wide-web at this URL: https://opensource.org/licenses/AFL-3.0 8 | *#} 9 | 10 | {% trans_default_domain 'Module.Demovieworderhooks.Admin' %} 11 | 12 | 26 | -------------------------------------------------------------------------------- /demowsextend/README.md: -------------------------------------------------------------------------------- 1 | # Demo on how to add a Resource to the WebService 2 | 3 | ## About 4 | 5 | This module adds a resource managed by ObjectModel to the WebService. 6 | 7 | ## Supported PrestaShop versions 8 | 9 | Compatible with 1.7.8 and above versions. 10 | 11 | ### How to install 12 | 13 | - Copy the module into `modules` directory of your PrestaShop installation 14 | - Install the module from Back Office or from CLI -------------------------------------------------------------------------------- /demowsextend/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | demowsextend 4 | 5 | 6 | 7 | 8 | 9 | 0 10 | 1 11 | -------------------------------------------------------------------------------- /demowsextend/index.php: -------------------------------------------------------------------------------- 1 | 23 | * @copyright Since 2007 PrestaShop SA and Contributors 24 | * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 25 | */ 26 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 27 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 28 | 29 | header('Cache-Control: no-store, no-cache, must-revalidate'); 30 | header('Cache-Control: post-check=0, pre-check=0', false); 31 | header('Pragma: no-cache'); 32 | 33 | header('Location: ../'); 34 | exit; 35 | -------------------------------------------------------------------------------- /demowsextend/src/Entity/Article.php: -------------------------------------------------------------------------------- 1 | 'article', 18 | 'primary' => 'id_article', 19 | 'multilang' => true, 20 | 'fields' => [ 21 | 'type' => ['type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 255], 22 | 23 | // Lang fields 24 | 'title' => ['type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 255], 25 | 'content' => ['type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 4000], 26 | 'meta_title' => ['type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 255], 27 | 28 | 'date_add' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'], 29 | 'date_upd' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'] 30 | ] 31 | ]; 32 | 33 | protected $webserviceParameters = [ 34 | 'objectNodeName' => 'article', 35 | 'objectsNodeName' => 'articles', 36 | 'fields' => [ 37 | 'title' => ['required' => true], 38 | 'type' => ['required' => true], 39 | 'content' => [], 40 | 'meta_title' => [] 41 | ] 42 | ]; 43 | } -------------------------------------------------------------------------------- /example_module_mailtheme/.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | node_modules 3 | mails/* 4 | !mails/layouts 5 | !mails/themes 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /example_module_mailtheme/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 jolelievre 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /example_module_mailtheme/README.md: -------------------------------------------------------------------------------- 1 | # example_module_mailtheme 2 | Example module to add a Mail theme to PrestaShop. 3 | 4 | # Requirements 5 | 6 | This module requires PrestaShop 9.0.0 to work correctly. 7 | 8 | 1. Copy the `example_module_mailtheme` directory into PrestaShop's `modules` directory. 9 | 2. `composer install` in the module's directory. (`[...]/modules/example_module_mailtheme`) 10 | 3. `bin/console prestashop:module install example_module_mailtheme` in PrestaShop's directory. 11 | 12 | # Install 13 | 14 | 1. Copy the `example_module_mailtheme` directory into PrestaShop's `modules` directory. 15 | 2. `composer install` in the module's directory. (`[...]/modules/example_module_mailtheme`) 16 | 3. `bin/console prestashop:module install example_module_mailtheme` in PrestaShop's directory. 17 | 18 | # Usage 19 | 20 | 1. Once the module is installed you can go to Design > Email theme there is a new `dark_modern` theme available. 21 | 2. You can look at the `dark_modern` themes layout and see they look like the modern theme but with customized colors. 22 | 3. You can look at the `order_conf` layout and see that an additional block has been added at the bottom `Thank you for purchasing this product ...` on BOTH `modern` and `dark_modern` themes 23 | 4. You can see that all three themes have a `customized_template` layout with a customized message with the color red (applied via a custom transformation). 24 | 5. You can also go to Modules Manager and configure the module custom colors and text 25 | 6. Go back in the layout preview and check that the `dark_modern` template colors are adapted 26 | -------------------------------------------------------------------------------- /example_module_mailtheme/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prestashop/example_module_mailtheme", 3 | "description": "Example module to add a Mail theme to PrestaShop.", 4 | "homepage": "https://github.com/PrestaShop/example-modules/tree/master/example_module_mailtheme", 5 | "license": "AFL-3.0", 6 | "authors": [ 7 | { 8 | "name": "PrestaShop SA", 9 | "email": "contact@prestashop.com" 10 | } 11 | ], 12 | "require": { 13 | "php": ">=8.1" 14 | }, 15 | "autoload": { 16 | "psr-4": { 17 | "PrestaShop\\Module\\ExampleModuleMailtheme\\": "src/" 18 | }, 19 | "classmap": ["example_module_mailtheme.php"], 20 | "exclude-from-classmap": [] 21 | }, 22 | "config": { 23 | "preferred-install": "dist", 24 | "prepend-autoloader": false 25 | }, 26 | "type": "prestashop-module" 27 | } 28 | -------------------------------------------------------------------------------- /example_module_mailtheme/composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "e11ba7a3cfcba1cd889f593f39adb27b", 8 | "packages": [], 9 | "packages-dev": [], 10 | "aliases": [], 11 | "minimum-stability": "stable", 12 | "stability-flags": {}, 13 | "prefer-stable": false, 14 | "prefer-lowest": false, 15 | "platform": { 16 | "php": ">=8.1" 17 | }, 18 | "platform-dev": {}, 19 | "plugin-api-version": "2.6.0" 20 | } 21 | -------------------------------------------------------------------------------- /example_module_mailtheme/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | example_module_mailtheme 4 | 5 | 6 | 7 | 8 | 9 | 1 10 | 0 11 | 12 | 13 | -------------------------------------------------------------------------------- /example_module_mailtheme/config/routes.yml: -------------------------------------------------------------------------------- 1 | admin_example_module_mailtheme: 2 | path: /example/module_mailtheme 3 | methods: [GET] 4 | defaults: 5 | _controller: PrestaShop\Module\ExampleModuleMailtheme\Controller\Admin\DarkThemeController::indexAction 6 | _legacy_controller: ExampleModuleMailtheme 7 | _legacy_link: 8 | - ExampleModuleMailtheme 9 | - ExampleModuleMailtheme:darkTheme 10 | 11 | admin_example_module_mailtheme_save_settings: 12 | path: /example/module_mailtheme 13 | methods: [POST] 14 | defaults: 15 | _controller: PrestaShop\Module\ExampleModuleMailtheme\Controller\Admin\DarkThemeController::saveSettingsAction 16 | _legacy_controller: ExampleModuleMailtheme 17 | _legacy_link: ExampleModuleMailtheme:saveDarkThemeSettings 18 | 19 | admin_example_module_mailtheme_reset_default_settings: 20 | path: /example/module_mailtheme/reset_default 21 | methods: [GET] 22 | defaults: 23 | _controller: PrestaShop\Module\ExampleModuleMailtheme\Controller\Admin\DarkThemeController::resetDefaultSettingsAction 24 | _legacy_controller: ExampleModuleMailtheme 25 | _legacy_link: ExampleModuleMailtheme:resetDarkThemeDefaultSettings 26 | 27 | admin_example_module_mailtheme_generate: 28 | path: /example/module_mailtheme/generate 29 | methods: [GET] 30 | defaults: 31 | _controller: PrestaShop\Module\ExampleModuleMailtheme\Controller\Admin\DarkThemeController::generateAction 32 | _legacy_controller: ExampleModuleMailtheme 33 | _legacy_link: ExampleModuleMailtheme:generateDarkTheme 34 | -------------------------------------------------------------------------------- /example_module_mailtheme/config/services.yml: -------------------------------------------------------------------------------- 1 | services: 2 | _defaults: 3 | public: true 4 | 5 | PrestaShop\Module\ExampleModuleMailtheme\Controller\Admin\DarkThemeController: 6 | autoconfigure: true 7 | autowire: true 8 | 9 | PrestaShop\Module\ExampleModuleMailtheme\DarkThemeSettings: 10 | arguments: 11 | - '@prestashop.adapter.legacy.configuration' 12 | - "@=service('prestashop.adapter.legacy.context').getLanguages()" 13 | 14 | PrestaShop\Module\ExampleModuleMailtheme\Form\DarkThemeSettingsType: 15 | public: true 16 | parent: 'form.type.translatable.aware' 17 | tags: 18 | - { name: form.type } 19 | -------------------------------------------------------------------------------- /example_module_mailtheme/index.php: -------------------------------------------------------------------------------- 1 | 22 | * @copyright 2007-2016 PrestaShop SA 23 | * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 24 | * International Registered Trademark & Property of PrestaShop SA 25 | */ 26 | 27 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 28 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 29 | 30 | header('Cache-Control: no-store, no-cache, must-revalidate'); 31 | header('Cache-Control: post-check=0, pre-check=0', false); 32 | header('Pragma: no-cache'); 33 | 34 | header('Location: ../'); 35 | exit; 36 | -------------------------------------------------------------------------------- /example_module_mailtheme/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/example_module_mailtheme/logo.png -------------------------------------------------------------------------------- /example_module_mailtheme/mails/layouts/customized_classic_layout.html.twig: -------------------------------------------------------------------------------- 1 | {% extends '@MailThemes/classic/components/layout.html.twig' %} 2 | 3 | {% block content %} 4 | 5 | 6 | 7 | {{ 'This is an example mail template from my module for classic theme'|trans({}, 'EmailsBody', locale)|raw }} 8 | 9 | 10 | 11 | 12 | 13 | 14 | {{ customMessage }} 15 | 16 | 17 | 18 | 19 |   20 | 21 | {% endblock %} 22 | -------------------------------------------------------------------------------- /example_module_mailtheme/mails/layouts/customized_dark_modern_layout.html.twig: -------------------------------------------------------------------------------- 1 | {% extends '@Modules/example_module_mailtheme/mails/themes/dark_modern/components/layout.html.twig' %} 2 | 3 | {% block content %} 4 | 5 | 6 | 11 | 12 | 13 | 18 | 19 | 20 | 21 | 22 |
7 | 8 | {{ 'This is an example mail template from my module for modern theme'|trans({}, 'EmailsBody', locale)|raw }} 9 | 10 |
14 | 15 | {{ customMessage }} 16 | 17 |
23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /example_module_mailtheme/mails/layouts/customized_modern_layout.html.twig: -------------------------------------------------------------------------------- 1 | {% extends '@MailThemes/modern/components/layout.html.twig' %} 2 | 3 | {% block content %} 4 | 5 | 6 | 11 | 12 | 13 | 18 | 19 | 20 | 21 | 22 |
7 | 8 | {{ 'This is an example mail template from my module for modern theme'|trans({}, 'EmailsBody', locale)|raw }} 9 | 10 |
14 | 15 | {{ customMessage }} 16 | 17 |
23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /example_module_mailtheme/mails/layouts/extended_dark_modern_order_conf_layout.html.twig: -------------------------------------------------------------------------------- 1 | {% extends '@Modules/example_module_mailtheme/mails/themes/dark_modern/core/order_conf.html.twig' %} 2 | 3 | {% block content %} 4 | {{ parent() }} 5 | 6 | 7 | 13 | 14 |
8 |
9 | {{ 'Thank you for purchasing this product on our store. Feel free to leave us a review if you are happy of this product:'|trans({}, 'EmailsBody', locale)|raw }} 10 | {{ 'Post a review'|trans({}, 'EmailsBody', locale)|raw }} 11 |
12 |
15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /example_module_mailtheme/mails/layouts/extended_modern_order_conf_layout.html.twig: -------------------------------------------------------------------------------- 1 | {% extends '@MailThemes/modern/core/order_conf.html.twig' %} 2 | 3 | {% block content %} 4 | {{ parent() }} 5 | 6 | 7 | 13 | 14 |
8 |
9 | {{ 'Thank you for purchasing this product on our store. Feel free to leave us a review if you are happy of this product:'|trans({}, 'EmailsBody', locale)|raw }} 10 | {{ 'Post a review'|trans({}, 'EmailsBody', locale)|raw }} 11 |
12 |
15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /example_module_mailtheme/mails/themes/dark_modern/assets/baseline-credit_card-24px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/example_module_mailtheme/mails/themes/dark_modern/assets/baseline-credit_card-24px.png -------------------------------------------------------------------------------- /example_module_mailtheme/mails/themes/dark_modern/assets/baseline-local_shipping-24px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/example_module_mailtheme/mails/themes/dark_modern/assets/baseline-local_shipping-24px.png -------------------------------------------------------------------------------- /example_module_mailtheme/mails/themes/dark_modern/assets/baseline-location_on-24px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrestaShop/example-modules/30220baf46581ee72d280fd4e87c24d76c6f0a8f/example_module_mailtheme/mails/themes/dark_modern/assets/baseline-location_on-24px.png -------------------------------------------------------------------------------- /example_module_mailtheme/views/js/form.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 2007-2019 PrestaShop SA and Contributors 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Open Software License (OSL 3.0) 7 | * that is bundled with this package in the file LICENSE.txt. 8 | * It is also available through the world-wide-web at this URL: 9 | * https://opensource.org/licenses/OSL-3.0 10 | * If you did not receive a copy of the license and are unable to 11 | * obtain it through the world-wide-web, please send an email 12 | * to license@prestashop.com so we can send you a copy immediately. 13 | * 14 | * DISCLAIMER 15 | * 16 | * Do not edit or add to this file if you wish to upgrade PrestaShop to newer 17 | * versions in the future. If you wish to customize PrestaShop for your 18 | * needs please refer to http://www.prestashop.com for more information. 19 | * 20 | * @author PrestaShop SA 21 | * @copyright 2007-2019 PrestaShop SA and Contributors 22 | * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) 23 | * International Registered Trademark & Property of PrestaShop SA 24 | */ 25 | 26 | $(document).ready(function() { 27 | window.prestashop.component.initComponents( 28 | [ 29 | 'TranslatableInput', 30 | 'ColorPicker', 31 | ], 32 | ); 33 | }); 34 | -------------------------------------------------------------------------------- /example_module_mailtheme/views/templates/admin/index.html.twig: -------------------------------------------------------------------------------- 1 | {% extends '@PrestaShop/Admin/layout.html.twig' %} 2 | {% trans_default_domain "Admin.Design.Feature" %} 3 | 4 | {% block content %} 5 | {% block darkThemeFormBlock %} 6 | {{ form_start(darkThemeForm) }} 7 |
8 |

9 | {{ 'Dark Theme'|trans({}, 'Modules.ExampleModuleMailtheme') }} 10 |

11 | 12 |
13 |
14 | {{ form_widget(darkThemeForm) }} 15 |
16 |
17 | 18 | 32 |
33 | {{ form_end(darkThemeForm) }} 34 | {% endblock %} 35 | {% endblock %} 36 | 37 | {% block javascripts %} 38 | {{ parent() }} 39 | 40 | {% endblock %} 41 | --------------------------------------------------------------------------------