Initial commit

This commit is contained in:
2020-10-07 10:37:15 +02:00
commit ce5f440392
28157 changed files with 4429172 additions and 0 deletions

1349
modules/ps_currencyselector/composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>ps_currencyselector</name>
<displayName><![CDATA[Currency selector]]></displayName>
<version><![CDATA[2.0.1]]></version>
<description><![CDATA[Adds a block allowing customers to choose their preferred shopping currency.]]></description>
<author><![CDATA[PrestaShop]]></author>
<is_configurable>0</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>ps_currencyselector</name>
<displayName><![CDATA[Bloc devises]]></displayName>
<version><![CDATA[2.0.1]]></version>
<description><![CDATA[Ajoute un bloc permettant au client de choisir sa devise]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[]]></tab>
<is_configurable>0</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,130 @@
<?php
/*
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
use PrestaShop\PrestaShop\Adapter\ObjectPresenter;
use PrestaShop\PrestaShop\Core\Module\WidgetInterface;
if (!defined('_PS_VERSION_')) {
exit;
}
class Ps_Currencyselector extends Module implements WidgetInterface
{
private $templateFile;
public function __construct()
{
$this->name = 'ps_currencyselector';
$this->author = 'PrestaShop';
$this->version = '2.0.1';
$this->need_instance = 0;
parent::__construct();
$this->displayName = $this->trans('Currency block', [], 'Modules.Currencyselector.Admin');
$this->description = $this->trans('Adds a block allowing customers to choose their preferred shopping currency.', [], 'Modules.Currencyselector.Admin');
$this->ps_versions_compliancy = ['min' => '1.7.1.0', 'max' => _PS_VERSION_];
$this->templateFile = 'module:ps_currencyselector/ps_currencyselector.tpl';
}
public function install()
{
return parent::install()
&& $this->registerHook('actionAdminCurrenciesControllerSaveAfter');
}
public function hookActionAdminCurrenciesControllerSaveAfter($params)
{
return parent::_clearCache($this->templateFile);
}
public function getWidgetVariables($hookName, array $configuration)
{
$current_currency = null;
$serializer = new ObjectPresenter();
$currencies = array_map(
function ($currency) use ($serializer, &$current_currency) {
$currencyArray = $serializer->present($currency);
// serializer doesn't see 'sign' because it is not a regular
// ObjectModel field.
$currencyArray['sign'] = $currency->sign;
$url = $this->context->link->getLanguageLink($this->context->language->id);
$parsedUrl = parse_url($url);
$urlParams = [];
if (isset($parsedUrl['query'])) {
parse_str($parsedUrl['query'], $urlParams);
}
$newParams = array_merge(
$urlParams,
[
'SubmitCurrency' => 1,
'id_currency' => $currency->id,
]
);
$newUrl = sprintf('%s://%s%s%s?%s',
$parsedUrl['scheme'],
$parsedUrl['host'],
isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : '',
$parsedUrl['path'],
http_build_query($newParams)
);
$currencyArray['url'] = $newUrl;
if ($currency->id === $this->context->currency->id) {
$currencyArray['current'] = true;
$current_currency = $currencyArray;
} else {
$currencyArray['current'] = false;
}
return $currencyArray;
},
Currency::getCurrencies(true, true)
);
return [
'currencies' => $currencies,
'current_currency' => $current_currency,
];
}
public function renderWidget($hookName, array $configuration)
{
if (Configuration::isCatalogMode() || !Currency::isMultiCurrencyActivated()) {
return false;
}
$this->smarty->assign($this->getWidgetVariables($hookName, $configuration));
return $this->fetch($this->templateFile);
}
}

View File

@@ -0,0 +1,35 @@
{*
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div class="currency-selector">
<span>{$current_currency.iso_code} {$current_currency.sign}</span>
<ul>
{foreach from=$currencies item=currency}
<li {if $currency.current} class="current" {/if}>
<a rel="nofollow" href="{$currency.url}">{$currency.iso_code} {$currency.sign}</a>
</li>
{/foreach}
</ul>
</div>

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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;