Daily Sending Window Start/End hours

Jess

Member
Hello,

I would like to set my campaign to send from 4 pm to 3 am, and when I set it up like this, it would not allow for me to save, showing this error message in red:

1672773161619.png

How can I set the app to send between 4 pm and 3 am?

Thank you!
 
How can I set the app to send between 4 pm and 3 am?
It's a daily sending hour so you need to set start hour to be less that end hour. You cannot set end hour to be the next day at 3:00 AM
 
Thank you. I am trying to make it 9 am to 9 pm and it still shows the same error message not allowing to save:

1672841660731.png
The starting hour is less than the end hour now. Actually, II get the same thing regardless of the times I add there, with Start hour being less than end hour. I am adding this on an already started campaign which has been paused for now - maybe this is why I am getting this issue? Maybe this only works on freshly created campaigns? Please advise.

Thank you
 
Last edited:
Hi, I can't update to the last version yet, so can i updade the code to fix it?

If so, what changes do I need to perform? See if I miising something or there is other possibility please

In the file apps/customer/views/campaigns/step-confirm.php I need to change the lines 143, 144, 145 to:

<?php echo $form->labelEx($campaign, 'send_between_interval'); ?>
<?php echo $form->dropDownList($campaign, 'send_between_interval', CMap::mergeArray(['' => t('app', 'Choose')], $campaign->getSendBetweenIntervalsList()), $campaign->fieldDecorator->getHtmlOptions('send_between_interval', ['class' => 'form-control select2', 'style' => 'width: 100%'])); ?>
<?php echo $form->error($campaign, 'send_between_interval'); ?>

In the file apps/common/models/Campaign.php i need to create 2 functions:
public function getSendBetweenHoursList(): array
{
$time = (Carbon\Carbon::now())->setTime(0, 0);
$list = [];

for ($i = 1; $i <= 24; $i++) {
try {
$key = $time->format('H:i:s');
$value = $this->dateTimeFormatter->formatLocalizedTime($time->format('Y-m-d H:i:s'));
$list[$key] = $value;
} catch (Exception $e) {
Yii::log($e->getMessage(), CLogger::LEVEL_ERROR);
}
$time = $time->addHour();
}

return $list;
}

/**
* @return array
*/
public function getSendBetweenIntervalsList(): array
{
$list = [];

for ($i = 1; $i <= 23; $i++) {
$list[$i] = t('app', '{n} hour|{n} hours', $i);
}

return $list;
}

Also the field send_between_end in the table mw_campaign needs to be changed?
 
Back
Top