bebeboutik/override/controllers/OrderConfirmationController.php

58 lines
1.5 KiB
PHP
Raw Permalink Normal View History

2016-01-04 12:48:08 +01:00
<?php
class OrderConfirmationController extends OrderConfirmationControllerCore {
public function preProcess() {
// Fix : delay after payment from paybox or paypal
// so that the order has enough time to be created.
sleep(5);
2016-01-04 12:48:08 +01:00
parent::preProcess();
$order = new Order($this->id_order);
$products = $order->getProducts();
foreach ($products as $product) {
$productIds[] = (int) $product['product_id'];
}
self::$smarty->assign(
array(
'order' => $order,
'productIds' => $productIds,
'currency' => Currency::getCurrency((int) $order->id_currency),
)
);
}
public function displayContent() {
$customer = Context::getContext()->customer;
$order = new Order($this->id_order);
$products = $order->getProducts();
$address_delivery = new Address($order->id_address_delivery);
$address_invoice = new Address($order->id_address_invoice);
foreach ($products as $key => $product) {
$cover = Product::getCover((int) $product['product_id']);
$products[$key]['id_image'] = $cover['id_image'];
}
// assign delay to Products
if (Module::isInstalled('privatesales_delay')) {
require_once _PS_ROOT_DIR_.'/modules/privatesales_delay/saledelay.php';
$products = SaleDelay::associateDelay($products);
}
self::$smarty->assign(
array(
'customer' => $customer,
'order' => $order,
'address_delivery' => $address_delivery,
'address_invoice' => $address_invoice,
'products' => $products
)
);
self::$smarty->display(_PS_THEME_DIR_.'order-confirmation.tpl');
}
}