This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfig.php
64 lines (54 loc) · 1.92 KB
/
config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the Software License Agreement.
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* You must not modify, adapt or create derivative works of this source code
*
* @author Doofinder
* @copyright Doofinder
* @license GPLv3
*/
require_once(dirname(__FILE__) . '/../../config/config.inc.php');
require_once(dirname(__FILE__) . '/../../init.php');
$context = Context::getContext();
header("Content-Type:application/json; charset=utf-8");
$module = Module::getInstanceByName('doofinder');
$languages = array();
$configurations = array();
$currencies = array_keys(dfTools::getAvailableCurrencies());
$display_prices = (bool) Configuration::get('DF_GS_DISPLAY_PRICES');
$prices_with_taxes = (bool) Configuration::get('DF_GS_PRICES_USE_TAX');
foreach (Language::getLanguages(true, $context->shop->id) as $lang) {
$lang = Tools::strtoupper($lang['iso_code']);
$currency = dfTools::getCurrencyForLanguage($lang);
$languages[] = $lang;
$configurations[$lang] = array(
"language" => $lang,
"currency" => Tools::strtoupper($currency->iso_code),
"prices" => $display_prices,
"taxes" => $prices_with_taxes,
);
}
$force_ssl = (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE'));
$shop = $context->shop;
$base = (($force_ssl) ? 'https://' . $shop->domain_ssl : 'http://' . $shop->domain);
$cfg = array(
"platform" => array(
"name" => "Prestashop",
"version" => _PS_VERSION_
),
"module" => array(
"version" => Doofinder::VERSION,
"feed" => $base . $shop->getBaseURI() . 'modules/doofinder/feed.php',
"options" => array(
"language" => $languages,
"currency" => $currencies,
),
"configuration" => $configurations,
),
);
echo dfTools::json_encode($cfg);