Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PrestaShop 8.x support #57

Merged
merged 114 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from 99 commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
fc0b67f
Migrate to prestashop-flashlight image
sinukaarel Apr 3, 2024
0fbe90e
Add better support for remote container workflow
sinukaarel Apr 3, 2024
a88dd33
Run fix script
sinukaarel Apr 3, 2024
d8a20aa
Add strict types
sinukaarel Apr 3, 2024
081a319
Update vscode extensions and settings
sinukaarel Apr 5, 2024
10b9de1
Update module composer file
sinukaarel Apr 5, 2024
666f8a6
Reimplement admin page forms
sinukaarel Apr 10, 2024
322c678
Rename class from SmailyForPrestashop to SmailyForPrestaShop
sinukaarel Apr 11, 2024
e109f61
Add admin page templates
sinukaarel Apr 11, 2024
07a0c07
Add Lib classes - Api and Logger
sinukaarel Apr 11, 2024
319a54e
Normalize API calls
sinukaarel Apr 11, 2024
10895c8
Add RSS form
sinukaarel Apr 11, 2024
449c46d
Refactor RSS feed
sinukaarel Apr 15, 2024
5f3bd5c
Add spell checker to recommended extensions
sinukaarel Apr 15, 2024
727e7b3
Improve RSS-url copy functionality
sinukaarel Apr 15, 2024
83d0891
Improve copying Cron URL-s
sinukaarel Apr 15, 2024
1d2246e
Use single form data provider
sinukaarel Apr 16, 2024
0c37a78
Configure form names
sinukaarel Apr 16, 2024
7011172
Fix front service config indentation
sinukaarel Apr 16, 2024
75aa666
Add correct URL to AbandonedCart cron
sinukaarel Apr 16, 2024
2b4e7dc
Drop upgrades
sinukaarel Apr 16, 2024
ed41a64
Refactor module main file
sinukaarel Apr 17, 2024
1fe4ea7
Add null value to autoresponder choices list
sinukaarel Apr 17, 2024
a48410b
Add empty jsVariables array to template when account not connected
sinukaarel Apr 17, 2024
6fd6434
Add actionCustomerAccountAdd hook
sinukaarel Apr 17, 2024
eaf4ee5
Move module installing logic to separate class
sinukaarel Apr 17, 2024
3b3ef85
Add xdebug support
sinukaarel Apr 19, 2024
ec6bf6d
Add opt in trigger for subscription form registration
sinukaarel Apr 19, 2024
f8c910f
Disable newsletter subscriptions plugin mail sending
sinukaarel Apr 22, 2024
5adb77a
Add mailhog as a service
sinukaarel Apr 22, 2024
030d26a
Add notice to newsletter subscriptions module settings page
sinukaarel Apr 22, 2024
4729da4
Refactor abandoned cart controller
sinukaarel Apr 23, 2024
ef038e5
Add date_add field to SentCart for automatic timestamp management
sinukaarel Apr 23, 2024
7492a8d
Refactor subscriber sync controller
sinukaarel Apr 23, 2024
25e2a25
Improve layout title for settings page
sinukaarel Apr 23, 2024
fc4dac4
Drop old js files
sinukaarel Apr 23, 2024
c044b34
Move RssFeed generation logic to controller
sinukaarel Apr 24, 2024
61a81b5
Add help text to sync_interval field
sinukaarel Apr 24, 2024
3728f61
Move help text out of input-group
sinukaarel Apr 24, 2024
56eb214
Use 8.1.5 as current latest tested version
sinukaarel Apr 24, 2024
2d68d9d
Improve contributing documentation
sinukaarel Apr 24, 2024
ddfc3bf
Fix linting errors
sinukaarel Apr 24, 2024
e8cc1da
Add a notice for php-cs-fixer not working
sinukaarel Apr 24, 2024
54ac8a7
Unify admin service naming convention
sinukaarel Apr 24, 2024
65b5cd0
Add cache invalidation section to contributing.md
sinukaarel Apr 24, 2024
767ffe8
Remove imports from legacy front controllers
sinukaarel Apr 24, 2024
9d084bc
Autoindex
sinukaarel Apr 24, 2024
bea2483
Support max version 8.99.99
sinukaarel Apr 24, 2024
727f7d7
Add license headers
sinukaarel Apr 24, 2024
80e332b
Improve comment wording
sinukaarel Apr 24, 2024
921324d
Add new translations
sinukaarel Apr 24, 2024
4fbb30e
Add section about mailhog
sinukaarel Apr 25, 2024
0e25c0e
Add abandoned cart product model
sinukaarel Apr 25, 2024
06c9784
Improve readme wordings
sinukaarel Apr 25, 2024
2432aeb
Add form listener for connection error messages
sinukaarel Apr 25, 2024
26e60a7
Remove cron data log from readme
sinukaarel Apr 25, 2024
bc38689
Revert SentCart back to sent_date
sinukaarel Apr 25, 2024
aec75de
Remove autoload files from ignored files
sinukaarel Apr 25, 2024
2818c91
Add autoload files to version control
sinukaarel Apr 25, 2024
63f70e9
Add new assets
sinukaarel Apr 25, 2024
f9f2d31
Add version 2.0.0 changelog
sinukaarel Apr 25, 2024
8a82c9d
Update userguide
sinukaarel Apr 25, 2024
763e797
Update Estonian translations
sinukaarel Apr 25, 2024
88d63b0
Add PS_VERSION check to all php files
sinukaarel Apr 29, 2024
0111d62
Fix missing license headers
sinukaarel Apr 29, 2024
f58c006
Add missing index.php files
sinukaarel Apr 29, 2024
02cf995
Drop front controller services
sinukaarel Apr 29, 2024
335f224
Replace serialize with JSON encoding
sinukaarel Apr 29, 2024
1dc1180
Use OptInController in hookActionCustomerAccountAdd
sinukaarel Apr 29, 2024
f2df082
Add .htaccess
sinukaarel Apr 29, 2024
22dd840
Provide PDF userguide inside the module
sinukaarel Apr 29, 2024
08c012a
Add index.php to the root of the module
sinukaarel Apr 29, 2024
5ecc5b5
Keep only estonian translations, add missing ones
sinukaarel Apr 29, 2024
c97ca9b
Fix wrong selector id-s in RSS URL generation script
sinukaarel Apr 29, 2024
947dd33
Add missing translation
sinukaarel Apr 29, 2024
817938a
Use isset instad of in_array
sinukaarel May 6, 2024
72612da
Refactor ModuleConfigurationController
sinukaarel May 6, 2024
a696e67
Remove prestashop-data volume
sinukaarel May 6, 2024
7b824d1
Refactor ModuleConfigurationController
sinukaarel May 6, 2024
7ca016a
Dump optimized autoload
sinukaarel May 6, 2024
f45b1b5
Fix autoresponder not shown after connect
sinukaarel May 7, 2024
26cfce7
Refactor cart generatePayload function
sinukaarel May 7, 2024
04a8e13
Improve readability of AbandonedCartController
sinukaarel May 8, 2024
85e67c8
Drop XDEBUG values, add prestashop-data volume
sinukaarel May 13, 2024
f7ead4a
Improve contributing guide
sinukaarel May 13, 2024
ff934f9
Use VS Code instead of VSCode
sinukaarel May 13, 2024
c9e4f69
Unify PrestaShop word usage, improve README.md
sinukaarel May 13, 2024
b99b3f6
Add post install script for MailHog
sinukaarel May 13, 2024
4a732ce
Remove email section from CONTRIBUTING.md
sinukaarel May 13, 2024
f738362
Add missing type declaration and default value
sinukaarel May 13, 2024
2177a59
Add validation for subdomain field
sinukaarel May 14, 2024
c1dee35
Add correct error message for missing abandoned cart trigger
sinukaarel May 14, 2024
f96e1be
Fix typo
sinukaarel May 14, 2024
c906154
Improve abandoned cart SQL query
sinukaarel May 14, 2024
4200394
Use array_column instead of array_map
sinukaarel May 14, 2024
fec894b
Improve wording in Ps_Emailsubscription help text
sinukaarel May 14, 2024
c2046e0
Fix validation errors routing to account tab
sinukaarel May 14, 2024
b3592f6
Fix RSS product category select value not updated
sinukaarel May 14, 2024
c4d3c63
Use debug mode
sinukaarel May 14, 2024
6899016
Add vendor files to source control.
sinukaarel May 14, 2024
9aee7f4
Install composer deps during release build
sinukaarel May 14, 2024
22ec55e
Ignore vendor deps
sinukaarel May 14, 2024
c24c21c
Update contributing.md
sinukaarel May 14, 2024
0591c87
Build RSS using DOMDocument
sinukaarel May 15, 2024
ea46e65
Redirect after successful form update
sinukaarel May 15, 2024
090b5af
Add latest translations
sinukaarel May 16, 2024
234cf03
Improve shopRestriction trim function
sinukaarel May 17, 2024
bbde0cd
Allow triggering opt-in flow without automation trigger.
sinukaarel May 20, 2024
c68b77a
Add prod link as guild
sinukaarel May 20, 2024
818b203
Add warning when enabling customer opt in, improve form help
sinukaarel May 20, 2024
0df330d
Add translations
sinukaarel May 20, 2024
53a43c7
Improve warning message text
sinukaarel May 20, 2024
0eebd84
Use regex preg_replace
sinukaarel May 22, 2024
60396e4
Remove extra space
sinukaarel May 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ A clear and concise description of what actually happened.
**Screenshots**
If applicable, add screenshots to help explain your problem.

