Skip to content

Commit

Permalink
Introduce configuration script to have Google Ready shops
Browse files Browse the repository at this point in the history
Co-authored-by: ingridusta <ingridusta@users.noreply.github.com>
  • Loading branch information
Quetzacoalt91 and ingridusta committed Mar 30, 2023
1 parent d9a8dab commit 5fcb4dc
Show file tree
Hide file tree
Showing 8 changed files with 333 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/autoconfig/configure_ps_banner.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

class configure_ps_banner {
function run () {
$languages = Language::getLanguages(false);

foreach ($languages as $lang) {
$values['BANNER_LINK'][(int) $lang['id_lang']] = Context::getContext()->link->getCategoryLink(
new Category(3),
null,
$lang['id_lang']
);
}
Configuration::updateValue('BANNER_LINK', $values['BANNER_LINK']);
}
}
70 changes: 70 additions & 0 deletions tests/autoconfig/configure_ps_imageslider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

class configure_ps_imageslider {
private $data = [
1 => [
'fr' => [
'idCategory' => 9,
'title' => "DECORATION",
'description' => "<h3>Ajoutez la touche finale</h3>
<p>De l'art et de la décoration pour tous</p>",
],
'gb' => [
'idCategory' => 9,
'title' => "ART",
'description' => "<h3>Add the final touch</h3>
<p>Art and decoration for everyone.</p>",
],
],
2 => [
'fr' => [
'idCategory' => 6,
'title' => "ACCESSOIRES",
'description' => "<h3>Rien que pour vous</h3>
<p>Découvrez notre collection d’accessoires.</p>",
],
'gb' => [
'idCategory' => 6,
'title' => "ACCESSORIES",
'description' => "<h3>Only for you</h3>
<p>Discover our accessories collection.</p>",
],
],
3 => [
'fr' => [
'idCategory' => 3,
'title' => "VETEMENTS",
'description' => "<h3>Prêt-à-porter</h3>
<p>Découvrez notre collection de vêtements.</p>",
],
'gb' => [
'idCategory' => 3,
'title' => "CLOTHING",
'description' => "<h3>Ready to wear</h3>
<p>Discover our clothing collection.</p>",
],
],
];

function run () {
include_once _PS_ROOT_DIR_ . '/modules/ps_imageslider/Ps_HomeSlide.php';

$languages = Language::getLanguages(false);
foreach ($this->data as $slideId => $slideData) {

$slide = new Ps_HomeSlide($slideId);
foreach ($languages as $language) {
$slideDataLang = $slideData[$language['iso_code']];

$slide->title[$language['id_lang']] = $slideDataLang['title'];
$slide->description[$language['id_lang']] = $slideDataLang['description'];
$slide->url[$language['id_lang']] = Context::getContext()->link->getCategoryLink(
new Category($slideDataLang['idCategory']),
null,
$language['id_lang']
);
}
$slide->save();
}
}
}
14 changes: 14 additions & 0 deletions tests/autoconfig/customtext.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
UPDATE ps_info_lang SET `text` = '<h2><span style="color: #cbb3f7">Discover Zaruhi Shop</span></h2>
<p>Welcome to Zaruhi Shop, your online destination for unique and quality clothing, accessories, and home decor. We take pride in offering you a wide selection of products from different styles and trends so you can find something that suits you.</p>
<p>Whether you\'re looking for a dress for a special occasion, a handbag to complement your daily outfit, or decor items for your home, we\'ve got you covered. Our team works hard to find the most popular products of the moment and ensure that we offer quality items at affordable prices.</p>
<p>Browse our online store to discover our collection of products and find your next favorite item at Zaruhi Shop.</p>' WHERE id_shop = 1 AND id_lang = (SELECT id_lang from ps_lang where iso_code = 'gb');

UPDATE ps_info_lang SET `text` = '<h2><span style="color: #cbb3f7">Découvrez Zaruhi Shop</span></h2>
<p>Bienvenue chez Zaruhi Shop, votre destination en ligne pour des vêtements, des accessoires et de la décoration uniques et de qualité. Nous sommes fiers de vous offrir une large sélection de produits de différents styles et tendances pour que vous puissiez trouver quelque chose qui vous convient.</p>
<p>Que vous cherchiez une robe pour une occasion spéciale, un sac à main pour compléter votre tenue quotidienne ou des objets de décoration pour votre maison, nous avons ce qu\'il vous faut. Notre équipe travaille dur pour trouver les produits les plus en vogue du moment et pour s\'assurer que nous proposons des articles de qualité à des prix abordables.</p>
<p>Parcourez notre boutique en ligne pour découvrir notre collection de produits et trouvez votre prochain coup de cœur chez Zaruhi Shop.</p>' WHERE id_shop = 1 AND id_lang = (SELECT id_lang from ps_lang where iso_code = 'fr');

;

