Skip to content

Commit 9f18ece

Browse files
authored
Merge pull request #155 from PrestaShop/dev
Release version 5.0.0
2 parents 7bfdf5f + 4c127ba commit 9f18ece

70 files changed

Lines changed: 2582 additions & 2297 deletions

Some content is hidden

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

.github/workflows/build-release.yml

Lines changed: 3 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,6 @@ name: Build
22
on: [push, pull_request]
33

44
jobs:
5-
deploy:
6-
name: build dependencies & create artifact
7-
runs-on: ubuntu-latest
8-
steps:
9-
- name: Checkout
10-
uses: actions/checkout@v2.0.0
11-
- name: Install composer dependencies
12-
run: composer install --no-dev -o
13-
- name: Clean-up project
14-
uses: PrestaShopCorp/github-action-clean-before-deploy@v1.0
15-
- name: Prepare auto-index tool
16-
run: |
17-
composer global require prestashop/autoindex
18-
- name: Generate index.php
19-
run: |
20-
~/.composer/vendor/bin/autoindex
21-
- name: Create & upload artifact
22-
uses: actions/upload-artifact@v1
23-
with:
24-
name: ${{ github.event.repository.name }}
25-
path: ../
26-
update_release_draft:
27-
runs-on: ubuntu-latest
28-
needs: [deploy]
29-
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'
30-
steps:
31-
- name: Download artifact
32-
uses: actions/download-artifact@v1
33-
with:
34-
name: ${{ github.event.repository.name }}
35-
- id: release_info
36-
uses: toolmantim/release-drafter@v5
37-
env:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39-
- name: Prepare for Release
40-
run: |
41-
cd ${{ github.event.repository.name }}
42-
zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }}
43-
- name: Clean existing assets
44-
shell: bash
45-
run: |
46-
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
47-
assets=`bin/hub api -t repos/${{ github.repository }}/releases/${{ steps.release_info.outputs.id }}/assets | awk '/\].url/ { print $2 }'`
48-
for asset in $assets
49-
do
50-
bin/hub api -X DELETE $asset
51-
done
52-
env:
53-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54-
- name: Publish to GitHub Release
55-
uses: actions/upload-release-asset@v1.0.1
56-
env:
57-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58-
with:
59-
upload_url: ${{ steps.release_info.outputs.upload_url }}
60-
asset_path: ./${{ github.event.repository.name }}/${{ github.event.repository.name }}.zip
61-
asset_name: ${{ github.event.repository.name }}.zip
62-
asset_content_type: application/zip
5+
build-and-release-draft:
6+
name: Build & Release draft
7+
uses: PrestaShop/.github/.github/workflows/build-release.yml@master

.github/workflows/php.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ on: [push, pull_request]
33
jobs:
44
# Check there is no syntax errors in the project
55
php-linter:
6-
name: PHP Syntax check 5.6 => 8.1
6+
name: PHP Syntax check 7.1 => 8.1
77
runs-on: ubuntu-latest
88
steps:
99
- name: Checkout
10-
uses: actions/checkout@v2.0.0
10+
uses: actions/checkout@v3.1.0
1111

12-
- name: PHP syntax checker 5.6
13-
uses: prestashop/github-action-php-lint/5.6@master
12+
- name: PHP syntax checker 7.1
13+
uses: prestashop/github-action-php-lint/7.1@master
1414

1515
- name: PHP syntax checker 7.2
1616
uses: prestashop/github-action-php-lint/7.2@master
@@ -38,10 +38,10 @@ jobs:
3838
php-version: '7.4'
3939

4040
- name: Checkout
41-
uses: actions/checkout@v2.0.0
41+
uses: actions/checkout@v3.1.0
4242

4343
- name: Cache dependencies
44-
uses: actions/cache@v2
44+
uses: actions/cache@v3
4545
with:
4646
path: vendor
4747
key: php-${{ hashFiles('composer.lock') }}
@@ -58,26 +58,26 @@ jobs:
5858
runs-on: ubuntu-latest
5959
strategy:
6060
matrix:
61-
presta-versions: ['1.6.1.18', '1.7.1.2', '1.7.2.5', '1.7.3.4', '1.7.4.4', '1.7.5.1', '1.7.6', '1.7.7', '1.7.8', 'latest']
61+
presta-versions: ['1.7.7', '1.7.8', '8.0', 'latest']
6262
steps:
6363
- name: Setup PHP
6464
uses: shivammathur/setup-php@v2
6565
with:
6666
php-version: '7.4'
6767

6868
- name: Checkout
69-
uses: actions/checkout@v2.0.0
69+
uses: actions/checkout@v3.1.0
7070

