ClickAndCollect : module finalisé
This commit is contained in:
@@ -4,7 +4,6 @@ namespace PointRetrait\Loop;
|
||||
|
||||
use PlanificationLivraison\PlanificationLivraison;
|
||||
use PointRetrait\Model\PdrScheduleQuery;
|
||||
use PointRetrait\PointRetrait;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
@@ -31,8 +30,20 @@ class ScheduleLoop extends BaseLoop implements PropelSearchLoopInterface
|
||||
*/
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
$theDate = '';
|
||||
|
||||
foreach ($loopResult->getResultDataCollection() as $pdr_schedule) {
|
||||
|
||||
if (null === $this->getClickAndCollect()) {
|
||||
$theDate = PlanificationLivraison::calculateRelativeDate($pdr_schedule->getDay(), null);
|
||||
}
|
||||
else {
|
||||
$newDate = PlanificationLivraison::calculateRelativeDate(null, $this->getPlaceId());
|
||||
if ($theDate == '' || $newDate < $theDate)
|
||||
$theDate = $newDate;
|
||||
}
|
||||
|
||||
|
||||
$loopResultRow = new LoopResultRow($pdr_schedule);
|
||||
$loopResultRow
|
||||
->set("ID", $pdr_schedule->getId())
|
||||
@@ -41,7 +52,7 @@ class ScheduleLoop extends BaseLoop implements PropelSearchLoopInterface
|
||||
->set("DAY_LABEL", PlanificationLivraison::getDayLabel($pdr_schedule->getDay()))
|
||||
->set("BEGIN", $pdr_schedule->getBeginTime())
|
||||
->set("END", $pdr_schedule->getEndTime())
|
||||
->set("CALCULATED_DAY", PlanificationLivraison::calculateRelativeDate($pdr_schedule->getDay())->format(PlanificationLivraison::FORMAT_DATES))
|
||||
->set("CALCULATED_DAY", PlanificationLivraison::getDayLabel(($theDate->format('w') - 1) % 6) . ' ' . $theDate->format(PlanificationLivraison::FORMAT_DATES))
|
||||
;
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
@@ -56,7 +67,8 @@ class ScheduleLoop extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntListTypeArgument('id'),
|
||||
Argument::createIntListTypeArgument('place_id')
|
||||
Argument::createIntListTypeArgument('place_id'),
|
||||
Argument::createBooleanTypeArgument('click_and_collect', null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user