Files
newwalls.pl/modules/freeorderconfirmation/override/controllers/front/OrderConfirmationController.php
2024-12-17 13:43:22 +01:00

53 lines
2.1 KiB
PHP

<?php
/**
* PrestaShop module created by VEKIA, a guy from official PrestaShop community ;-)
*
* @author VEKIA PL VATEU: PL9730945634
* @copyright 2010-2025 VEKIA PL MILOSZ MYSZCZUK
* @license This program is not free software and you can't resell and redistribute it
*
* CONTACT WITH DEVELOPER https://mypresta.eu | support@mypresta.eu
*
*/
use PrestaShop\PrestaShop\Adapter\Presenter\Order\OrderPresenter;
class OrderConfirmationController extends OrderConfirmationControllerCore
{
public function init()
{
FrontController::init();
if (Configuration::get('freeorderconfirmation_oc') == 1) {
$cart = $this->context->cart;
if (true === (bool)Tools::getValue('free_order')) {
$this->checkFreeOrder();
$this->id_cart = (int)$this->context->cart->id;
$this->id_order = Order::getIdByCartId((int)($this->id_cart));
$this->secure_key = Tools::getValue('key', false);
$order = new Order((int)($this->id_order));
$this->reference = $order->reference;
$freeorderconfirmation = Module::getInstanceByName('freeorderconfirmation');
$redirectLink = $freeorderconfirmation::getOrderConfirmationPage($this->id_order);
if ($redirectLink != false) {
Tools::redirect($redirectLink);
}
$this->order_presenter = new OrderPresenter();
} elseif (Tools::getValue('id_order', 'false') != 'false') {
$this->id_order = Tools::getValue('id_order');
$order = new Order($this->id_order);
$this->id_cart = (int)$order->id_cart;
$this->order = $order;
$this->customer = $this->context->customer;
if ($this->context->customer->id == $this->order->id_customer) {
$this->order_presenter = new OrderPresenter();
} else {
parent::init();
}
} else {
parent::init();
}
} else {
parent::init();
}
}
}