UPDATE ps_hook_module SET position = position + 1 WHERE id_hook = (SELECT id_hook FROM `ps_hook` where `name` like "displayHome");
UPDATE ps_hook_module SET position = 0 WHERE id_hook = (SELECT id_hook FROM `ps_hook` where `name` like "displayHome") AND id_module = (SELECT id_module FROM ps_module WHERE `name` LIKE 'ps_customtext');
105 changes: 105 additions & 0 deletions tests/autoconfig/legaltexts.sql

Large diffs are not rendered by default.

Binary file added tests/autoconfig/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions tests/autoconfig/psgdpr.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
UPDATE `ps_psgdpr_consent` psgdpr
LEFT JOIN ps_psgdpr_consent_lang psgdprl ON (psgdpr.id_gdpr_consent = psgdprl.id_gdpr_consent)
SET psgdprl.message = "J'accepte les conditions générales et la politique de confidentialité"
WHERE psgdprl.id_lang = (SELECT id_lang from ps_lang where iso_code = 'fr');

UPDATE `ps_psgdpr_consent` psgdpr
LEFT JOIN ps_psgdpr_consent_lang psgdprl ON (psgdpr.id_gdpr_consent = psgdprl.id_gdpr_consent)
SET psgdprl.message = "I accept the terms and conditions and the privacy policy"
WHERE psgdprl.id_lang = (SELECT id_lang from ps_lang where iso_code = 'gb');
101 changes: 101 additions & 0 deletions tests/autoconfig/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# robots.txt automatically generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums
# This file is to prevent the crawling and indexing of certain parts
# of your site by web crawlers and spiders run by sites like Yahoo!
# and Google. By telling these "robots" where not to go on your site,
# you save bandwidth and server resources.
# For more information about the robots.txt standard, see:
# http://www.robotstxt.org/robotstxt.html
User-agent: *
# Allow Directives
Allow: */modules/*.css
Allow: */modules/*.js
Allow: */modules/*.png
Allow: */modules/*.jpg
Allow: */themes/*/assets/cache/*.js
Allow: */themes/*/assets/cache/*.css
Allow: */themes/*/assets/css/*
# Private pages
Disallow: /*?order=
Disallow: /*?tag=
Disallow: /*?id_currency=
Disallow: /*?search_query=
Disallow: /*?back=
Disallow: /*?n=
Disallow: /*&order=
Disallow: /*&tag=
Disallow: /*&id_currency=
Disallow: /*&search_query=
Disallow: /*&back=
Disallow: /*&n=
Disallow: /*controller=addresses
Disallow: /*controller=address
Disallow: /*controller=authentication
Disallow: /*controller=cart
Disallow: /*controller=discount
Disallow: /*controller=footer
Disallow: /*controller=get-file
Disallow: /*controller=header
Disallow: /*controller=history
Disallow: /*controller=identity
Disallow: /*controller=images.inc
Disallow: /*controller=init
Disallow: /*controller=my-account
Disallow: /*controller=order
Disallow: /*controller=order-slip
Disallow: /*controller=order-detail
Disallow: /*controller=order-follow
Disallow: /*controller=order-return
Disallow: /*controller=order-confirmation
Disallow: /*controller=pagination
Disallow: /*controller=password
Disallow: /*controller=pdf-invoice
Disallow: /*controller=pdf-order-return
Disallow: /*controller=pdf-order-slip
Disallow: /*controller=product-sort
Disallow: /*controller=search
Disallow: /*controller=statistics
Disallow: /*controller=attachment
Disallow: /*controller=guest-tracking
# Directories
Disallow: */cache/
Disallow: */classes/
Disallow: */config/
Disallow: */controllers/
Disallow: */css/
Disallow: */download/
Disallow: */js/
Disallow: */localization/
Disallow: */log/
Disallow: */mails/
Disallow: */modules/
Disallow: */override/
Disallow: */pdf/
Disallow: */src/
Disallow: */tools/
Disallow: */translations/
Disallow: */upload/
Disallow: */vendor/
Disallow: */web/
Disallow: */webservice/
Disallow: */module/pwfavorites/
Disallow: */module/salesnotification/
Disallow: */module/lexique/
# Files
Disallow: /adresse
Disallow: /adresses
Disallow: /connexion
Disallow: /panier
Disallow: /reduction
Disallow: /suivi-commande-invite
Disallow: /historique-commandes
Disallow: /identite
Disallow: /mon-compte
Disallow: /commande
Disallow: /confirmation-commande
Disallow: /suivi-commande
Disallow: /avoirs
Disallow: /recuperation-mot-de-passe
Disallow: /recherche
Disallow: /mes-preferences

18 changes: 18 additions & 0 deletions tests/autoconfig/self_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
configuration:
delete:
- PS_SHOP_PHONE

files:
- source: "robots.txt"
dest: "../../../../robots.txt"
# - source: "logo.png"
# dest: "../../../../img/logo.png"

sql:
- "customtext.sql"
- "psgdpr.sql"
- legaltexts.sql

php:
- "configure_ps_banner.php"
- "configure_ps_imageslider.php"

0 comments on commit 5fcb4dc

Please sign in to comment.