Variables globales Prestashop 1.7

Variables globales Prestashop 1.7

Copier/coller sauvage des variables globales disponibles dans les templates Prestashop 1.7 :

{$currency.name} : Name of the active currency.
{$currency.iso_code} : ISO language code enabled.
{$currency.sign} : Symbol of the active currency
{$currency.iso_code_num} : Active Currency ISO Code

{$shop.name} : Store name in Prestashop 1.7
{$shop.email} : Store Email in Prestashop 1.7
{$shop.logo} : Image routing store logo in Prestashop 1.7
{$shop.favicon} : Route favicon image of the store in Prestashop 1.7
{$shop.address.address1} : Store address 1 in Prestashop 1.7
{$shop.address.address2} : Store address 2 in Prestashop 1.7
{$shop.address.postcode} : Store Zip Code in Prestashop 1.7
{$shop.address.city} : Store City in Prestashop 1.7
{$shop.address.state} : Province of the store in Prestashop 1.7
{$shop..address.country} : Shop Country in Prestashop 1.7
{$shop.phone} : Store phone in Prestashop 1.7
{$shop.fax} : Store Fax in Prestashop 1.7

{$language.name} : Language name enabled
{$language.iso_code} : ISO language code enabled
{$language.language_code} : Language code enabled (for Spanish, fr for French, tc ..)
{$language.is_rtl} : (1 : On / 0 Off (for when language is written from right to left)
{$language.format_lite} and {$ language.format_full} : Simulated date format and full date format
{$language.id} : Language ID enabled

{$customer.lastname} : Customer Last Name in Prestashop 1.7
{$customer.firstname} : Client Name Prestashop 1.7
{$customer.email} : Prestashop Customer Email 1.7
{$customer.birthday} : Prestashop client birthday 1.7
{$customer.newsletter} : Subscribed to the newsletter in Prestashop 1.7 (1 subscribed / 0 unsubscribed)
{$customer.newsletter_date_add} : Newsletter subscription date
{$customer.ip_registration_newsletter} : IP Registration Customers newsletter
{$customer.optin} : Subscribed to offers from our partners in Prestashop 1.7
{$customer.date_add} : Client creation date in Prestashop 1.7
{$customer.date_upd} : Last updated client update in Prestashop 1.7
{$customer.id} : Customer ID in Prestashop 1.7
{$customer.id_default_group} : Default group to which the client is associated in Prestashop 1.7
{$customer.is_logged } : Check if the client is "logged in" in Prestashop 1.7
{$customer.gender.name [$ customer.gender.id]} : Client Gender (Mr / Ms)
{$customer.addresses [Address ID] .city} : Client city of address 'X' that has partner. (Address ID, because a client can theoretically have multiple addresses)
{$customer.addresses [Address ID] .alias} : Address alias
{$customer.addresses [Address ID] .firstname} : Addressholder last name
{$customer.addresses [Address ID] .lastname} : Name of address holder
{$customer.addresses [Address ID] .company} : Company name of address holder
{$customer.addresses [Address ID] .address1} : Address 1
{$customer.addresses [Address ID] .address2} : Address 2
{$customer.addresses [Address ID] .postcode} : Mailing address
{$customer.addresses [Address ID] .id_state} : Address Province ID
{$customer.addresses [Address ID] .state} : Province address
{$customer.addresses [Address ID] .state_iso} : ISO address province code
{$customer.addresses [Address ID] .id_country} : Country address ID
{$customer.addresses [Address ID] .country} : Country of address
{$customer.addresses [Address ID] .country_iso} : ISO country address code
{$customer.addresses [Address ID] .phone} : Address phone
{$customer.addresses [Address ID] .phone_mobile} : Mobile phone address
{$customer.addresses [ID Address] .dni} : Address ID
{$customer.addresses [Address ID] .vat_number} : Customer VAT number
{$customer.addresses [Address ID] .formatted} : Client formatted address

{$urls.base_url} : Store address
{$urls.current_url} : Current address (url) where we are
{$urls.shop_domain_url} : Store domain
{$urls.img_ps_url} : Image root directory url
{$urls.img_cat_url} : Url directory of images of the categories
{$urls.img_lang_url} : Url of the language images directory
{$urls.img_prod_url} : Url of the product images directory
{$urls.img_manu_url} : Url directory of manufacturers images
{$urls.img_sup_url} : Url of the providers directory
{$urls.img_ship_url} : Url directory of images of carriers
{$urls.img_store_url}
{$urls.img_url} : Url of the image directory of the template
{$urls.css_url} : Template URL directory url
{$urls.js_url} : Template JS directory url
{$urls.pic_url} : Url file directory uploaded
{$urls.pages.address} : Url from the "My Address" section
{$urls.pages.addresses} : Url from the "My addresses" section
{$urls.pages.authentication} : Url section of the authentication page
{$urls.pages.cart} : Cart section url (order summary)
{$urls.pages.category} : Url section of categories
{$urls.pages.cms} : Url of the content section
{$urls.pages.contact} - > Url section of the contact form
{$urls.pages.discount} : Url of the discount voucher section
{$urls.pages.guest_tracking} : Tracking url for unregistered clients
{$urls.pages.history} : Url from the order history section
{$urls.pages.identity} : Url of the section "Personal data"
{$urls.pages.index} : Page url
{$urls.pages.my_account} : Url section of my account
{$urls.pages.order_confirmation} : Url section of the order confirmation page.
{$urls.pages.order_follow} - > Url in the "Order Tracking"
{$urls.pages.order}
{$urls.pages.order_return}
{$urls.pages.order_slip}
{$urls.pages.pagenotfound} : Url of section "404 (Page not found)"
{$urls.pages.password} : Url of the section "Recover Password"
{$urls.pages.pdf_invoice} :
{$urls.pages.pdf_order_return}
{$urls.pages.pdf_order_slip}
{$urls.pages.prices_drop} : Url section we lowered prices / products discount / discounts
{$urls.pages.product} : Product tab url
{$urls.pages.search} : Url of the searcher section
{$urls.pages.sitemap} : Site Map section url
{$urls.pages.stores} : Url of the section "Shops / Our stores"
{$urls.pages.supplier} : Url from the providers section
{$urls.pages.register} : Url log page
{$urls.pages.order_login}
{$urls.theme_assets} : Url of the "assets" directory of the template / themes / template / assets /
{$urls.actions.logout} : Url to close section in the store

Références externes

RGPD, Analytics et Prestashop

RGPD, Analytics et Prestashop

Aujourd’hui on va installer le script tarteaucitron sur une boutique Prestashop 1.7. Pour mémoire, il s’agit du moyen le plus rapide et fiable d’être conforme aux nouvelles directives Européennes, le fameux (ou fumeux ?) RGPD.

Installation

Récupérer le script sur le dépôt Github : tarteaucitron. Dans le thème de Prestashop, créer l’arborescence suivante :

├─ ... 
└─ themes
    ├─ classic
    └─ myawesometheme
        └─ assets
            └─ css
            │   └─ tarteaucitron.css
            └─ js
            │   └─ tarteaucitron
            │       ├─ tarteaucitron.js
            │       └─ tarteaucitron.services
            └─ ...

Bien sûr remplacez myawesometheme par le nom de votre thème. Ensuite on modifie le fichier /themes/myawesometheme/templates/_partials/head.tpl :

{extends file='parent:_partials/head.tpl'}

{block name='hook_extra'}
    <link rel="stylesheet" href="{$urls.theme_assets}/css/tarteaucitron.css" type="text/css" media="all">
{/block}

{block name='javascript_head' append}
    <script src="{$urls.theme_assets}/js/tarteaucitron/tarteaucitron.js"></script>
    {literal}
    <script>
        tarteaucitron.init({
            "hashtag": "#tarteaucitron", /* Ouverture automatique du panel avec le hashtag */
            "highPrivacy": false, /* désactiver le consentement implicite (en naviguant) ? */
            "orientation": "top", /* le bandeau doit être en haut (top) ou en bas (bottom) ? */
            "adblocker": false, /* Afficher un message si un adblocker est détecté */
            "showAlertSmall": false, /* afficher le petit bandeau en bas à droite ? */
            "cookieslist": true, /* Afficher la liste des cookies installés ? */
            "removeCredit": true /* supprimer le lien vers la source ? */
        });
        tarteaucitron.user.analyticsUa = 'UA-XXXXXXXXX-X';
        tarteaucitron.user.analyticsMore = function () { ga('set', 'anonymizeIp', true); };
        (tarteaucitron.job = tarteaucitron.job || []).push('analytics');
    </script>
    {/literal}
{/block}

Le fonctionnement est simple, il suffit d’ajout des services en ajoutant une ligne comme celle-ci :

(tarteaucitron.job = tarteaucitron.job || []).push('service');

Et remplacez service par le nom du service à ajouter. Pour trouver les services disponibles, il suffit de se rendre sur la documentation du script (voir Références externes en fin d’article).

Google Analytics

Pour le moment le script ne fait rien. Ajoutons le support Google Analytics :

{extends file='parent:_partials/head.tpl'}

...

{block name='javascript_head' append}
    ...
    {literal}
    <script>
        ...
        tarteaucitron.user.analyticsUa = 'UA-XXXXXXXXX-X';
        tarteaucitron.user.analyticsMore = function () { ga('set', 'anonymizeIp', true); };
        (tarteaucitron.job = tarteaucitron.job || []).push('analytics');
    </script>
    {/literal}
{/block}

Ne pas oublier de remplacer UA-XXXXXXXXX-X par votre identifiant google !

Personnalisation

Le script vient avec une feuille de style toute prête qui peut convenir si on n’est pas très exigeant. Pour coller au mieux à l’identité visuelle du thème, il n’est pas interdit de surcharger quelques classes. Un exemple de personnalisation : VanEscape.

Références externes

Prestashop & country_module_list.xml

Qui n’est jamais tombé nez à nez avec cette erreur aussi incompréhensible que frustrante :

Error found : CData section not finished in Optimisation de la visibilité de vos produi dans le fichier country_module_list.ml

La solution est tout aussi déconcertante (se placer à la racine de prestashop) :

$ rm -r ./config/xml
$ mkdir ./config/xml