2017-07-06 17:41:10 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class OrderConfirmationController extends OrderConfirmationControllerCore
|
|
|
|
{
|
2017-09-25 11:04:33 +02:00
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
parent::init();
|
|
|
|
|
|
|
|
// Get configuration in order to move image
|
|
|
|
$order = new Order((int)($this->id_order));
|
|
|
|
$products = $order->getProducts();
|
|
|
|
if (count($products) > 0) {
|
|
|
|
foreach ($products as $product) {
|
|
|
|
if ($product['id_configuration'] != 0) {
|
|
|
|
$id_configurator = $product['id_configuration'];
|
|
|
|
$options = ConfiguratorStorage::getOptProductFlatten($id_configurator);
|
|
|
|
if (count($options)> 0) {
|
|
|
|
foreach ($options as $group) {
|
|
|
|
if ($group['type'] == 'file') {
|
|
|
|
$value = $group['value'][0];
|
|
|
|
$source = _PS_ROOT_DIR_."/upload/simu/".$product['id_product']."/".$group['reference']."/".$value;
|
|
|
|
$destPath = _PS_ROOT_DIR_."/orders/".$order->id."/".$product['id_product']."/".$group['reference'];
|
|
|
|
$dest = $destPath."/".$value;
|
|
|
|
// Create dir
|
|
|
|
mkdir($destPath, 0777, true);
|
|
|
|
// Copy file
|
|
|
|
copy($source, $dest);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-06 17:41:10 +02:00
|
|
|
public function initContent()
|
|
|
|
{
|
|
|
|
parent::initContent();
|
|
|
|
|
|
|
|
$customer = $this->context->customer;
|
|
|
|
$order = new Order($this->id_order);
|
|
|
|
$cart = new Cart($order->id_cart);
|
|
|
|
$carrier = new Carrier($order->id_carrier, Context::getContext()->language->id);
|
|
|
|
$summary = $cart->getSummaryDetails();
|
2017-07-27 16:34:51 +02:00
|
|
|
$message = Message::getMessageByCartId($order->id_cart);
|
2017-07-06 17:41:10 +02:00
|
|
|
|
|
|
|
$this->context->smarty->assign(
|
|
|
|
array(
|
|
|
|
'customer' => $customer,
|
|
|
|
'order' => $order,
|
|
|
|
'carrier' => $carrier,
|
|
|
|
'recap' => true,
|
|
|
|
'products' => $summary['products'],
|
|
|
|
'delivery' => $summary['delivery'],
|
|
|
|
'invoice' => $summary['invoice'],
|
|
|
|
'discounts' => $summary['discounts'],
|
|
|
|
'total_discounts' => $summary['total_discounts'],
|
|
|
|
'total_wrapping' => $summary['total_wrapping'],
|
|
|
|
'total_products_wt' => $summary['total_products_wt'],
|
|
|
|
'gift_products' => $summary['gift_products'],
|
|
|
|
'noDeleteButton' => true,
|
|
|
|
'total_shipping' => $order->total_shipping_tax_incl,
|
|
|
|
'total_shipping_tax_exc' => $order->total_shipping_tax_excl,
|
|
|
|
'total_price' => $order->total_paid,
|
|
|
|
'voucherAllowed' => false,
|
|
|
|
'show_option_allow_separate_package' => false,
|
2017-07-13 17:26:13 +02:00
|
|
|
'message' => $message
|
2017-07-06 17:41:10 +02:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|