**Prestashop version**
Add the Prestashop version you are currently using.
**PrestaShop version**
Add the PrestaShop version you are currently using.

**Module version**
Add the Smaily For Prestashop module version you are currently using.
Add the Smaily For PrestaShop module version you are currently using.

**Additional context**
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ A list of changes regarding the next version release:
**After PR merge**

- [ ] Released new version in GitHub
- [ ] Updated plugin on the Prestashop Addons Marketplace
- [ ] Updated plugin on the PrestaShop Addons Marketplace
- [ ] Pinged code owners to inform marketing about new version
31 changes: 0 additions & 31 deletions .sandbox/entrypoint.sh

This file was deleted.

9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"aswinkumar863.smarty-template-support",
"mblode.twig-language-2",
"junstyle.php-cs-fixer",
"devsense.phptools-vscode",
"streetsidesoftware.code-spell-checker"
]
}
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"[php]": {
"editor.defaultFormatter": "junstyle.php-cs-fixer"
},
"editor.formatOnSave": true,
"files.associations": {
"*.html": "twig"
},
"emmet.includeLanguages": {
"twig": "html"
},
}
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

### 2.0.0

- Total rewrite of the module to support PrestaShop 8 new features and standards. [[#57](https://github.com/sendsmaily/smaily-prestashop-module/pull/57)]
- Module now uses the built-in Newsletter Subscription module to provide functionality for opt-in trigger instead of creating a custom template. This allows to keep internal subscriber addition logic and add required opt-in trigger functionality.

### 1.6.1

- Update user manual links [[#51](https://github.com/sendsmaily/smaily-prestashop-module/pull/51)]
Expand All @@ -12,7 +17,7 @@

- New feature to trigger opt-in if new customer joins with newsletter enabled [[#32](https://github.com/sendsmaily/smaily-prestashop-module/issues/32)]
- Fix missing template variables [[#33](https://github.com/sendsmaily/smaily-prestashop-module/issues/33)]
- Use PrestashopLogger for logs created by module [[#36](https://github.com/sendsmaily/smaily-prestashop-module/issues/36)]
- Use PrestaShopLogger for logs created by module [[#36](https://github.com/sendsmaily/smaily-prestashop-module/issues/36)]

### 1.4.0

Expand Down
47 changes: 27 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
First off, thanks for taking the time to contribute!


# Table of contents

- [Getting started](#getting-started)
- [Internals](#internals))
- [Structure of the repository](#structure-of-the-repository)
- [Internals](#internals)
- [Structure of the repository](#structure-of-the-repository)
- [Deveopment](#development)
- [Starting the environement](#starting-the-environment)
- [Stopping the environment](#stopping-the-environment)
- [Resetting the environment](#resetting-the-environment)

- [Starting the environement](#starting-the-environment)
- [Stopping the environment](#stopping-the-environment)
- [Resetting the environment](#resetting-the-environment)

# Getting started

Expand All @@ -26,14 +24,11 @@ Next, change your working directory to the local repository:

And run the environment:

$ docker-compose up

When running the enviroment for the first time, PrestaShop installation will automatically run, and it can take a while.
$ docker compose up -d

Once installation has finished and web server is ready to accept requests, you can access PrestaShop store from `http://localhost:8080` and administration interface from `http://localhost:8080/admin1` URL.

> Administrator user is `[email protected]` and password `smailydev1`.
You can access PrestaShop store from `http://localhost:8080` and administration interface from `http://localhost:8080/admin-dev` URL.

> Administrator user is `[email protected]` and password `prestashop`.
kaittodesk marked this conversation as resolved.
Show resolved Hide resolved

# Internals

Expand All @@ -42,33 +37,45 @@ Once installation has finished and web server is ready to accept requests, you c
The repository is split into multiple parts:

- `.github` - GitHub issue and pull request templates, and release workflow;
- `.sandbox` - files needed for running the development environment;
- `assets` - images for the user guide;
- `src` - module files;

Source files must follow standard PrestaShop module structure. Learn more about it from the [Modules Folder structure](https://devdocs.prestashop.com/1.7/modules/creation/module-file-structure/) chapter in the official documentation.

Source files must follow standard PrestaShop module structure. Learn more about it from the [Modules Folder structure](https://devdocs.prestashop-project.org/8/modules/creation/module-file-structure/) chapter in the official documentation.

# Development

All written code must follow PrestaShop's [coding standards](https://devdocs.prestashop.com/1.7/development/coding-standards/) and [naming conventions](https://devdocs.prestashop.com/1.7/development/naming-conventions/).
All written code must follow PrestaShop's [coding standards](https://devdocs.prestashop-project.org/8/development/coding-standards/) and [naming conventions](https://devdocs.prestashop-project.org/8/development/naming-conventions/).

## Starting the environment

You can run the environment by executing:

$ docker-compose up
$ docker compose up -d
kaittodesk marked this conversation as resolved.
Show resolved Hide resolved

> **Note!** Make sure you do not have any other process(es) listening on ports 8080 and 8888.

### Developing in VS Code Remote Container

It is advised to develop the application inside VS Code remote container. This allows to get PHP IntelliSense on PrestaShop classes, includes, etc and provides an debugging option when using latest version of the `prestashop/prestashop-flashlight` image. Open `/var/www/html` directory of `prestashop` container as this provides context for IntelliSense.

## Stopping the environment

Environment can be stopped by executing:

$ docker-compose down
$ docker compose down --remove-orphans

## Resetting the environment

If you need to reset the installation, just simply delete environment's Docker volumes. Easiest way to achieve this is by running:

$ docker-compose down -v
$ docker compose down --remove-orphans -v

## Troubleshooting

### PHP CS Fixer is not working

You may notice that `php-cs-fixer` might not work for some PrestaShop image versions. `php-cs-fixer` output provides a hint that the `/var/www/html/tests` directory does not exist. This is due to the `tests` folder being included in the [PrestaShop repo](https://github.com/PrestaShop/PrestaShop) but not in the docker image. Adding an empty `/var/www/heml/tests` folder enables the `php-cs-fixer`.

## Invalidating cache

There seems to be lot of issues related to cache being invalid. Sometimes the module routes are not found or services configuration is missing etc. Most of them can be fixed by pruning cache folder located in `/var/www/html/var/cache/dev`. Some versions use `admin-dev` folder.
7 changes: 0 additions & 7 deletions Dockerfile

This file was deleted.

62 changes: 28 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,85 @@
# Smaily for Prestashop
# Smaily for PrestaShop

## Description

Smaily email marketing and automation extension module for PrestaShop.

Automatically subscribe newsletter subscribers to a Smaily subscribers list, generate rss-feed based on products for easy template import and add Newsletter Subscribtion form for opt-in sign-up form.
Automatically subscribe newsletter subscribers to a Smaily subscribers list, generate an RSS feed based on products for easy template import and add a Newsletter Subscription form for an opt-in sign-up form.

## Features

### PrestaShop Newsletter Subscribers

- Add subscribers to Smaily subscribers list
- Add new Subscribe Newsletter form to send subscribers directly to Smaily subscribers list
- Use the Subscribe Newsletter modules form to send subscribers directly to the Smaily subscribers list
- Subscribe Newsletter form with CAPTCHA support

### PrestaShop Products RSS-feed

- Generate RSS-feed with 50 latest updated active products for easy import to Smaily template
Generate an RSS feed with the 50 latest updated active products for easy import to the Smaily template

### Two-way synchronization between Smaily and PrestaShop

- Get unsubscribers from Smaily unsubscribed list
- Remove PrestaShop subscribers based on the Smaily unsubscribed list
- Update unsubscribed status in PrestaShop users database
- Collect new user data for subscribed users
- Collect and send new user data to Smaily for subscribers in the store
- Generate data log for each update

### Abandoned cart

- Get customer abandoned cart info and send recovery e-mails with Smaily templates.
- Set prefered delay time when cart is considered abandoned.
- Set preferred delay time when the cart is considered abandoned.

## Requirements

Smaily for Prestashop requires PHP 5.6+ (PHP 7.0+ recommended). You'll also need to be running Prestashop 1.7+.
Smaily for PrestaShop requires PHP 7.2+ (PHP 8.1+ recommended). You'll also need to be running PrestaShop 8.0+.

## Documentation & Support

Online documentation and code samples are available via our [Help Center](https://smaily.com/help/user-manuals/).

## Contribute

All development for Smaily for Prestashop is [handled via GitHub](https://github.com/sendsmaily/smaily-prestashop-module). Opening new issues and submitting pull requests are welcome.
All development for Smaily for PrestaShop is [handled via GitHub](https://github.com/sendsmaily/smaily-prestashop-module). Opening new issues and submitting pull requests are welcome.

## Installation

1. Upload or extract the `smailyforprestashop` folder to your site's `/modules/` directory. You can also find this module in **Modules -> Selection** - section in your admin panel - search for Smaily for Prestashop.
2. Install the plugin from the **Modules** - menu in Prestashop.
1. Upload or extract the `smailyforprestashop` folder to your site's `/modules/` directory. You can also find this module in **Modules -> Selection** - section in your admin panel - search for Smaily for PrestaShop.
2. Install the plugin from the **Modules** - menu in PrestaShop.

## Usage

1. Go to Modules -> Module Manager -> Smaily for Prestashop and click Configure
2. Insert your Smaily API authentication information and click **Validate** to get started.
3. Under **Customer Synchronization** tab select if you want to enable customer synchronization.
4. Select additional fields you want to synchronize (email is automatic), change cron token if you like your own.
5. New customers who sign up with newsletter enabled can be added to Smaily by enabling trigger opt-in on customer signup.
1. Go to Modules -> Module Manager -> Smaily for PrestaShop and click Configure
2. Insert your Smaily API authentication information and click **Connect** to get started.
3. Under the **Customer Sync** tab select if you want to enable customer synchronization.
4. Select additional fields you want to synchronize (email is automatic) and change the cron token if you like your own.
5. New customers who sign up with the newsletter enabled can be added to Smaily by enabling trigger opt-in on customer signup.
6. An autoresponder can be selected for "opt-in on customer sign-up", this will only be triggered if the previous option is enabled.
7. Click **Save** to save customer synchronization settings.
8. Under **Abandoned Cart** tab select if you want to enable abandoned cart synchronization.
8. Under the **Abandoned Cart** tab select if you want to enable abandoned cart synchronization.
9. Select autoresponder for abandoned cart.
10. Select additional fields to send to abandoned cart template. Firstname, lastname and store-url are always added.
11. Add delay time when cart is considered abandoned. Minimum time 15 minutes. Change cron token if you like your own.
10. Select additional fields to send to the abandoned cart template. Firstname, lastname and store-url are always added.
11. Add delay time when the cart is considered abandoned. Minimum time 15 minutes. Change the cron token if you like your own.
12. Click **Save** to save abandoned cart settings.
13. Cron is set up to synchronize contacts when CRON-url is visited. Use host Cpanel, PrestaShop Cron tasks manager or external cron service to automate process.
14. That's it, your PrestaShop store is now integrated with Smaily Plugin!
13. Cron is set up to synchronize contacts when cron-URL is visited. Use host cPanel, PrestaShop cron tasks manager or external cron service to automate the process.
14. That's it, your PrestaShop store is now integrated with the Smaily Plugin!

## Using Newsletter Subscription form
## Using the Newsletter Subscription form

1. Navigate to Design -> Positions -> Transplant a Module section.
2. Select **Smaily for Prestashop** module in Module field.
3. Select hook where you would like to transplant newsletter form. You can chose FooterBefore / LeftColumn / RightColumn.
4. New form is displayed when you have validated your credentials in Smaily for Opencart module settings.
2. Select the **Newsletter subscription** module in the Module field.
3. Select a hook where you would like to transplant the newsletter form.

## Frequently Asked Questions

### Where I can find data-log for Cron?
### How can I access additional Abandoned cart parameters in the Smaily template editor?

Cron update data-log is stored in the root folder of Smaily plugin, inside "smaily-cron.txt" file.

### How can I access additional Abandoned cart parameters in Smaily template editor?

Here is a list of all the parameters available in Smaily email templating engine:
Here is a list of all the parameters available in the Smaily email templating engine:

Customer first name: `{{ first_name }}`.

Customer last name: `{{ last_name }}`.

Up to 10 products can be received in Smaily templating engine. You can reference each product with number 1-10 behind parameter name.
Up to 10 products can be received in the Smaily templating engine. You can reference each product with a number 1-10 behind the parameter name.

Product name: `{{ product_name_[1-10] }}`.

Expand All @@ -99,6 +93,6 @@ Product price: `{{ product_price_[1-10] }}`.

Product base price : `{{ product_base_price_[1-10] }}`.

Also you can determine if customer had more than 10 items in cart
Also, you can determine if a customer had more than 10 items in the cart

More than 10 items: `{{ over_10_products }}`.
Loading