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 Apr 20, 2023
1 parent 45eabab commit 5271277
Show file tree
Hide file tree
Showing 8 changed files with 340 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/autoconfig/configure_ps_banner.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

use PrestaShop\PrestaShop\Adapter\Module\Configuration\ModuleComplexConfigurationInterface;

class configure_ps_banner implements ModuleComplexConfigurationInterface
{
public 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']);
}
}
73 changes: 73 additions & 0 deletions tests/autoconfig/configure_ps_imageslider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php

use PrestaShop\PrestaShop\Adapter\Module\Configuration\ModuleComplexConfigurationInterface;

class configure_ps_imageslider implements ModuleComplexConfigurationInterface
{
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>',
],
],
];

public 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');
Loading

0 comments on commit 5271277

Please sign in to comment.