2020-04-16 15:26:03 +03:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* MIT License
|
|
|
|
*
|
2021-12-06 14:37:43 +03:00
|
|
|
* Copyright (c) 2021 DIGITAL RETAIL TECHNOLOGIES SL
|
2020-04-16 15:26:03 +03:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*
|
|
|
|
* 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 http://www.prestashop.com for more information.
|
|
|
|
*
|
|
|
|
* @author DIGITAL RETAIL TECHNOLOGIES SL <mail@simlachat.com>
|
2021-12-06 14:37:43 +03:00
|
|
|
* @copyright 2021 DIGITAL RETAIL TECHNOLOGIES SL
|
2020-04-16 15:26:03 +03:00
|
|
|
* @license https://opensource.org/licenses/MIT The MIT License
|
|
|
|
*
|
|
|
|
* Don't forget to prefix your containers with your own identifier
|
|
|
|
* to avoid any conflicts with others containers.
|
|
|
|
*/
|
2021-12-06 14:37:43 +03:00
|
|
|
|
2020-04-16 15:26:03 +03:00
|
|
|
class RetailcrmSettingsTemplate extends RetailcrmAbstractTemplate
|
|
|
|
{
|
|
|
|
protected $settings;
|
|
|
|
protected $settingsNames;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* RetailcrmSettingsTemplate constructor.
|
|
|
|
*
|
|
|
|
* @param \Module $module
|
2021-11-03 16:19:39 +07:00
|
|
|
* @param $smarty
|
|
|
|
* @param $assets
|
|
|
|
* @param $settings
|
|
|
|
* @param $settingsNames
|
2020-04-16 15:26:03 +03:00
|
|
|
*/
|
|
|
|
public function __construct(Module $module, $smarty, $assets, $settings, $settingsNames)
|
|
|
|
{
|
|
|
|
parent::__construct($module, $smarty, $assets);
|
|
|
|
|
|
|
|
$this->settings = $settings;
|
|
|
|
$this->settingsNames = $settingsNames;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Build params for template
|
|
|
|
*
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
protected function getParams()
|
|
|
|
{
|
2021-11-03 16:19:39 +07:00
|
|
|
$params = [];
|
2020-04-16 15:26:03 +03:00
|
|
|
|
|
|
|
if ($this->module->api) {
|
|
|
|
$params['statusesDefaultExport'] = $this->module->reference->getStatuseDefaultExport();
|
|
|
|
$params['deliveryTypes'] = $this->module->reference->getDeliveryTypes();
|
|
|
|
$params['orderStatuses'] = $this->module->reference->getStatuses();
|
2021-10-19 17:44:32 +03:00
|
|
|
$params['outOfStockStatuses'] = $this->module->reference->getOutOfStockStatuses(
|
|
|
|
[
|
|
|
|
'out_of_stock_paid' => $this->module->translate('If order paid'),
|
|
|
|
'out_of_stock_not_paid' => $this->module->translate('If order not paid'),
|
|
|
|
]
|
|
|
|
);
|
2020-04-16 15:26:03 +03:00
|
|
|
$params['paymentTypes'] = $this->module->reference->getPaymentTypes();
|
|
|
|
$params['methodsForDefault'] = $this->module->reference->getPaymentAndDeliveryForDefault(
|
2021-10-19 17:44:32 +03:00
|
|
|
[
|
|
|
|
$this->module->translate('Delivery method'),
|
|
|
|
$this->module->translate('Payment type'),
|
|
|
|
]
|
2020-04-16 15:26:03 +03:00
|
|
|
);
|
2021-04-29 16:40:42 +03:00
|
|
|
$params['ordersCount'] = RetailcrmExport::getOrdersCount();
|
|
|
|
$params['customersCount'] = RetailcrmExport::getCustomersCount();
|
|
|
|
$params['exportCustomersCount'] = RetailcrmExport::getCustomersCount(false);
|
|
|
|
$params['exportOrdersStepSize'] = RetailcrmExport::RETAILCRM_EXPORT_ORDERS_STEP_SIZE_WEB;
|
|
|
|
$params['exportCustomersStepSize'] = RetailcrmExport::RETAILCRM_EXPORT_CUSTOMERS_STEP_SIZE_WEB;
|
2021-12-16 13:15:40 +03:00
|
|
|
$params['lastRunDetails'] = RetailcrmJobManager::getLastRunDetails(true);
|
2021-05-28 14:32:43 +03:00
|
|
|
$params['currentJob'] = Configuration::get(RetailcrmJobManager::CURRENT_TASK);
|
|
|
|
$params['currentJobCli'] = Configuration::get(RetailcrmCli::CURRENT_TASK_CLI);
|
|
|
|
$params['retailcrmLogsInfo'] = RetailcrmLogger::getLogFilesInfo();
|
2021-07-27 13:25:44 +03:00
|
|
|
$params['catalogInfoMultistore'] = RetailcrmCatalogHelper::getIcmlFileInfoMultistore();
|
|
|
|
$params['shopsInfo'] = RetailcrmContextSwitcher::getShops();
|
2021-06-25 18:44:52 +03:00
|
|
|
$params['errorTabs'] = $this->module->validateStoredSettings();
|
2021-12-06 14:37:43 +03:00
|
|
|
|
|
|
|
$params['retailControllerOrders'] = RetailcrmTools::getAdminControllerUrl(
|
|
|
|
RetailcrmOrdersController::class
|
|
|
|
);
|
|
|
|
$params['retailControllerOrdersUpload'] = RetailcrmTools::getAdminControllerUrl(
|
|
|
|
RetailcrmOrdersUploadController::class
|
|
|
|
);
|
|
|
|
$params['adminControllerOrders'] = RetailcrmTools::getAdminControllerUrl(
|
|
|
|
AdminOrdersController::class
|
|
|
|
);
|
2020-04-16 15:26:03 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return $params;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function buildParams()
|
|
|
|
{
|
|
|
|
$this->data = array_merge(
|
2021-11-03 16:19:39 +07:00
|
|
|
[
|
2020-04-16 15:26:03 +03:00
|
|
|
'assets' => $this->assets,
|
|
|
|
'cartsDelays' => $this->module->getSynchronizedCartsTimeSelect(),
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2020-04-16 15:26:03 +03:00
|
|
|
$this->getParams(),
|
|
|
|
$this->settingsNames,
|
|
|
|
$this->settings
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set template data
|
|
|
|
*/
|
|
|
|
protected function setTemplate()
|
|
|
|
{
|
2021-11-03 16:19:39 +07:00
|
|
|
$this->template = 'settings.tpl';
|
2020-04-16 15:26:03 +03:00
|
|
|
}
|
|
|
|
}
|