WooCommerce ESW
WooCommerce ESW
Il progetto prevede la creazione di un mini-sito con commerce integrato con Easy Store Web.
Ambiente di lavoro
Container
Abbiamo optato per un docker container così strutturato
docker-compose.yml
version: '3.9'
services:
db:
image: mysql:5.7
ports:
- 3306:3306
environment:
MYSQL_DATABASE: webmobili
MYSQL_USER: webmobili
MYSQL_PASSWORD: w3bm0b1l1
MYSQL_ROOT_PASSWORD: w3bm0b1l1
volumes:
- db:/var/lib/mysql
wordpress:
depends_on:
- db
build:
context: ./
ports:
- 8000:80
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: webmobili
WORDPRESS_DB_PASSWORD: w3bm0b1l1
WORDPRESS_DB_NAME: webmobili
WORDPRESS_DEBUG: 1
TZ: "Europe/Rome"
volumes:
- wordpress:/var/www/html
volumes:
db:
wordpress:
Punta al seguente Dockerfile che si occupa di configurare xdebug per PHP.
FROM wordpress:6.0.0-php7.4-apache
RUN apt-get update && \
pecl install xdebug \
&& docker-php-ext-enable xdebug
# Copy xdebug.ini to /usr/local/etc/php/conf.d/
COPY ./*.ini /usr/local/etc/php/conf.d/
Nella root dev'essere presente il file xdebug.ini così configurato:
zend_extension=xdebug.so
[xdebug]
xdebug.mode=develop,debug
xdebug.discover_client_host = true
xdebug.start_with_request=yes
Ecco il devcontainer.json
{
"name": "Designbest Commerce ESW",
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": [
"../docker-compose.yml"
],
// The 'service' property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
"service": "wordpress",
// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/var/www/html",
// Add the IDs of extensions you want installed when the container is created.
"extensions": ["xdebug.php-pack", "xdebug.php-debug", "bmewburn.vscode-intelephense-client","neilbrayfield.php-docblocker"],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [8000]
}
Visual Studio
Cliccare sul pulsante Run & Debug e farsi creare in automatico il file .vscode/launch.json per abilitare xdebug.
Wordpress Admin
- Aggiornare l'aggiornabile
- Installare il plugin WooCommerce
- Installare il tema Astra
- Aspetto => Opzioni Astra => spalla dx => Installa Plugin Importatore
- Da questa pagina installare il template (scegliendo Elementor) Custom Printing con tutti i suoi contenuti
- Installare il plugin Classic Widget
- Installare il plugin Checkout Field Editor for WooCommerce.
Entrare nelle impostazioni e aggiungere i campi partita iva e codice fiscale con i nomibilling_cfebilling_piva
Easy Store - Le specifiche
Le API di Easy Store non permettono di caricare articoli sul gestionale, ma solo di leggerli.
Per sincronizzare i prodotti è necessario montare un pooling tramite un cron-job che andrà a leggere i dati del gestionale e li proietterà sul commerce.
Inserimento anagrafica
Quando un utente si registra al commerce è necessario aggiungere l'anagrafica al gestionale (nome, cognome, indirizzo, cod.fiscale/piva ecc)