Browse Source

[Boutique] Infolettre : texte d'information configurable dans "Paramètres > Général > Description infolettre"

feature/rotating_product
Guillaume Bourgeois 7 months ago
parent
commit
e73993cc24
4 changed files with 47 additions and 4 deletions
  1. +5
    -0
      backend/views/producer/update.php
  2. +26
    -0
      console/migrations/m240513_092509_add_column_producer_option_newsletter_description.php
  3. +4
    -2
      domain/Producer/Producer/Producer.php
  4. +12
    -2
      producer/views/newsletter/index.php

+ 5
- 0
backend/views/producer/update.php View File

@@ -144,6 +144,11 @@ $this->addBreadcrumb($this->getTitle());
<h4>Groupes utilisateurs</h4>
<?= $form->field($model, 'id_user_group_default')
->dropDownList($userGroupModule->getRepository()->populateUserGroupDropdownList()); ?>

<h4>Communication</h4>
<?= $form->field($model, 'option_newsletter_description')
->hint('Description affichée sur la page "Infolettre" de la boutique')
->textarea(); ?>
</div>
</div>


+ 26
- 0
console/migrations/m240513_092509_add_column_producer_option_newsletter_description.php View File

@@ -0,0 +1,26 @@
<?php

use yii\db\Migration;
use yii\db\Schema;

/**
* Class m240513_092509_add_column_producer_option_newsletter_description
*/
class m240513_092509_add_column_producer_option_newsletter_description extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('producer', 'option_newsletter_description', Schema::TYPE_TEXT);
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('producer', 'option_newsletter_description');
}
}

+ 4
- 2
domain/Producer/Producer/Producer.php View File

@@ -256,7 +256,8 @@ class Producer extends ActiveRecordCommon
'tiller_refresh_token',
'tiller_redirect_uri',
'tiller_store_id',
'option_main_color'
'option_main_color',
'option_newsletter_description'
],
'string'
],
@@ -531,7 +532,8 @@ class Producer extends ActiveRecordCommon
'tiller_store_id' => 'Tiller : store ID',
'is_new' => 'Nouveau',
'agree_contact_about_software_development' => "J'accepte d'être contacté dans le cadre de l'amélioration du logiciel",
'option_main_color' => 'Couleur principale'
'option_main_color' => 'Couleur principale',
'option_newsletter_description' => 'Description infolettre'
];
}


+ 12
- 2
producer/views/newsletter/index.php View File

@@ -40,7 +40,7 @@ use domain\User\User\UserModule;
use yii\helpers\Html;

$userModule = UserModule::getInstance();
$producer = $this->context->getProducerCurrent();
$this->setTitle("Infolettre");

if($userModule->isUserSubscribedNewsletter($user)) {
@@ -65,6 +65,16 @@ else {

?>
<div class="newsletter-index">

<div class="alert alert-dark">
<i class="bi bi-info"></i>
<?php if($producer->option_newsletter_description): ?>
<?= nl2br(Html::encode($producer->option_newsletter_description)); ?>
<?php else: ?>
L'infolettre vous permet de recevoir les emails de prise de commande et les actualités de ce producteur.
<?php endif; ?>
</div>

<?php if($userModule->isUserSubscribedNewsletter($user)): ?>
<div class="alert alert-success">
<i class="bi bi-megaphone"></i>
@@ -76,4 +86,4 @@ else {
Vous n'êtes pas inscrit à l'infolettre <strong><?= Html::encode($producer->name) ?></strong>.
</div>
<?php endif; ?>
</div>
</div>

Loading…
Cancel
Save