controllers/front/endpoint.php
/**
     * Initializes endpoint controller: check access, sets class properties, etc.
     *
     * @return void
     */
Initializes endpoint controller: check access, sets class properties, etc.
@return void
Initializes endpoint controller : check access sets class properties etc . @return void
public function init()
    {
        if (!$this->checkAccess()) {
            http_response_code(401);
            $this->ajaxRenderJson(['error' => 'Invalid Token']);
        }
        $this->ajax = true;
        $this->content_only = true;
        $_GET['action'] = str_replace('/', '_', $_GET['action']);
        parent::init();
    }
public function init ( ) { if ( ! $ this -> checkAccess ( ) ) { http_response_code ( 401 ) ; $ this -> ajaxRenderJson ( [ 'error' => 'Invalid Token' ] ) ; } $ this -> ajax = true ; $ this -> content_only = true ; $ _GET [ 'action' ] = str_replace ( '/' , '_' , $ _GET [ 'action' ] ) ; parent :: init ( ) ; }
Initializes endpoint controller: check access, sets class properties, etc.
Initializes endpoint controller : check access sets class properties etc .
// Prestashop does not support json responses in case of authentication error so I must check it here. // This is necessary to avoid rendering html templates, as we want a json response // Prestashop does not support custom urls with slash // This trick allows Prestashop to handle requests with slash in "action" parameter // /module/marmiads/endpoint?action=/feed/products will call displayAjaxFeedProducts()