Handling a relay pickup point choice via an Ajax FO controller
Let’s create a legacy controller in the /modules/whrelaycarrier/controllers/front/ajax.php
file responsible for handling the Ajax calls to store matches between the current cart and the chosen pickup relay point. This will be the occasion for us to see how to use a FO controller as an Ajax handler. The definition for this class is as follows:
<?php use WebHelpers\WHRelayCarrier\Entity\WHRelayCart; class WHRelayCarrierAjaxModuleFrontController extends ModuleFrontController { public function displayAjax() { $entityManager = $this->get( 'doctrine.orm.entity_manager'); $relayCartRepository = $this->get( 'webhelpers.whrelaycarrier.repository .whrelaycart_repository'); $cart = Tools::getValue...