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 |
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 | 
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 | 
18 | 
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 |
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 |
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 |
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 |
13 |
14 |
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 |