Browse Source

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

feature/rotating_product
Guillaume Bourgeois 6 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

<h4>Groupes utilisateurs</h4> <h4>Groupes utilisateurs</h4>
<?= $form->field($model, 'id_user_group_default') <?= $form->field($model, 'id_user_group_default')
->dropDownList($userGroupModule->getRepository()->populateUserGroupDropdownList()); ?> ->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>
</div> </div>



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

<?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

'tiller_refresh_token', 'tiller_refresh_token',
'tiller_redirect_uri', 'tiller_redirect_uri',
'tiller_store_id', 'tiller_store_id',
'option_main_color'
'option_main_color',
'option_newsletter_description'
], ],
'string' 'string'
], ],
'tiller_store_id' => 'Tiller : store ID', 'tiller_store_id' => 'Tiller : store ID',
'is_new' => 'Nouveau', 'is_new' => 'Nouveau',
'agree_contact_about_software_development' => "J'accepte d'être contacté dans le cadre de l'amélioration du logiciel", '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

use yii\helpers\Html; use yii\helpers\Html;


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


if($userModule->isUserSubscribedNewsletter($user)) { if($userModule->isUserSubscribedNewsletter($user)) {


?> ?>
<div class="newsletter-index"> <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)): ?> <?php if($userModule->isUserSubscribedNewsletter($user)): ?>
<div class="alert alert-success"> <div class="alert alert-success">
<i class="bi bi-megaphone"></i> <i class="bi bi-megaphone"></i>
Vous n'êtes pas inscrit à l'infolettre <strong><?= Html::encode($producer->name) ?></strong>. Vous n'êtes pas inscrit à l'infolettre <strong><?= Html::encode($producer->name) ?></strong>.
</div> </div>
<?php endif; ?> <?php endif; ?>
</div>
</div>

Loading…
Cancel
Save