Subida del módulo y tema de PrestaShop

This commit is contained in:
Kaloyan
2026-04-09 18:31:51 +02:00
parent 12c253296f
commit 16b3ff9424
39262 changed files with 7418797 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,83 @@
<?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 Academic Free License version 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/AFL-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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
use PrestaShop\Module\Psshipping\Domain\Carriers\CarrierRepository;
use PrestaShop\Module\Psshipping\Domain\Carriers\CarrierService;
use PrestaShop\Module\Psshipping\Domain\Carriers\MbePickupCarrierConfiguration;
use PrestaShop\Module\Psshipping\Service\DatabaseInstaller;
/**
* @param Psshipping $module
*
* @return bool
*/
function upgrade_module_2_0_0($module)
{
$hookList = [
'actionValidateOrder',
'displayHeader',
'displayCarrierExtraContent',
'displayOrderConfirmation',
'actionGetOrderShipments',
];
$module->registerHook($hookList);
/** @var CarrierRepository $carrierRepository */
$carrierRepository = new CarrierRepository($module);
/** @var CarrierService $carrierService */
$carrierService = new CarrierService($module, $carrierRepository);
$shippingCarriers = Db::getInstance()->executeS('SELECT id_carrier, deleted, external_module_name FROM `' . _DB_PREFIX_ . 'carrier` WHERE `external_module_name` IN ("psshipping_standard", "psshipping_express")');
if (!empty($shippingCarriers)) {
if (is_array($shippingCarriers)) {
foreach ($shippingCarriers as $shippingCarrier) {
if (filter_var($shippingCarrier['deleted'], FILTER_VALIDATE_BOOLEAN) === true) {
continue;
}
if ($shippingCarrier['external_module_name'] === 'psshipping_standard') {
$carrierRepository->addShippingCarrierMapping((int) $shippingCarrier['id_carrier'], CarrierService::CARRIERS_STANDARD, CarrierService::PROVIDER_MBE);
}
if ($shippingCarrier['external_module_name'] === 'psshipping_express') {
$carrierRepository->addShippingCarrierMapping((int) $shippingCarrier['id_carrier'], CarrierService::CARRIERS_EXPRESS, CarrierService::PROVIDER_MBE);
}
}
}
}
// require_once is necessary because the previous autoloader is loaded in memory
require_once __DIR__ . '/../src/Domain/Carriers/CarrierConfigurationInterface.php';
require_once __DIR__ . '/../src/Domain/Carriers/CarrierConfiguration.php';
require_once __DIR__ . '/../src/Domain/Carriers/MbePickupCarrierConfiguration.php';
require_once __DIR__ . '/../src/Service/DatabaseInstaller.php';
$result = Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'carrier` SET `external_module_name`= "psshipping", `is_module` = 1, `need_range` = 1 WHERE `external_module_name` IN ("psshipping_standard", "psshipping_express")')
&& (new DatabaseInstaller($module))->install();
$mbe_tracking_url = $module->getMbeTrackingUrl();
$carrierService->create(new MbePickupCarrierConfiguration($mbe_tracking_url))->jsonSerialize();
return $result;
}

View File

@@ -0,0 +1,78 @@
<?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 Academic Free License version 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/AFL-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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
use PrestaShop\Module\Psshipping\Domain\Carriers\CarrierRepository;
use PrestaShop\Module\Psshipping\Domain\Carriers\CarrierService;
/**
* @param Psshipping $module
*
* @return bool
*/
function upgrade_module_3_0_0($module)
{
/** @var CarrierRepository $carrierRepository */
$carrierRepository = new CarrierRepository($module);
/** @var CarrierService $carrierService */
$carrierService = new CarrierService($module, $carrierRepository);
$newMapping = [];
$mapping = $carrierRepository->getShippingCarriersMapping();
foreach ($mapping as $idCarrier => $type) {
$newMapping[$idCarrier] = [
'type' => $type,
'provider' => CarrierService::PROVIDER_MBE,
];
}
//@phpstan-ignore-next-line
$carrierRepository->updateShippingCarrierMapping($newMapping);
require_once __DIR__ . '/../src/Domain/Carriers/CarrierConfigurationInterface.php';
require_once __DIR__ . '/../src/Domain/Carriers/CarrierConfiguration.php';
$result = Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'carrier` SET `name`= "MBE Standard delivery" WHERE `name` = "Standard delivery"') &&
Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'carrier` SET `name`= "MBE Express delivery" WHERE `name` = "Express delivery"') &&
Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'carrier` SET `name`= "MBE Pick-up point" WHERE `name` = "Delivery point"');
$previousQueryError = Db::getInstance()->getMsgError();
$previousQueryErrorCode = Db::getInstance()->getNumberError();
if (!empty($previousQueryError) || !empty($previousQueryErrorCode)) {
throw new Exception('An error occured while upgrading the module');
}
$carriersId = Db::getInstance()->executeS('SELECT id_carrier FROM `' . _DB_PREFIX_ . 'carrier` WHERE name LIKE "MBE%" AND deleted = 0 AND external_module_name = "psshipping"');
if (!empty($carriersId)) {
if (is_array($carriersId)) {
foreach ($carriersId as $carrierId) {
$carrierService->setLogoToCarrier($carrierId['id_carrier'], 'mbe');
}
}
}
return $result;
}