Skip to content

Commit d64569e

Browse files
Merge pull request #55 from PrestaShop/dev
Prepare Release v4.0.0
2 parents 59a3ec4 + 5debadb commit d64569e

84 files changed

Lines changed: 4792 additions & 1443 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/release-drafter.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name-template: v$NEXT_PATCH_VERSION
2+
tag-template: v$NEXT_PATCH_VERSION
3+
categories:
4+
- title: 🔨 Improvements
5+
label: enhancement
6+
- title: 🐛 Bug Fixes
7+
label: bug
8+
- title: 🚀 New Features
9+
label: Feature
10+
change-template: '- #$NUMBER: $TITLE by @$AUTHOR'
11+
template: |
12+
# Changes
13+
$CHANGES
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build & Release draft
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
deploy:
7+
name: build dependencies & create artifact
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2.0.0
12+
13+
- name: Install composer dependencies
14+
run: composer install --no-dev -o
15+
16+
- name: Clean-up project
17+
uses: PrestaShopCorp/github-action-clean-before-deploy@v1.0
18+
19+
- name: Create & upload artifact
20+
uses: actions/upload-artifact@v1
21+
with:
22+
name: ${{ github.event.repository.name }}
23+
path: ../
24+
25+
update_release_draft:
26+
runs-on: ubuntu-latest
27+
needs: [deploy]
28+
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'
29+
steps:
30+
- name: Download artifact
31+
uses: actions/download-artifact@v1
32+
with:
33+
name: ${{ github.event.repository.name }}
34+
35+
- id: release_info
36+
uses: toolmantim/release-drafter@v5
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Prepare for Release
41+
run: |
42+
cd ${{ github.event.repository.name }}
43+
zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }}
44+
45+
- name: Clean existing assets
46+
shell: bash
47+
run: |
48+
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
49+
assets=`bin/hub api -t repos/${{ github.repository }}/releases/${{ steps.release_info.outputs.id }}/assets | awk '/\].url/ { print $2 }'`
50+
for asset in $assets
51+
do
52+
bin/hub api -X DELETE $asset
53+
done
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
57+
- name: Publish to GitHub Release
58+
uses: actions/upload-release-asset@v1.0.1
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
with:
62+
upload_url: ${{ steps.release_info.outputs.upload_url }}
63+
asset_path: ./${{ github.event.repository.name }}/${{ github.event.repository.name }}.zip
64+
asset_name: ${{ github.event.repository.name }}.zip
65+
asset_content_type: application/zip

.github/workflows/php.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: PHP tests
2+
on: [push, pull_request]
3+
jobs:
4+
php-linter:
5+
name: PHP Syntax check 5.6|7.2|7.3
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout
9+
uses: actions/checkout@v2.0.0
10+
- name: PHP syntax checker 5.6
11+
uses: prestashop/github-action-php-lint/5.6@master
12+
- name: PHP syntax checker 7.2
13+
uses: prestashop/github-action-php-lint/7.2@master
14+
- name: PHP syntax checker 7.3
15+
uses: prestashop/github-action-php-lint/7.3@master
16+
php-cs-fixer:
17+
name: PHP-CS-Fixer
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2.0.0
22+
- name: Run PHP-CS-Fixer
23+
uses: prestashopcorp/github-action-php-cs-fixer@master
24+
phpstan:
25+
name: PHPStan
26+
runs-on: ubuntu-latest
27+
strategy:
28+
matrix:
29+
presta-versions: ['latest', '1.7.0.3', '1.6.1.21','1.6.1.0']
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v2.0.0
33+
34+
- name: Cache vendor folder
35+
uses: actions/cache@v1
36+
with:
37+
path: vendor
38+
key: php-${{ hashFiles('composer.lock') }}
39+
40+
- name: Cache composer folder
41+
uses: actions/cache@v1
42+
with:
43+
path: ~/.composer/cache
44+
key: php-composer-cache
45+
46+
- run: composer install
47+
48+
- name: Pull PrestaShop files (Tag ${{ matrix.presta-versions }})
49+
run: docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:${{ matrix.presta-versions }}
50+
51+
- name: Select .neon file to run with PHPStan
52+
id: neon
53+
run: |
54+
PS_VERSION=$(docker exec temp-ps bash -c 'echo "$PS_VERSION"')
55+
[[ "${PS_VERSION:0:3}" != '1.7' ]] && echo ::set-output name=filename::phpstan-PS-1.6.neon || echo ::set-output name=filename::phpstan-PS-1.7.neon
56+
57+
- name : Run PHPStan
58+
run: docker run --rm --volumes-from temp-ps -v $PWD:/web/module -e _PS_ROOT_DIR_=/var/www/html --workdir=/web/module phpstan/phpstan:0.12 analyse --configuration=/web/module/tests/phpstan/${{steps.neon.outputs.filename}}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor/
2+
.php_cs.cache
3+
.prettyci.composer.json

.gitmodules

Lines changed: 0 additions & 1 deletion
This file was deleted.

.php_cs.dist

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
$config = new PrestaShop\CodingStandards\CsFixer\Config();
4+
5+
$config
6+
->setUsingCache(true)
7+
->getFinder()
8+
->in(__DIR__)
9+
->exclude('vendor');
10+
11+
return $config;

Readme.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44

55
Gain clear insights into important metrics about your customers, using Google Analytics.
66

