83 lines
3.2 KiB
PHP
83 lines
3.2 KiB
PHP
<?php
|
|
/**
|
|
* Copyright since 2007 PrestaShop SA and Contributors
|
|
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
|
*
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* This source file is subject to the Open Software License (OSL 3.0)
|
|
* that is bundled with this package in the file LICENSE.md.
|
|
* It is also available through the world-wide-web at this URL:
|
|
* https://opensource.org/licenses/OSL-3.0
|
|
* If you did not receive a copy of the license and are unable to
|
|
* obtain it through the world-wide-web, please send an email
|
|
* to license@prestashop.com so we can send you a copy immediately.
|
|
*
|
|
* DISCLAIMER
|
|
*
|
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
|
* versions in the future. If you wish to customize PrestaShop for your
|
|
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
|
*
|
|
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
|
* @copyright Since 2007 PrestaShop SA and Contributors
|
|
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
|
*/
|
|
|
|
class OrderController extends OrderControllerCore
|
|
{
|
|
/*
|
|
* module: squaremeter
|
|
* date: 2021-11-19 11:36:06
|
|
* version: 5.5.0
|
|
*/
|
|
public function initContent()
|
|
{
|
|
$index = Configuration::get('WD_CUSTOMIZATION_INDEX');
|
|
$presented_cart = $this->cart_presenter->present($this->context->cart, true);
|
|
$customization_added_to_cart = array();
|
|
$dimension_data = array();
|
|
$temp = array();
|
|
$dimension_data_temp = array();
|
|
foreach ($presented_cart['products'] as $product) {
|
|
$id_customization = $product['id_customization'];
|
|
$temp = Db::getInstance()->executeS('SELECT *
|
|
FROM `' . _DB_PREFIX_ . 'customized_data`
|
|
WHERE `id_customization` = ' . (int) $id_customization);
|
|
|
|
if ($temp) {
|
|
$customization_added_to_cart[$id_customization] = $temp;
|
|
}
|
|
|
|
if ($temp) {
|
|
if (($id_customization !== 0) && ($customization_added_to_cart[$id_customization][0]['index'] == $index)) {
|
|
if (Shop::isFeatureActive()) {
|
|
$idShop = (int) Context::getContext()->shop->id;
|
|
} else {
|
|
$idShop = 1;
|
|
}
|
|
|
|
$dimension_data_temp = Db::getInstance()->executeS('SELECT *
|
|
FROM `' . _DB_PREFIX_ . 'squaremeteradmin` pa
|
|
WHERE pa.`id_product` = ' . (int) $product['id'] . ' AND
|
|
pa.`id_shop` = ' . (int) $idShop);
|
|
|
|
$dimension_data[$id_customization] = $dimension_data_temp;
|
|
|
|
$this->context->smarty->assign([
|
|
'customization_added_to_cart' => $customization_added_to_cart,
|
|
'dimension_data' => $dimension_data,
|
|
'module_dir' => _PS_MODULE_DIR_ . 'squaremeter/',
|
|
]);
|
|
}
|
|
} else {
|
|
$this->context->smarty->assign([
|
|
'module_dir' => _PS_MODULE_DIR_ . 'squaremeter/',
|
|
]);
|
|
}
|
|
}
|
|
|
|
parent::initContent();
|
|
}
|
|
}
|