|
@@ -11,7 +11,7 @@ discard block |
|
|
block discarded – undo |
|
11
|
11
|
exit; |
|
12
|
12
|
} |
|
13
|
13
|
|
|
14
|
|
-define('_PS_PAGANTIS_DIR', _PS_MODULE_DIR_. '/pagantis'); |
|
|
14
|
+define('_PS_PAGANTIS_DIR', _PS_MODULE_DIR_.'/pagantis'); |
|
15
|
15
|
define('PROMOTIONS_CATEGORY', 'pagantis-promotion-product'); |
|
16
|
16
|
define('PROMOTIONS_CATEGORY_NAME', 'Pagantis Promoted Product'); |
|
17
|
17
|
|
|
@@ -162,14 +162,14 @@ discard block |
|
|
block discarded – undo |
|
162
|
162
|
foreach ($products as $product) { |
|
163
|
163
|
$code = Tools::strtolower(Pagantis::getExtraConfig('CODE', $product)); |
|
164
|
164
|
if ($code === 'p4x') { |
|
165
|
|
- Configuration::updateValue($code . '_simulator_is_enabled', 1); |
|
|
165
|
+ Configuration::updateValue($code.'_simulator_is_enabled', 1); |
|
166
|
166
|
} |
|
167
|
|
- Configuration::updateValue($code . '_is_enabled', 0); |
|
168
|
|
- Configuration::updateValue($code . '_public_key', ''); |
|
169
|
|
- Configuration::updateValue($code . '_private_key', ''); |
|
|
167
|
+ Configuration::updateValue($code.'_is_enabled', 0); |
|
|
168
|
+ Configuration::updateValue($code.'_public_key', ''); |
|
|
169
|
+ Configuration::updateValue($code.'_private_key', ''); |
|
170
|
170
|
} |
|
171
|
171
|
|
|
172
|
|
- $return = (parent::install() |
|
|
172
|
+ $return = (parent::install() |
|
173
|
173
|
&& $this->registerHook('displayShoppingCart') |
|
174
|
174
|
&& $this->registerHook('paymentOptions') |
|
175
|
175
|
&& $this->registerHook('displayProductButtons') |
|
@@ -215,34 +215,34 @@ discard block |
|
|
block discarded – undo |
|
215
|
215
|
public function checkHooks() |
|
216
|
216
|
{ |
|
217
|
217
|
try { |
|
218
|
|
- $sql_content = 'select * from ' . _DB_PREFIX_. 'hook_module where |
|
219
|
|
- id_module = \'' . Module::getModuleIdByName($this->name) . '\' and |
|
220
|
|
- id_shop = \'' . Shop::getContextShopID() . '\' and |
|
221
|
|
- id_hook = \'' . Hook::getIdByName('header') . '\''; |
|
|
218
|
+ $sql_content = 'select * from '._DB_PREFIX_.'hook_module where |
|
|
219
|
+ id_module = \'' . Module::getModuleIdByName($this->name).'\' and |
|
|
220
|
+ id_shop = \'' . Shop::getContextShopID().'\' and |
|
|
221
|
+ id_hook = \'' . Hook::getIdByName('header').'\''; |
|
222
|
222
|
$hook_exists = Db::getInstance()->ExecuteS($sql_content); |
|
223
|
223
|
if (empty($hook_exists)) { |
|
224
|
|
- $sql_insert = 'insert into ' . _DB_PREFIX_. 'hook_module |
|
|
224
|
+ $sql_insert = 'insert into '._DB_PREFIX_.'hook_module |
|
225
|
225
|
(id_module, id_shop, id_hook, position) |
|
226
|
226
|
values |
|
227
|
|
- (\''. Module::getModuleIdByName($this->name) . '\', |
|
228
|
|
- \''. Shop::getContextShopID() . '\', |
|
229
|
|
- \''. Hook::getIdByName('header') . '\', |
|
|
227
|
+ (\''. Module::getModuleIdByName($this->name).'\', |
|
|
228
|
+ \''. Shop::getContextShopID().'\', |
|
|
229
|
+ \''. Hook::getIdByName('header').'\', |
|
230
|
230
|
150)'; |
|
231
|
231
|
Db::getInstance()->execute($sql_insert); |
|
232
|
232
|
} |
|
233
|
233
|
|
|
234
|
|
- $sql_content = 'select * from ' . _DB_PREFIX_. 'hook_module where |
|
235
|
|
- id_module = \'' . Module::getModuleIdByName($this->name) . '\' and |
|
236
|
|
- id_shop = \'' . Shop::getContextShopID() . '\' and |
|
237
|
|
- id_hook = \'' . Hook::getIdByName('displayProductPriceBlock') . '\''; |
|
|
234
|
+ $sql_content = 'select * from '._DB_PREFIX_.'hook_module where |
|
|
235
|
+ id_module = \'' . Module::getModuleIdByName($this->name).'\' and |
|
|
236
|
+ id_shop = \'' . Shop::getContextShopID().'\' and |
|
|
237
|
+ id_hook = \'' . Hook::getIdByName('displayProductPriceBlock').'\''; |
|
238
|
238
|
$hook_exists = Db::getInstance()->ExecuteS($sql_content); |
|
239
|
239
|
if (empty($hook_exists)) { |
|
240
|
|
- $sql_insert = 'insert into ' . _DB_PREFIX_. 'hook_module |
|
|
240
|
+ $sql_insert = 'insert into '._DB_PREFIX_.'hook_module |
|
241
|
241
|
(id_module, id_shop, id_hook, position) |
|
242
|
242
|
values |
|
243
|
|
- (\''. Module::getModuleIdByName($this->name) . '\', |
|
244
|
|
- \''. Shop::getContextShopID() . '\', |
|
245
|
|
- \''. Hook::getIdByName('displayProductPriceBlock') . '\', |
|
|
243
|
+ (\''. Module::getModuleIdByName($this->name).'\', |
|
|
244
|
+ \''. Shop::getContextShopID().'\', |
|
|
245
|
+ \''. Hook::getIdByName('displayProductPriceBlock').'\', |
|
246
|
246
|
160)'; |
|
247
|
247
|
Db::getInstance()->execute($sql_insert); |
|
248
|
248
|
} |
|
@@ -256,7 +256,7 @@ discard block |
|
|
block discarded – undo |
|
256
|
256
|
*/ |
|
257
|
257
|
public function checkEnvVariables() |
|
258
|
258
|
{ |
|
259
|
|
- $sql_content = 'select * from ' . _DB_PREFIX_. 'pagantis_config'; |
|
|
259
|
+ $sql_content = 'select * from '._DB_PREFIX_.'pagantis_config'; |
|
260
|
260
|
$dbConfigs = Db::getInstance()->executeS($sql_content); |
|
261
|
261
|
|
|
262
|
262
|
// Convert a multimple dimension array for SQL insert statements into a simple key/value |
|
@@ -285,10 +285,10 @@ discard block |
|
|
block discarded – undo |
|
285
|
285
|
{ |
|
286
|
286
|
try { |
|
287
|
287
|
$tableName = _DB_PREFIX_.'pagantis_order'; |
|
288
|
|
- $sql = "show tables like '" . $tableName . "'"; |
|
|
288
|
+ $sql = "show tables like '".$tableName."'"; |
|
289
|
289
|
$data = Db::getInstance()->ExecuteS($sql); |
|
290
|
290
|
if (count($data) > 0) { |
|
291
|
|
- $sql = "desc " . $tableName; |
|
|
291
|
+ $sql = "desc ".$tableName; |
|
292
|
292
|
$data = Db::getInstance()->ExecuteS($sql); |
|
293
|
293
|
if (count($data) == 2) { |
|
294
|
294
|
$sql = "ALTER TABLE $tableName ADD COLUMN ps_order_id VARCHAR(60) AFTER order_id"; |
|
@@ -296,10 +296,10 @@ discard block |
|
|
block discarded – undo |
|
296
|
296
|
} |
|
297
|
297
|
} |
|
298
|
298
|
$tableName = _DB_PREFIX_.'pagantis_config'; |
|
299
|
|
- $sql = "show tables like '" . $tableName . "'"; |
|
|
299
|
+ $sql = "show tables like '".$tableName."'"; |
|
300
|
300
|
$data = Db::getInstance()->ExecuteS($sql); |
|
301
|
301
|
if (count($data) > 0) { |
|
302
|
|
- $sql = "desc " . $tableName; |
|
|
302
|
+ $sql = "desc ".$tableName; |
|
303
|
303
|
$data = Db::getInstance()->ExecuteS($sql); |
|
304
|
304
|
if (count($data) === 3 && $data[2]['Type'] !== 'varchar(5000)') { |
|
305
|
305
|
$sql = "ALTER TABLE $tableName MODIFY `value` VARCHAR(5000)"; |
|
@@ -342,8 +342,8 @@ discard block |
|
|
block discarded – undo |
|
342
|
342
|
$availableCurrencies = array('EUR'); |
|
343
|
343
|
$pagantisDisplayMinAmount = $configs['DISPLAY_MIN_AMOUNT']; |
|
344
|
344
|
$pagantisDisplayMaxAmount = $configs['DISPLAY_MAX_AMOUNT']; |
|
345
|
|
- $pagantisPublicKey = Configuration::get(Tools::strtolower($configs['CODE']) . '_public_key'); |
|
346
|
|
- $pagantisPrivateKey = Configuration::get(Tools::strtolower($configs['CODE']) . '_private_key'); |
|
|
345
|
+ $pagantisPublicKey = Configuration::get(Tools::strtolower($configs['CODE']).'_public_key'); |
|
|
346
|
+ $pagantisPrivateKey = Configuration::get(Tools::strtolower($configs['CODE']).'_private_key'); |
|
347
|
347
|
$this->allowedCountries = unserialize(Pagantis::getExtraConfig('ALLOWED_COUNTRIES', null)); |
|
348
|
348
|
$this->getUserLanguage(); |
|
349
|
349
|
return ( |
|
@@ -422,42 +422,42 @@ discard block |
|
|
block discarded – undo |
|
422
|
422
|
if ($this->isPaymentMethodAvailable($product)) { |
|
423
|
423
|
$productConfigs = Pagantis::getExtraConfig($product, null); |
|
424
|
424
|
$productConfigs = json_decode($productConfigs, true); |
|
425
|
|
- $publicKey = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_public_key'); |
|
426
|
|
- $simulatorIsEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_simulator_is_enabled'); |
|
427
|
|
- $isEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_is_enabled'); |
|
|
425
|
+ $publicKey = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_public_key'); |
|
|
426
|
+ $simulatorIsEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_simulator_is_enabled'); |
|
|
427
|
+ $isEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_is_enabled'); |
|
428
|
428
|
|
|
429
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_TITLE'] = $this->l($productConfigs['TITLE']); |
|
|
429
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_TITLE'] = $this->l($productConfigs['TITLE']); |
|
430
|
430
|
unset($productConfigs['TITLE']); |
|
431
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_AMOUNT'] = $orderTotal; |
|
432
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PROMOTED_AMOUNT'] = $promotedAmount; |
|
433
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_LOCALE'] = $this->language; |
|
434
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_COUNTRY'] = $this->language; |
|
435
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PUBLIC_KEY'] = $publicKey; |
|
436
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_SIMULATOR_IS_ENABLED'] = $simulatorIsEnabled; |
|
437
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_IS_ENABLED'] = $isEnabled; |
|
438
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_LOGO'] = 'https://cdn.digitalorigin.com/assets/master/logos/pg-favicon.png'; |
|
439
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PAYMENT_URL'] = $link->getModuleLink('pagantis', 'payment') . '&product=' . $productConfigs['CODE']; |
|
440
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PS_VERSION'] = str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3)); |
|
|
431
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_AMOUNT'] = $orderTotal; |
|
|
432
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PROMOTED_AMOUNT'] = $promotedAmount; |
|
|
433
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_LOCALE'] = $this->language; |
|
|
434
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_COUNTRY'] = $this->language; |
|
|
435
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PUBLIC_KEY'] = $publicKey; |
|
|
436
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_SIMULATOR_IS_ENABLED'] = $simulatorIsEnabled; |
|
|
437
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_IS_ENABLED'] = $isEnabled; |
|
|
438
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_LOGO'] = 'https://cdn.digitalorigin.com/assets/master/logos/pg-favicon.png'; |
|
|
439
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PAYMENT_URL'] = $link->getModuleLink('pagantis', 'payment').'&product='.$productConfigs['CODE']; |
|
|
440
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PS_VERSION'] = str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3)); |
|
441
|
441
|
|
|
442
|
442
|
foreach ($productConfigs as $productConfigKey => $productConfigValue) { |
|
443
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . "_" . $productConfigKey] = $productConfigValue; |
|
|
443
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE']))."_".$productConfigKey] = $productConfigValue; |
|
444
|
444
|
} |
|
445
|
445
|
$this->context->smarty->assign($templateConfigs); |
|
446
|
446
|
|
|
447
|
447
|
$paymentOption = new PrestaShop\PrestaShop\Core\Payment\PaymentOption(); |
|
448
|
448
|
$uri = $link->getModuleLink('pagantis', 'payment'); |
|
449
|
449
|
if (strpos($uri, '?') !== false) { |
|
450
|
|
- $uri .= '&product=' . $productConfigs['CODE']; |
|
|
450
|
+ $uri .= '&product='.$productConfigs['CODE']; |
|
451
|
451
|
} else { |
|
452
|
|
- $uri .= '?product=' . $productConfigs['CODE']; |
|
|
452
|
+ $uri .= '?product='.$productConfigs['CODE']; |
|
453
|
453
|
} |
|
454
|
454
|
$paymentOption |
|
455
|
|
- ->setCallToActionText($templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_TITLE']) |
|
|
455
|
+ ->setCallToActionText($templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_TITLE']) |
|
456
|
456
|
->setAction($uri) |
|
457
|
|
- ->setLogo($templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_LOGO']) |
|
|
457
|
+ ->setLogo($templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_LOGO']) |
|
458
|
458
|
->setModuleName(__CLASS__) |
|
459
|
459
|
->setAdditionalInformation( |
|
460
|
|
- $this->fetch('module:pagantis/views/templates/hook/checkout-' . Tools::strtolower($productConfigs['CODE']) . '.tpl') |
|
|
460
|
+ $this->fetch('module:pagantis/views/templates/hook/checkout-'.Tools::strtolower($productConfigs['CODE']).'.tpl') |
|
461
|
461
|
) |
|
462
|
462
|
; |
|
463
|
463
|
$return[] = $paymentOption; |
|
@@ -481,61 +481,61 @@ discard block |
|
|
block discarded – undo |
|
481
|
481
|
foreach ($products as $product) { |
|
482
|
482
|
$code = Tools::strtolower(Pagantis::getExtraConfig('CODE', $product)); |
|
483
|
483
|
$inputs[] = array( |
|
484
|
|
- 'name' => $code .'_is_enabled', |
|
485
|
|
- 'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch', |
|
486
|
|
- 'label' => $this->l('Module is enabled ' . $code), |
|
|
484
|
+ 'name' => $code.'_is_enabled', |
|
|
485
|
+ 'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch', |
|
|
486
|
+ 'label' => $this->l('Module is enabled '.$code), |
|
487
|
487
|
'prefix' => '<i class="icon icon-key"></i>', |
|
488
|
488
|
'class' => 't', |
|
489
|
489
|
'required' => true, |
|
490
|
490
|
'values'=> array( |
|
491
|
491
|
array( |
|
492
|
|
- 'id' => $code .'_is_enabled_true', |
|
|
492
|
+ 'id' => $code.'_is_enabled_true', |
|
493
|
493
|
'value' => 1, |
|
494
|
494
|
'label' => $this->l('Yes', get_class($this), null, false), |
|
495
|
495
|
), |
|
496
|
496
|
array( |
|
497
|
|
- 'id' => $code . '_is_enabled_false', |
|
|
497
|
+ 'id' => $code.'_is_enabled_false', |
|
498
|
498
|
'value' => 0, |
|
499
|
499
|
'label' => $this->l('No', get_class($this), null, false), |
|
500
|
500
|
), |
|
501
|
501
|
) |
|
502
|
502
|
); |
|
503
|
503
|
$inputs[] = array( |
|
504
|
|
- 'name' => $code . '_public_key', |
|
|
504
|
+ 'name' => $code.'_public_key', |
|
505
|
505
|
'suffix' => $this->l('ex: pk_fd53cd467ba49022e4gf215e'), |
|
506
|
506
|
'type' => 'text', |
|
507
|
507
|
'size' => 60, |
|
508
|
|
- 'label' => $this->l('Public Key ' . $code), |
|
|
508
|
+ 'label' => $this->l('Public Key '.$code), |
|
509
|
509
|
'prefix' => '<i class="icon icon-key"></i>', |
|
510
|
510
|
'col' => 6, |
|
511
|
511
|
'required' => true, |
|
512
|
512
|
); |
|
513
|
513
|
$inputs[] = array( |
|
514
|
|
- 'name' => $code . '_private_key', |
|
|
514
|
+ 'name' => $code.'_private_key', |
|
515
|
515
|
'suffix' => $this->l('ex: 21e5723a97459f6a'), |
|
516
|
516
|
'type' => 'text', |
|
517
|
517
|
'size' => 60, |
|
518
|
|
- 'label' => $this->l('Private Key ' . $code), |
|
|
518
|
+ 'label' => $this->l('Private Key '.$code), |
|
519
|
519
|
'prefix' => '<i class="icon icon-key"></i>', |
|
520
|
520
|
'col' => 6, |
|
521
|
521
|
'required' => true, |
|
522
|
522
|
); |
|
523
|
523
|
if ($code !== "p4x") { |
|
524
|
524
|
$inputs[] = array( |
|
525
|
|
- 'name' => $code . '_simulator_is_enabled', |
|
526
|
|
- 'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch', |
|
527
|
|
- 'label' => $this->l('Simulator is enabled ' . $code), |
|
|
525
|
+ 'name' => $code.'_simulator_is_enabled', |
|
|
526
|
+ 'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch', |
|
|
527
|
+ 'label' => $this->l('Simulator is enabled '.$code), |
|
528
|
528
|
'prefix' => '<i class="icon icon-key"></i>', |
|
529
|
529
|
'class' => 't', |
|
530
|
530
|
'required' => true, |
|
531
|
531
|
'values'=> array( |
|
532
|
532
|
array( |
|
533
|
|
- 'id' => $code . '_simulator_is_enabled_on', |
|
|
533
|
+ 'id' => $code.'_simulator_is_enabled_on', |
|
534
|
534
|
'value' => 1, |
|
535
|
535
|
'label' => $this->l('Yes'), |
|
536
|
536
|
), |
|
537
|
537
|
array( |
|
538
|
|
- 'id' => $code . '_simulator_is_enabled_off', |
|
|
538
|
+ 'id' => $code.'_simulator_is_enabled_off', |
|
539
|
539
|
'value' => 0, |
|
540
|
540
|
'label' => $this->l('No'), |
|
541
|
541
|
), |
|
@@ -603,17 +603,17 @@ discard block |
|
|
block discarded – undo |
|
603
|
603
|
$products = explode(',', Pagantis::getExtraConfig('PRODUCTS', null)); |
|
604
|
604
|
foreach ($products as $product) { |
|
605
|
605
|
$code = Tools::strtolower(Pagantis::getExtraConfig('CODE', $product)); |
|
606
|
|
- $settings[$code . '_public_key'] = Configuration::get($code . '_public_key'); |
|
607
|
|
- $settings[$code . '_private_key'] = Configuration::get($code . '_private_key'); |
|
608
|
|
- $settings[$code . '_is_enabled'] = Configuration::get($code . '_is_enabled'); |
|
|
606
|
+ $settings[$code.'_public_key'] = Configuration::get($code.'_public_key'); |
|
|
607
|
+ $settings[$code.'_private_key'] = Configuration::get($code.'_private_key'); |
|
|
608
|
+ $settings[$code.'_is_enabled'] = Configuration::get($code.'_is_enabled'); |
|
609
|
609
|
if ($code !== 'p4x') { |
|
610
|
|
- $settings[$code . '_simulator_is_enabled'] = Configuration::get($code . '_simulator_is_enabled'); |
|
|
610
|
+ $settings[$code.'_simulator_is_enabled'] = Configuration::get($code.'_simulator_is_enabled'); |
|
611
|
611
|
} |
|
612
|
|
- $settingsKeys[] = $code . '_is_enabled'; |
|
613
|
|
- $settingsKeys[] = $code . '_public_key'; |
|
614
|
|
- $settingsKeys[] = $code . '_private_key'; |
|
|
612
|
+ $settingsKeys[] = $code.'_is_enabled'; |
|
|
613
|
+ $settingsKeys[] = $code.'_public_key'; |
|
|
614
|
+ $settingsKeys[] = $code.'_private_key'; |
|
615
|
615
|
if ($code !== 'p4x') { |
|
616
|
|
- $settingsKeys[] = $code . '_simulator_is_enabled'; |
|
|
616
|
+ $settingsKeys[] = $code.'_simulator_is_enabled'; |
|
617
|
617
|
} |
|
618
|
618
|
} |
|
619
|
619
|
|
|
@@ -684,43 +684,43 @@ discard block |
|
|
block discarded – undo |
|
684
|
684
|
if ($this->isPaymentMethodAvailable($product)) { |
|
685
|
685
|
$productConfigs = Pagantis::getExtraConfig($product, null); |
|
686
|
686
|
$productConfigs = json_decode($productConfigs, true); |
|
687
|
|
- $publicKey = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_public_key'); |
|
688
|
|
- $simulatorIsEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_simulator_is_enabled'); |
|
689
|
|
- $isEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_is_enabled'); |
|
|
687
|
+ $publicKey = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_public_key'); |
|
|
688
|
+ $simulatorIsEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_simulator_is_enabled'); |
|
|
689
|
+ $isEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_is_enabled'); |
|
690
|
690
|
|
|
691
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_TITLE'] = $this->l($productConfigs['TITLE']); |
|
|
691
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_TITLE'] = $this->l($productConfigs['TITLE']); |
|
692
|
692
|
unset($productConfigs['TITLE']); |
|
693
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_AMOUNT'] = $orderTotal; |
|
694
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PROMOTED_AMOUNT'] = $promotedAmount; |
|
695
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_LOCALE'] = $this->language; |
|
696
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_COUNTRY'] = $this->language; |
|
697
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PUBLIC_KEY'] = $publicKey; |
|
698
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_SIMULATOR_IS_ENABLED'] = $simulatorIsEnabled; |
|
699
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_IS_ENABLED'] = $isEnabled; |
|
700
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_LOGO'] = 'https://cdn.digitalorigin.com/assets/master/logos/pg-favicon.png'; |
|
|
693
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_AMOUNT'] = $orderTotal; |
|
|
694
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PROMOTED_AMOUNT'] = $promotedAmount; |
|
|
695
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_LOCALE'] = $this->language; |
|
|
696
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_COUNTRY'] = $this->language; |
|
|
697
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PUBLIC_KEY'] = $publicKey; |
|
|
698
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_SIMULATOR_IS_ENABLED'] = $simulatorIsEnabled; |
|
|
699
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_IS_ENABLED'] = $isEnabled; |
|
|
700
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_LOGO'] = 'https://cdn.digitalorigin.com/assets/master/logos/pg-favicon.png'; |
|
701
|
701
|
$uri = $link->getModuleLink('pagantis', 'payment'); |
|
702
|
702
|
if (strpos($uri, '?') !== false) { |
|
703
|
|
- $uri .= '&product=' . $productConfigs['CODE']; |
|
|
703
|
+ $uri .= '&product='.$productConfigs['CODE']; |
|
704
|
704
|
} else { |
|
705
|
|
- $uri .= '?product=' . $productConfigs['CODE']; |
|
|
705
|
+ $uri .= '?product='.$productConfigs['CODE']; |
|
706
|
706
|
} |
|
707
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PAYMENT_URL'] = $uri; |
|
708
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PS_VERSION'] = str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3)); |
|
|
707
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PAYMENT_URL'] = $uri; |
|
|
708
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PS_VERSION'] = str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3)); |
|
709
|
709
|
|
|
710
|
710
|
foreach ($productConfigs as $productConfigKey => $productConfigValue) { |
|
711
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . "_" . $productConfigKey] = $productConfigValue; |
|
|
711
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE']))."_".$productConfigKey] = $productConfigValue; |
|
712
|
712
|
} |
|
713
|
713
|
$this->context->smarty->assign($templateConfigs); |
|
714
|
714
|
if ($supercheckout_enabled || $onepagecheckout_enabled || $onepagecheckoutps_enabled) { |
|
715
|
715
|
$this->checkLogoExists(); |
|
716
|
716
|
$return .= $this->display( |
|
717
|
717
|
__FILE__, |
|
718
|
|
- 'views/templates/hook/onepagecheckout-' . Tools::strtolower($productConfigs['CODE']) . '.tpl' |
|
|
718
|
+ 'views/templates/hook/onepagecheckout-'.Tools::strtolower($productConfigs['CODE']).'.tpl' |
|
719
|
719
|
); |
|
720
|
720
|
} elseif (_PS_VERSION_ < 1.7) { |
|
721
|
721
|
$return .= $this->display( |
|
722
|
722
|
__FILE__, |
|
723
|
|
- 'views/templates/hook/checkout-' . Tools::strtolower($productConfigs['CODE']) . '.tpl' |
|
|
723
|
+ 'views/templates/hook/checkout-'.Tools::strtolower($productConfigs['CODE']).'.tpl' |
|
724
|
724
|
); |
|
725
|
725
|
} |
|
726
|
726
|
} |
|
@@ -753,12 +753,12 @@ discard block |
|
|
block discarded – undo |
|
753
|
753
|
$productConfigs = Pagantis::getExtraConfig($product, null); |
|
754
|
754
|
$productConfigs = json_decode($productConfigs, true); |
|
755
|
755
|
|
|
756
|
|
- $publicKey = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_public_key'); |
|
757
|
|
- $simulatorIsEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_simulator_is_enabled'); |
|
|
756
|
+ $publicKey = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_public_key'); |
|
|
757
|
+ $simulatorIsEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_simulator_is_enabled'); |
|
758
|
758
|
if (Tools::strtolower($productConfigs['CODE']) === 'p4x') { |
|
759
|
759
|
$simulatorIsEnabled = true; |
|
760
|
760
|
} |
|
761
|
|
- $isEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_is_enabled'); |
|
|
761
|
+ $isEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_is_enabled'); |
|
762
|
762
|
$availableSimulators = array( |
|
763
|
763
|
'hookDisplayProductButtons' => array( |
|
764
|
764
|
'sdk.simulator.types.SIMPLE', |
|
@@ -781,30 +781,30 @@ discard block |
|
|
block discarded – undo |
|
781
|
781
|
in_array(Tools::strtolower($this->language), $allowedCountries) && |
|
782
|
782
|
(in_array($productConfigs['SIMULATOR_DISPLAY_TYPE'], $availableSimulators[$hookName]) || _PS_VERSION_ < 1.6) |
|
783
|
783
|
) { |
|
784
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_TITLE'] = $this->l($productConfigs['TITLE']); |
|
785
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_SIMULATOR_TITLE'] = $this->l($productConfigs['SIMULATOR_TITLE']); |
|
786
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_SIMULATOR_SUBTITLE'] = $this->l($productConfigs['SIMULATOR_SUBTITLE']); |
|
|
784
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_TITLE'] = $this->l($productConfigs['TITLE']); |
|
|
785
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_SIMULATOR_TITLE'] = $this->l($productConfigs['SIMULATOR_TITLE']); |
|
|
786
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_SIMULATOR_SUBTITLE'] = $this->l($productConfigs['SIMULATOR_SUBTITLE']); |
|
787
|
787
|
unset($productConfigs['TITLE']); |
|
788
|
788
|
unset($productConfigs['SIMULATOR_TITLE']); |
|
789
|
789
|
unset($productConfigs['SIMULATOR_SUBTITLE']); |
|
790
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_AMOUNT'] = $amount; |
|
791
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_AMOUNT4X'] = number_format(($amount / 4), 2, '.', ''); |
|
792
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_IS_PROMOTED_PRODUCT'] = $isPromotedProduct; |
|
793
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_LOCALE'] = $this->language; |
|
794
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_COUNTRY'] = $this->language; |
|
795
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PUBLIC_KEY'] = $publicKey; |
|
796
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_SIMULATOR_IS_ENABLED'] = $simulatorIsEnabled; |
|
797
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_IS_ENABLED'] = $isEnabled; |
|
798
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_LOGO'] = 'https://cdn.digitalorigin.com/assets/master/logos/pg-favicon.png'; |
|
799
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PS_VERSION'] = str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3)); |
|
|
790
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_AMOUNT'] = $amount; |
|
|
791
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_AMOUNT4X'] = number_format(($amount / 4), 2, '.', ''); |
|
|
792
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_IS_PROMOTED_PRODUCT'] = $isPromotedProduct; |
|
|
793
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_LOCALE'] = $this->language; |
|
|
794
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_COUNTRY'] = $this->language; |
|
|
795
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PUBLIC_KEY'] = $publicKey; |
|
|
796
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_SIMULATOR_IS_ENABLED'] = $simulatorIsEnabled; |
|
|
797
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_IS_ENABLED'] = $isEnabled; |
|
|
798
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_LOGO'] = 'https://cdn.digitalorigin.com/assets/master/logos/pg-favicon.png'; |
|
|
799
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PS_VERSION'] = str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3)); |
|
800
|
800
|
foreach ($productConfigs as $productConfigKey => $productConfigValue) { |
|
801
|
|
- $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . "_" . $productConfigKey] = $productConfigValue; |
|
|
801
|
+ $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE']))."_".$productConfigKey] = $productConfigValue; |
|
802
|
802
|
} |
|
803
|
803
|
|
|
804
|
804
|
$this->context->smarty->assign($templateConfigs); |
|
805
|
805
|
$return .= $this->display( |
|
806
|
806
|
__FILE__, |
|
807
|
|
- 'views/templates/hook/product-simulator-' . Tools::strtolower($productConfigs['CODE']) . '.tpl' |
|
|
807
|
+ 'views/templates/hook/product-simulator-'.Tools::strtolower($productConfigs['CODE']).'.tpl' |
|
808
|
808
|
); |
|
809
|
809
|
} |
|
810
|
810
|
} |
|
@@ -833,7 +833,7 @@ discard block |
|
|
block discarded – undo |
|
833
|
833
|
// $params['type'] = weight | price | after_price |
|
834
|
834
|
if (isset($params['type']) && $params['type'] === 'price' && |
|
835
|
835
|
isset($params['smarty']) && isset($params['smarty']->template_resource) && |
|
836
|
|
- (strpos($params['smarty']->template_resource, 'product.tpl') !== false || |
|
|
836
|
+ (strpos($params['smarty']->template_resource, 'product.tpl') !== false || |
|
837
|
837
|
strpos($params['smarty']->template_resource, 'product-prices.tpl') !== false) |
|
838
|
838
|
) { |
|
839
|
839
|
return $this->productPageSimulatorDisplay("hookDisplayProductPriceBlock"); |
|
@@ -866,16 +866,16 @@ discard block |
|
|
block discarded – undo |
|
866
|
866
|
if (!in_array(PROMOTIONS_CATEGORY_NAME, $categories)) { |
|
867
|
867
|
/** @var CategoryCore $category */ |
|
868
|
868
|
$category = new Category(); |
|
869
|
|
- $categoryArray = array((int)Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY ); |
|
|
869
|
+ $categoryArray = array((int) Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY); |
|
870
|
870
|
$category->is_root_category = false; |
|
871
|
871
|
$category->link_rewrite = $categoryArray; |
|
872
|
872
|
$category->meta_description = $categoryArray; |
|
873
|
873
|
$category->meta_keywords = $categoryArray; |
|
874
|
874
|
$category->meta_title = $categoryArray; |
|
875
|
|
- $category->name = array((int)Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY_NAME); |
|
|
875
|
+ $category->name = array((int) Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY_NAME); |
|
876
|
876
|
$category->id_parent = Configuration::get('PS_HOME_CATEGORY'); |
|
877
|
|
- $category->active=0; |
|
878
|
|
- $description = 'Pagantis: Products with this category have free financing assumed by the merchant. ' . |
|
|
877
|
+ $category->active = 0; |
|
|
878
|
+ $description = 'Pagantis: Products with this category have free financing assumed by the merchant. '. |
|
879
|
879
|
'Use it to promote your products or brands.'; |
|
880
|
880
|
$category->description = $this->l($description); |
|
881
|
881
|
$category->save(); |
|
@@ -895,7 +895,7 @@ discard block |
|
|
block discarded – undo |
|
895
|
895
|
} |
|
896
|
896
|
|
|
897
|
897
|
if (is_null($product)) { |
|
898
|
|
- $sql = 'SELECT value FROM '._DB_PREFIX_.'pagantis_config where config = \'' . pSQL($config) . '\' limit 1'; |
|
|
898
|
+ $sql = 'SELECT value FROM '._DB_PREFIX_.'pagantis_config where config = \''.pSQL($config).'\' limit 1'; |
|
899
|
899
|
if ($results = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql)) { |
|
900
|
900
|
if (is_array($results) && count($results) === 1 && isset($results[0]['value'])) { |
|
901
|
901
|
return $results[0]['value']; |
|
@@ -903,7 +903,7 @@ discard block |
|
|
block discarded – undo |
|
903
|
903
|
} |
|
904
|
904
|
} |
|
905
|
905
|
|
|
906
|
|
- $sql = 'SELECT value FROM '._DB_PREFIX_.'pagantis_config where config = \'' . pSQL($product) . '\' limit 1'; |
|
|
906
|
+ $sql = 'SELECT value FROM '._DB_PREFIX_.'pagantis_config where config = \''.pSQL($product).'\' limit 1'; |
|
907
|
907
|
if ($results = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql)) { |
|
908
|
908
|
if (is_array($results) && count($results) === 1 && isset($results[0]['value'])) { |
|
909
|
909
|
$configs = json_decode($results[0]['value'], true); |
|
@@ -923,10 +923,10 @@ discard block |
|
|
block discarded – undo |
|
923
|
923
|
*/ |
|
924
|
924
|
public function checkLogoExists() |
|
925
|
925
|
{ |
|
926
|
|
- $logoPg = _PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments/pagantis.png'; |
|
927
|
|
- if (!file_exists($logoPg) && is_dir(_PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments')) { |
|
|
926
|
+ $logoPg = _PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments/pagantis.png'; |
|
|
927
|
+ if (!file_exists($logoPg) && is_dir(_PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments')) { |
|
928
|
928
|
copy( |
|
929
|
|
- _PS_PAGANTIS_DIR . '/logo.png', |
|
|
929
|
+ _PS_PAGANTIS_DIR.'/logo.png', |
|
930
|
930
|
$logoPg |
|
931
|
931
|
); |
|
932
|
932
|
} |
|
@@ -942,7 +942,7 @@ discard block |
|
|
block discarded – undo |
|
942
|
942
|
if (count($langArray) != 2 && isset($lang['locale'])) { |
|
943
|
943
|
$langArray = explode("-", $lang['locale']); |
|
944
|
944
|
} |
|
945
|
|
- $this->language = Tools::strtoupper($langArray[count($langArray)-1]); |
|
|
945
|
+ $this->language = Tools::strtoupper($langArray[count($langArray) - 1]); |
|
946
|
946
|
// Prevent null language detection |
|
947
|
947
|
if (in_array(Tools::strtolower($this->language), $this->allowedCountries)) { |
|
948
|
948
|
return; |