7171
# Add vendor folder in cache to make next builds faster
7272
- name: Cache vendor folder
73-
uses: actions/cache@v1
73+
uses: actions/cache@v3
7474
with:
7575
path: vendor
7676
key: php-${{ hashFiles('composer.lock') }}
7777

7878
# Add composer local folder in cache to make next builds faster
7979
- name: Cache composer folder
80-
uses: actions/cache@v1
80+
uses: actions/cache@v3
8181
with:
8282
path: ~/.composer/cache
8383
key: php-composer-cache

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
## About
44

5-
Gain clear insights into important metrics about your customers, using Google Analytics.
5+
Gain clear insights into important metrics about your customers, using Google Analytics 4.
66

77
To use it, you will need to create a Google Analytics account and insert your Google Analytics Identifier into the Module configuration page.
88

9+
## Compatibility
10+
11+
PrestaShop: `1.7.7.0` or later
12+
913
### Notes
1014

1115
Enhanced Ecommerce must be enabled in Google Analytics settings for full functionality. Otherwise, some data (refunds etc.) will not be visible. Follow [the related instructions][4].
@@ -21,7 +25,7 @@ Enhanced Ecommerce must be enabled in Google Analytics settings for full functio
2125

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

24-
Google Analytics is compatible with all versions of PrestaShop 8, 1.7 and 1.6.
28+
Google Analytics is compatible with PrestaShop 1.7.7 and newer.
2529

2630
### Requirements
2731

classes/Database/Install.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222

2323
use Configuration;
2424
use Db;
25+
use Language;
2526
use Ps_Googleanalytics;
2627
use Shop;
28+
use Tab;
2729

2830
class Install
2931
{
@@ -87,6 +89,8 @@ public function installTables()
8789
public function setDefaultConfiguration()
8890
{
8991
Configuration::updateValue('GA_CANCELLED_STATES', json_encode([Configuration::get('PS_OS_CANCELED')]));
92+
Configuration::updateValue('GA_BACKLOAD_ENABLED', false);
93+
Configuration::updateValue('GA_BACKLOAD_DAYS', 30);
9094

9195
return true;
9296
}
@@ -101,13 +105,34 @@ public function registerHooks()
101105
return $this->module->registerHook('displayHeader') &&
102106
$this->module->registerHook('displayAdminOrder') &&
103107
$this->module->registerHook('displayBeforeBodyClosingTag') &&
104-
$this->module->registerHook('displayFooter') &&
105108
$this->module->registerHook('displayFooterProduct') &&
106109
$this->module->registerHook('displayOrderConfirmation') &&
107110
$this->module->registerHook('actionProductCancel') &&
111+
$this->module->registerHook('actionValidateOrder') &&
108112
$this->module->registerHook('actionOrderStatusPostUpdate') &&
109-
$this->module->registerHook('actionCartSave') &&
113+
$this->module->registerHook('actionCartUpdateQuantityBefore') &&
114+
$this->module->registerHook('actionObjectProductInCartDeleteBefore') &&
110115
$this->module->registerHook('displayBackOfficeHeader') &&
111116
$this->module->registerHook('actionCarrierProcess');
112117
}
118+
119+
/**
120+
* Installs hidden tab for our ajax controller
121+
*
122+
* @return bool
123+
*/
124+
public function installTab()
125+
{
126+
$tab = new Tab();
127+
$tab->class_name = 'AdminGanalyticsAjax';
128+
$tab->module = $this->module->name;
129+
$tab->active = true;
130+
$tab->id_parent = -1;
131+
$tab->name = array_fill_keys(
132+
Language::getIDs(false),
133+
$this->module->displayName
134+
);
135+
136+
return $tab->add();
137+
}
113138
}

classes/Database/Uninstall.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
namespace PrestaShop\Module\Ps_Googleanalytics\Database;
2222

2323
use Db;
24+
use Tab;
25+
use Validate;
2426

2527
class Uninstall
2628
{
@@ -42,4 +44,21 @@ public function uninstallTables()
4244

4345
return true;
4446
}
47+
48+
/**
49+
* uninstall tab
50+
*
51+
* @return bool
52+
*/
53+
public function uninstallTab()
54+
{
55+
$result = true;
56+
$id_tab = (int) Tab::getIdFromClassName('AdminGanalyticsAjax');
57+
$tab = new Tab($id_tab);
58+
if (Validate::isLoadedObject($tab)) {
59+
$result = $tab->delete();
60+
}
61+
62+
return $result;
63+
}
4564
}

0 commit comments

Comments
 (0)