Files
bio-concept-pharma/web/modules/tntofficiel/controllers/front/tracking.php
2019-11-17 19:14:07 +01:00

64 lines
1.6 KiB
PHP

<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.world>
* @copyright 2016-2019 GFI Informatique, 2016-2019 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/TNTOfficiel_ClassLoader.php';
class TNTOfficielTrackingModuleFrontController extends ModuleFrontController
{
/**
* TNTOfficielTrackingModuleFrontController constructor.
* Controller always used for AJAX response.
*/
public function __construct()
{
TNTOfficiel_Logstack::log();
parent::__construct();
// FO Auth is required and guest allowed.
$this->auth = true;
$this->guestAllowed = true;
// SSL
$this->ssl = Tools::usingSecureMode();
// No header/footer.
$this->ajax = true;
}
/**
* Display the tracking popup.
*
* @return bool
*/
public function displayAjaxTracking()
{
TNTOfficiel_Logstack::log();
$intOrderID = (int)Tools::getValue('orderId');
$objContext = $this->context;
$objCustomer = $objContext->customer;
if ($objCustomer->isLogged($this->guestAllowed)) {
$objOrder = new Order($intOrderID);
// If order belong to customer.
if ((int)$objOrder->id_customer === (int)$objCustomer->id) {
if (TNTOfficiel_Parcel::displayTrackingPopUp($intOrderID)) {
return true;
}
}
}
// 404 fallback.
Controller::getController('PageNotFoundController')->run();
return false;
}
}