7+
## Notes
8+
9+
Enhanced Ecommerce must be enabled in Google Analytics settings for full functionality. Otherwise, some data (refunds etc.) will not be visible. Follow [instructions][4].
10+
11+
Google Tag Assistant will report "No HTTP Response detected" error in Prestashop back-office. **This is not a bug.** This happens, because the module does not send page views in BO, not to influence statistics. Only events, like refunds, are sent from BO.
12+
713
## Contributing
814

915
PrestaShop modules are open-source extensions to the PrestaShop e-commerce solution. Everyone is welcome and even encouraged to contribute with their own improvements.
1016

11-
Google Analytics is compatible with all versions of PrestaShop 1.7
17+
Google Analytics is compatible with all versions of PrestaShop 1.7 and 1.6
1218

1319
### Requirements
1420

@@ -36,5 +42,5 @@ That's it: you have contributed to this open-source project! Congratulations!
3642
[1]: http://doc.prestashop.com/display/PS16/Coding+Standards
3743
[2]: http://doc.prestashop.com/display/PS16/How+to+write+a+commit+message
3844
[3]: https://help.github.com/articles/using-pull-requests
39-
45+
[4]: https://support.google.com/analytics/answer/6032539
4046

classes/Database/Install.php

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?php
2+
/**
3+
* 2007-2020 PrestaShop and Contributors
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.txt.
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 <contact@prestashop.com>
16+
* @copyright 2007-2020 PrestaShop SA and Contributors
17+
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
18+
* International Registered Trademark & Property of PrestaShop SA
19+
*/
20+
21+
namespace PrestaShop\Module\Ps_Googleanalytics\Database;
22+
23+
use Db;
24+
use Ps_Googleanalytics;
25+
use Shop;
26+
27+
class Install
28+
{
29+
/**
30+
* @var Ps_Googleanalytics
31+
*/
32+
private $module;
33+
34+
public function __construct(Ps_Googleanalytics $module)
35+
{
36+
if (Shop::isFeatureActive()) {
37+
Shop::setContext(Shop::CONTEXT_ALL);
38+
}
39+
40+
$this->module = $module;
41+
}
42+
43+
/**
44+
* installTables
45+
*
46+
* @return bool
47+
*/
48+
public function installTables()
49+
{
50+
$sql = [];
51+
52+
$sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'ganalytics` (
53+
`id_google_analytics` int(11) NOT NULL AUTO_INCREMENT,
54+
`id_order` int(11) NOT NULL,
55+
`id_customer` int(10) NOT NULL,
56+
`id_shop` int(11) NOT NULL,
57+
`sent` tinyint(1) DEFAULT NULL,
58+
`date_add` datetime DEFAULT NULL,
59+
PRIMARY KEY (`id_google_analytics`),
60+
KEY `id_order` (`id_order`),
61+
KEY `sent` (`sent`)
62+
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8 AUTO_INCREMENT=1';
63+
64+
$sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'ganalytics_data` (
65+
`id_cart` int(11) NOT NULL,
66+
`id_shop` int(11) NOT NULL,
67+
`data` TEXT DEFAULT NULL,
68+
PRIMARY KEY (`id_cart`)
69+
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8';
70+
71+
foreach ($sql as $query) {
72+
if (!Db::getInstance()->execute($query)) {
73+
return false;
74+
}
75+
}
76+
77+
return true;
78+
}
79+
80+
/**
81+
* Register Module hooks
82+
*
83+
* @return bool
84+
*/
85+
public function registerHooks()
86+
{
87+
return $this->module->registerHook('displayHeader') &&
88+
$this->module->registerHook('displayAdminOrder') &&
89+
$this->module->registerHook('displayFooter') &&
90+
$this->module->registerHook('displayHome') &&
91+
$this->module->registerHook('displayFooterProduct') &&
92+
$this->module->registerHook('displayOrderConfirmation') &&
93+
$this->module->registerHook('actionProductCancel') &&
94+
$this->module->registerHook('actionCartSave') &&
95+
$this->module->registerHook('displayBackOfficeHeader') &&
96+
$this->module->registerHook('actionCarrierProcess');
97+
}
98+
}

classes/Database/Uninstall.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* 2007-2020 PrestaShop and Contributors
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.txt.
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 <contact@prestashop.com>
16+
* @copyright 2007-2020 PrestaShop SA and Contributors
17+
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
18+
* International Registered Trademark & Property of PrestaShop SA
19+
*/
20+
21+
namespace PrestaShop\Module\Ps_Googleanalytics\Database;
22+
23+
use Db;
24+
25+
class Uninstall
26+
{
27+
/**
28+
* uninstallTables
29+
*
30+
* @return bool
31+
*/
32+
public function uninstallTables()
33+
{
34+
$sql[] = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'ganalytics`';
35+
$sql[] = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'ganalytics_data`';
36+
37+
foreach ($sql as $query) {
38+
if (!Db::getInstance()->execute($query)) {
39+
return false;
40+
}
41+
}
42+
43+
return true;
44+
}
45+
}

classes/Database/index.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* 2007-2020 PrestaShop and Contributors
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.txt.
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 <contact@prestashop.com>
16+
* @copyright 2007-2020 PrestaShop SA and Contributors
17+
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
18+
* International Registered Trademark & Property of PrestaShop SA
19+
*/
20+
header('Expires: Mon, 26 Jul 1998 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;

0 commit comments

Comments
 (0)