Passed
Pull Request — master (#37)
by
unknown
03:38
created
test/basic/BasicTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         $this->webDriver->get(self::OSCURL);
31 31
         $condition = WebDriverExpectedCondition::titleContains(self::TITLE);
32 32
         $this->webDriver->wait()->until($condition);
33
-        $this->assertTrue((bool) $condition);
33
+        $this->assertTrue((bool)$condition);
34 34
         $this->quit();
35 35
     }
36 36
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         $this->webDriver->get(self::OSCURL_BACKOFFICE);
43 43
         $condition = WebDriverExpectedCondition::titleContains(self::ADMIN_TITLE);
44 44
         $this->webDriver->wait()->until($condition);
45
-        $this->assertTrue((bool) $condition);
45
+        $this->assertTrue((bool)$condition);
46 46
         $this->quit();
47 47
     }
48 48
 }
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
catalog/includes/modules/payment/pagantis.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 
76 76
         if (strpos($_SERVER[REQUEST_URI], "checkout_payment.php") <= 0) {
77 77
             $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_ADMIN_TITLE; // Payment module title in Admin
78
-        } else {
79
-            $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_CHECKOUT .'<br/><br/><div class="buttonSet" style="display:none"></div><br/>'; // Payment module title in Catalog
78
+        }else {
79
+            $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_CHECKOUT.'<br/><br/><div class="buttonSet" style="display:none"></div><br/>'; // Payment module title in Catalog
80 80
         }
81 81
 
82 82
         if (defined('MODULE_PAYMENT_PAGANTIS_LANG_CODE')) {
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
                 "%s://%s%s%s",
93 93
                 isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http',
94 94
                 $_SERVER['SERVER_NAME'],
95
-                isset($_SERVER['SERVER_PORT']) ? ":" . $_SERVER['SERVER_PORT'] : '',
95
+                isset($_SERVER['SERVER_PORT']) ? ":".$_SERVER['SERVER_PORT'] : '',
96 96
                 $_SERVER['REQUEST_URI']
97 97
             )
98 98
         );
99 99
 
100
-        $this->form_action_url = $this->base_url . '/ext/modules/payment/pagantis/bypass.php';
100
+        $this->form_action_url = $this->base_url.'/ext/modules/payment/pagantis/bypass.php';
101 101
 
102 102
         if (defined('MODULE_PAYMENT_PAGANTIS_ERROR_MESSAGE')) {
103 103
             $this->errorMessage = strtoupper(MODULE_PAYMENT_PAGANTIS_ERROR_MESSAGE);
@@ -211,12 +211,12 @@  discard block
 block discarded – undo
211 211
             $national_id = $this->getNationalId();
212 212
             $tax_id = $this->getTaxId();
213 213
 
214
-            $fullName = $order->billing['firstname'] . ' ' . $order->billing['lastname'];
214
+            $fullName = $order->billing['firstname'].' '.$order->billing['lastname'];
215 215
             if ($fullName == ' ') {
216
-                $fullName = $order->customer['firstname'] . ' ' . $order->customer['lastname'];
216
+                $fullName = $order->customer['firstname'].' '.$order->customer['lastname'];
217 217
             }
218 218
             if ($fullName == ' ') {
219
-                $fullName = $order->delivery['firstname'] . ' ' . $order->delivery['lastname'];
219
+                $fullName = $order->delivery['firstname'].' '.$order->delivery['lastname'];
220 220
             }
221 221
             $fullName = utf8_encode($fullName);
222 222
             $userAddress = new Address();
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
                     ->setQuantity(intval($item['qty']))
288 288
                     ->setDescription($item['name']);
289 289
                 if ($promotedProduct) {
290
-                    $promotedAmount+=$product->getAmount();
290
+                    $promotedAmount += $product->getAmount();
291 291
                     $promotedMessage = $product->getDescription()."-Price:".$item['final_price']."-Qty:".$product->getQuantity();
292 292
                     $metadataOrder->addMetadata('promotedProduct', $promotedMessage);
293 293
                 }
@@ -307,9 +307,9 @@  discard block
 block discarded – undo
307 307
             );
308 308
 
309 309
             $cancelUrl = trim(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL', false));
310
-            if ($this->extraConfig['PAGANTIS_URL_KO']!='') {
310
+            if ($this->extraConfig['PAGANTIS_URL_KO'] != '') {
311 311
                 $koUrl = $this->extraConfig['PAGANTIS_URL_KO'];
312
-            } else {
312
+            }else {
313 313
                 $koUrl = $cancelUrl;
314 314
             }
315 315
 
@@ -347,25 +347,25 @@  discard block
 block discarded – undo
347 347
             if ($pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) {
348 348
                 $url = $pagantisOrder->getActionUrls()->getForm();
349 349
                 $this->insertRow($this->os_order_reference, $pagantisOrder->getId(), serialize($global_vars));
350
-            } else {
350
+            }else {
351 351
                 throw new OrderNotFoundException();
352 352
             }
353 353
 
354 354
             if ($url == "") {
355 355
                 throw new UnknownException(_("No ha sido posible obtener una respuesta de Pagantis"));
356
-            } else {
356
+            }else {
357 357
                 $output = "\n";
358
-                $output .= tep_draw_hidden_field("formUrl", $url) . "\n";
359
-                $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl) . "\n";
358
+                $output .= tep_draw_hidden_field("formUrl", $url)."\n";
359
+                $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl)."\n";
360 360
                 return $output;
361 361
 
362 362
             } //TODO IFRAME
363 363
         } catch (\Exception $exception) {
364 364
             $this->insertLog($exception);
365 365
             $output = "\n";
366
-            $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl) . "\n";
367
-            $output .= tep_draw_hidden_field("errorMessage", $exception->getMessage()) . "\n";
368
-            $output .= tep_draw_hidden_field("errorCode", $exception->getCode()) . "\n";
366
+            $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl)."\n";
367
+            $output .= tep_draw_hidden_field("errorMessage", $exception->getMessage())."\n";
368
+            $output .= tep_draw_hidden_field("errorCode", $exception->getCode())."\n";
369 369
             $output .= "<p>".$this->errorMessage.", <a href='$cancelUrl' style='text-decoration:underline'><b>";
370 370
             $output .= $this->errorLinkMessage." </b></a></p>";
371 371
 
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
             return 'failed';
430 430
         }
431 431
 
432
-        tep_db_query("insert into " . TABLE_CONFIGURATION . "
432
+        tep_db_query("insert into ".TABLE_CONFIGURATION."
433 433
         (
434 434
             configuration_title,
435 435
             configuration_key,
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
             ',
453 453
             now()
454 454
         )");
455
-        tep_db_query("insert into " . TABLE_CONFIGURATION . "
455
+        tep_db_query("insert into ".TABLE_CONFIGURATION."
456 456
         (
457 457
             configuration_title,
458 458
             configuration_key,
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
             '0',
473 473
             now()
474 474
         )");
475
-        tep_db_query("insert into " . TABLE_CONFIGURATION . "
475
+        tep_db_query("insert into ".TABLE_CONFIGURATION."
476 476
         (
477 477
             configuration_title,
478 478
             configuration_key,
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
             '0',
493 493
             now()
494 494
         )");
495
-        tep_db_query("insert into " . TABLE_CONFIGURATION . "
495
+        tep_db_query("insert into ".TABLE_CONFIGURATION."
496 496
         (
497 497
             configuration_title,
498 498
             configuration_key,
@@ -524,14 +524,14 @@  discard block
 block discarded – undo
524 524
      */
525 525
     private function installPagantisTables()
526 526
     {
527
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_LOG . " ( 
527
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_LOG." ( 
528 528
                           id int NOT NULL AUTO_INCREMENT, 
529 529
                           log text NOT NULL, 
530 530
                           createdAt timestamp DEFAULT CURRENT_TIMESTAMP, 
531 531
                           UNIQUE KEY id (id))";
532 532
         tep_db_query($sql);
533 533
 
534
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONFIG . " (
534
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONFIG." (
535 535
                             id int NOT NULL AUTO_INCREMENT, 
536 536
                             config varchar(60) NOT NULL, 
537 537
                             value varchar(200) NOT NULL, 
@@ -539,10 +539,10 @@  discard block
 block discarded – undo
539 539
         tep_db_query($sql);
540 540
 
541 541
         // check if table has records
542
-        $check_query = tep_db_query("select value from " . TABLE_PAGANTIS_CONFIG);
542
+        $check_query = tep_db_query("select value from ".TABLE_PAGANTIS_CONFIG);
543 543
         if (tep_db_num_rows($check_query) === 0) {
544 544
             foreach ((array)$this->defaultConfigs as $configKey => $configValue) {
545
-                $query = "INSERT INTO " . TABLE_PAGANTIS_CONFIG . "
545
+                $query = "INSERT INTO ".TABLE_PAGANTIS_CONFIG."
546 546
                 (
547 547
                     config,
548 548
                     value
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
             }
557 557
         }
558 558
 
559
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_ORDERS . " (
559
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_ORDERS." (
560 560
                             id int NOT NULL AUTO_INCREMENT, 
561 561
                             os_order_id varchar(50), 
562 562
                             os_order_reference varchar(50) NOT NULL,
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
                             UNIQUE KEY id(id))";
566 566
         tep_db_query($sql);
567 567
 
568
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONCURRENCY . " (
568
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONCURRENCY." (
569 569
                             id varchar(50) NOT NULL,
570 570
                             `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
571 571
                             UNIQUE KEY id(id))";
@@ -577,29 +577,29 @@  discard block
 block discarded – undo
577 577
      */
578 578
     public function remove()
579 579
     {
580
-        $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_LOG . "'");
580
+        $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_LOG."'");
581 581
         if (tep_db_num_rows($checkTable) > 0) {
582
-            tep_db_query("drop table " . TABLE_PAGANTIS_LOG);
582
+            tep_db_query("drop table ".TABLE_PAGANTIS_LOG);
583 583
         }
584 584
 
585
-        $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONFIG . "'");
585
+        $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONFIG."'");
586 586
         if (tep_db_num_rows($checkTable) > 0) {
587
-            tep_db_query("drop table " . TABLE_PAGANTIS_CONFIG);
587
+            tep_db_query("drop table ".TABLE_PAGANTIS_CONFIG);
588 588
         }
589 589
 
590
-        $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_ORDERS . "'");
590
+        $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_ORDERS."'");
591 591
         if (tep_db_num_rows($checkTable) > 0) {
592
-            tep_db_query("drop table " . TABLE_PAGANTIS_ORDERS);
592
+            tep_db_query("drop table ".TABLE_PAGANTIS_ORDERS);
593 593
         }
594 594
 
595
-        $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONCURRENCY . "'");
595
+        $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONCURRENCY."'");
596 596
         if (tep_db_num_rows($checkTable) > 0) {
597
-            tep_db_query("drop table " . TABLE_PAGANTIS_CONCURRENCY);
597
+            tep_db_query("drop table ".TABLE_PAGANTIS_CONCURRENCY);
598 598
         }
599 599
 
600
-        tep_db_query("DELETE FROM ". TABLE_CONFIGURATION ." where configuration_key in ('MODULE_PAYMENT_PAGANTIS_STATUS','MODULE_PAYMENT_PAGANTIS_PK','MODULE_PAYMENT_PAGANTIS_SK')");
600
+        tep_db_query("DELETE FROM ".TABLE_CONFIGURATION." where configuration_key in ('MODULE_PAYMENT_PAGANTIS_STATUS','MODULE_PAYMENT_PAGANTIS_PK','MODULE_PAYMENT_PAGANTIS_SK')");
601 601
 
602
-        $query = "delete from " . TABLE_CONFIGURATION . " where configuration_key like '%_PAGANTIS_%'";
602
+        $query = "delete from ".TABLE_CONFIGURATION." where configuration_key like '%_PAGANTIS_%'";
603 603
         tep_db_query($query);
604 604
 
605 605
         $this->uninstallSimulator();
@@ -654,13 +654,13 @@  discard block
 block discarded – undo
654 654
      */
655 655
     private function insertRow($orderId, $pagantisOrderId, $globalVars)
656 656
     {
657
-        $query = "select * from " . TABLE_PAGANTIS_ORDERS . " where os_order_reference='$orderId'";
657
+        $query = "select * from ".TABLE_PAGANTIS_ORDERS." where os_order_reference='$orderId'";
658 658
         $resultsSelect = tep_db_query($query);
659 659
         $countResults = tep_db_num_rows($resultsSelect);
660 660
         if ($countResults == 0) {
661
-            $query = "INSERT INTO " . TABLE_PAGANTIS_ORDERS . " 
661
+            $query = "INSERT INTO ".TABLE_PAGANTIS_ORDERS." 
662 662
                 (os_order_reference, pagantis_order_id, globals) values ('$orderId', '$pagantisOrderId','$globalVars')";
663
-        } else {
663
+        }else {
664 664
             $query = "UPDATE ".TABLE_PAGANTIS_ORDERS." set pagantis_order_id='$pagantisOrderId' 
665 665
                         where os_order_reference='$orderId'";
666 666
         }
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 
699 699
         if ($this->extraConfig['PAGANTIS_PROMOTION'] == '') {
700 700
             $promotedProducts = array();
701
-        } else {
701
+        }else {
702 702
             $promotedProducts = array_values((array)unserialize($this->extraConfig['PAGANTIS_PROMOTION']));
703 703
         }
704 704
 
@@ -711,17 +711,17 @@  discard block
 block discarded – undo
711 711
     private function getDescription()
712 712
     {
713 713
         $descriptionCode = "<img src=\"images/icon_info.gif\" border=\"0\" alt=\"Info\" title=\"Info\">&nbsp;<strong>Module version:</strong> $this->version<br/><br/>";
714
-        $descriptionCode.= "<img src=\"images/icon_info.gif\" border=\"0\">&nbsp;<a href='https://developer.pagantis.com/' target=\"_blank\" style=\"text-decoration: underline; font-weight: bold;\">View Online Documentation</a><br/><br/>";
715
-        $descriptionCode.= "<img src='images/icon_popup.gif'  border='0'>        <a href='http://pagantis.com' target='_blank' style='text-decoration: underline; font-weight: bold;'>Visit Pagantis Website</a><br/><br/><br/>";
714
+        $descriptionCode .= "<img src=\"images/icon_info.gif\" border=\"0\">&nbsp;<a href='https://developer.pagantis.com/' target=\"_blank\" style=\"text-decoration: underline; font-weight: bold;\">View Online Documentation</a><br/><br/>";
715
+        $descriptionCode .= "<img src='images/icon_popup.gif'  border='0'>        <a href='http://pagantis.com' target='_blank' style='text-decoration: underline; font-weight: bold;'>Visit Pagantis Website</a><br/><br/><br/>";
716 716
 
717 717
         if (MODULE_PAYMENT_PAGANTIS_STATUS == 'True') {
718 718
             $pagantisPromotionUrl = $this->base_url.'/admin/promotion.php';
719 719
             $linkDescription = "Si deseas ofrecer financiación sin intereses para alguno de tus productos ";
720
-            $descriptionCode.= "<img src='images/icon_info.gif' border='0'/> $linkDescription<a href='$pagantisPromotionUrl' style='text-decoration: underline; font-weight: bold;'>haz click aquí</a>";
720
+            $descriptionCode .= "<img src='images/icon_info.gif' border='0'/> $linkDescription<a href='$pagantisPromotionUrl' style='text-decoration: underline; font-weight: bold;'>haz click aquí</a>";
721 721
 
722 722
             $pagantisAllowedCountriesUrl = $this->base_url.'/admin/allowedCountries.php';
723 723
             $linkDescription = "Para gestionar paises en los que operar con Pagantis ";
724
-            $descriptionCode.= "<br/><br/><img src='images/icon_info.gif' border='0'/> $linkDescription<a href='$pagantisAllowedCountriesUrl' style='text-decoration: underline; font-weight: bold;'>haz click aquí</a>";
724
+            $descriptionCode .= "<br/><br/><img src='images/icon_info.gif' border='0'/> $linkDescription<a href='$pagantisAllowedCountriesUrl' style='text-decoration: underline; font-weight: bold;'>haz click aquí</a>";
725 725
         }
726 726
 
727 727
         return $descriptionCode;
@@ -732,18 +732,18 @@  discard block
 block discarded – undo
732 732
      */
733 733
     private function installSimulator()
734 734
     {
735
-        $checkSimulator = tep_db_query("select configuration_key, configuration_value from " .TABLE_CONFIGURATION ." 
735
+        $checkSimulator = tep_db_query("select configuration_key, configuration_value from ".TABLE_CONFIGURATION." 
736 736
                                     where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'
737 737
                                     and configuration_value like '%ht_pagantis.php%';");
738 738
         if (tep_db_num_rows($checkSimulator) > 0) {
739 739
             return true;
740 740
         }
741 741
 
742
-        $query = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = concat(configuration_value, ';ht_pagantis.php')
742
+        $query = "UPDATE ".TABLE_CONFIGURATION." set configuration_value = concat(configuration_value, ';ht_pagantis.php')
743 743
                         where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'";
744 744
         tep_db_query($query);
745 745
 
746
-        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Pagantis Module', 'MODULE_HEADER_TAGS_PAGANTIS_STATUS', 'True', '', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
746
+        tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Pagantis Module', 'MODULE_HEADER_TAGS_PAGANTIS_STATUS', 'True', '', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
747 747
     }
748 748
 
749 749
     /**
@@ -751,18 +751,18 @@  discard block
 block discarded – undo
751 751
      */
752 752
     private function uninstallSimulator()
753 753
     {
754
-        $checkSimulator = tep_db_query("select configuration_key, configuration_value from " .TABLE_CONFIGURATION ." 
754
+        $checkSimulator = tep_db_query("select configuration_key, configuration_value from ".TABLE_CONFIGURATION." 
755 755
                                     where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'
756 756
                                     and configuration_value like '%ht_pagantis.php%';");
757 757
         if (tep_db_num_rows($checkSimulator) == 0) {
758 758
             return true;
759 759
         }
760 760
 
761
-        $query = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = REPLACE(configuration_value, ';ht_pagantis.php', '')
761
+        $query = "UPDATE ".TABLE_CONFIGURATION." set configuration_value = REPLACE(configuration_value, ';ht_pagantis.php', '')
762 762
                         where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'";
763 763
         tep_db_query($query);
764 764
 
765
-        $query = "delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_HEADER_TAGS_PAGANTIS_STATUS'";
765
+        $query = "delete from ".TABLE_CONFIGURATION." where configuration_key = 'MODULE_HEADER_TAGS_PAGANTIS_STATUS'";
766 766
         tep_db_query($query);
767 767
     }
768 768
 
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
     private function insertLog($exception)
773 773
     {
774 774
         if ($exception instanceof \Exception) {
775
-            $logEntry= new LogEntry();
775
+            $logEntry = new LogEntry();
776 776
             $logEntryJson = $logEntry->error($exception)->toJson();
777 777
             $logEntryJson = addslashes($logEntryJson);
778 778
 
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
             return $order->customer['national_id'];
792 792
         } elseif (isset($order->billing['piva'])) {
793 793
             return $order->billing['piva'];
794
-        } else {
794
+        }else {
795 795
             return null;
796 796
         }
797 797
     }
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
             return $order->customer['tax_id'];
807 807
         } elseif (isset($order->billing['cf'])) {
808 808
             return $order->billing['cf'];
809
-        } else {
809
+        }else {
810 810
             return null;
811 811
         }
812 812
     }
Please login to merge, or discard this patch.
catalog/ext/modules/payment/pagantis/notifyController.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -86,22 +86,22 @@  discard block
 block discarded – undo
86 86
             $jsonResponse->setException($exception);
87 87
             $this->insertLog($exception);
88 88
 
89
-            if ($this->extraConfig['PAGANTIS_URL_KO'] =! '') {
89
+            if ($this->extraConfig['PAGANTIS_URL_KO'] = !'') {
90 90
                 $koUrl = $this->extraConfig['PAGANTIS_URL_KO'];
91
-            } else {
91
+            }else {
92 92
                 $koUrl = trim(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL', false));
93 93
             }
94 94
 
95 95
             if ($this->origin == 'notify') {
96 96
                 $jsonResponse->printResponse();
97
-            } else {
97
+            }else {
98 98
                 if ($exception->getMessage() == AlreadyProcessedException::ERROR_MESSAGE) {
99
-                    if ($this->extraConfig['PAGANTIS_URL_OK']!='') {
99
+                    if ($this->extraConfig['PAGANTIS_URL_OK'] != '') {
100 100
                         $confirmationUrl = $this->extraConfig['PAGANTIS_URL_OK'];
101
-                        $confirmationUrl.="?order_id=$this->merchantOrderId";
102
-                    } else {
101
+                        $confirmationUrl .= "?order_id=$this->merchantOrderId";
102
+                    }else {
103 103
                         $confirmationUrl = trim(tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, '', 'SSL', false));
104
-                        $confirmationUrl.="?order_id=$this->merchantOrderId";
104
+                        $confirmationUrl .= "?order_id=$this->merchantOrderId";
105 105
                     }
106 106
 
107 107
                     header("Location: $confirmationUrl");
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
         if ($this->origin == 'notify') {
138 138
             $jsonResponse->printResponse();
139
-        } else {
139
+        }else {
140 140
             return $jsonResponse;
141 141
         }
142 142
     }
@@ -213,12 +213,12 @@  discard block
 block discarded – undo
213 213
         try {
214 214
             $this->checkPagantisStatus(array('AUTHORIZED'));
215 215
         } catch (\Exception $e) {
216
-            if ($this->findOscommerceOrderId()!='') {
216
+            if ($this->findOscommerceOrderId() != '') {
217 217
                 throw new AlreadyProcessedException();
218
-            } else {
218
+            }else {
219 219
                 if ($this->pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) {
220 220
                     $status = $this->pagantisOrder->getStatus();
221
-                } else {
221
+                }else {
222 222
                     $status = '-';
223 223
                 }
224 224
                 throw new WrongStatusException($status);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     {
234 234
         global $order;
235 235
 
236
-        if ($order->info['order_status']!=='1') {
236
+        if ($order->info['order_status'] !== '1') {
237 237
             throw new AlreadyProcessedException();
238 238
         }
239 239
     }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
             $this->pagantisOrder = $this->orderClient->getOrder($this->pagantisOrderId);
265 265
             if ($this->pagantisOrder->getStatus() !== Order::STATUS_CONFIRMED) {
266 266
                 throw new UnknownException($e->getMessage());
267
-            } else {
267
+            }else {
268 268
                 $logMessage = 'Concurrency issue: Order_id '.$this->pagantisOrderId.' was confirmed by other process';
269 269
                 $this->insertLog(null, $logMessage);
270 270
             }
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
                     self::CONCURRENCY_TIMEOUT
323 323
                 );
324 324
                 tep_db_query($query);
325
-            } elseif ($orderId!='') {
325
+            } elseif ($orderId != '') {
326 326
                 $query = "delete from ".TABLE_PAGANTIS_CONCURRENCY." where id='$orderId'";
327 327
                 tep_db_query($query);
328 328
             }
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
             if (isset($orderRow['timestamp'])) {
344 344
                 if ($this->origin == 'notify') {
345 345
                     throw new ConcurrencyException();
346
-                } else {
346
+                }else {
347 347
                     $query = sprintf(
348 348
                         "SELECT TIMESTAMPDIFF(SECOND,NOW()-INTERVAL %s SECOND, timestamp) as rest FROM %s %s",
349 349
                         self::CONCURRENCY_TIMEOUT,
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
                     $resultsSelect = tep_db_query($query);
354 354
                     $resultsArray = tep_db_fetch_array($resultsSelect);
355 355
                     $restSeconds = isset($resultsArray['rest']) ? ($resultsArray['rest']) : 0;
356
-                    $expirationSec = ($restSeconds>self::CONCURRENCY_TIMEOUT)? self::CONCURRENCY_TIMEOUT : $restSeconds;
356
+                    $expirationSec = ($restSeconds > self::CONCURRENCY_TIMEOUT) ? self::CONCURRENCY_TIMEOUT : $restSeconds;
357 357
                     if ($expirationSec > 0) {
358 358
                         sleep($expirationSec + 1);
359 359
                     }
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
                     $os_order_id = tep_db_fetch_array($resultsSelect);
369 369
                     if (isset($os_order_id['os_order_id'])) {
370 370
                         $redirectUrl = trim(tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, '', 'SSL', false));
371
-                        $redirectUrl.="?order_id=$this->oscommerceOrderId";
372
-                    } else {
371
+                        $redirectUrl .= "?order_id=$this->oscommerceOrderId";
372
+                    }else {
373 373
                         $redirectUrl = trim(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL', false));
374 374
                     }
375 375
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
                     header("Location: $redirectUrl");
386 386
                     exit;
387 387
                 }
388
-            } else {
388
+            }else {
389 389
                 $query = "INSERT INTO ".TABLE_PAGANTIS_CONCURRENCY." (id) VALUES ('$this->oscommerceOrderId');";
390 390
                 tep_db_query($query);
391 391
             }
@@ -415,12 +415,12 @@  discard block
 block discarded – undo
415 415
             if (!$payed) {
416 416
                 if ($this->pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) {
417 417
                     $status = $this->pagantisOrder->getStatus();
418
-                } else {
418
+                }else {
419 419
                     $status = '-';
420 420
                 }
421 421
                 throw new WrongStatusException($status);
422 422
             }
423
-        } else {
423
+        }else {
424 424
             throw new OrderNotFoundException();
425 425
         }
426 426
     }
@@ -466,12 +466,12 @@  discard block
 block discarded – undo
466 466
         $metadataInfo = '';
467 467
         foreach ($metadataOrder as $metadataKey => $metadataValue) {
468 468
             if ($metadataKey == 'promotedProduct') {
469
-                $metadataInfo.= "/Producto promocionado = $metadataValue";
469
+                $metadataInfo .= "/Producto promocionado = $metadataValue";
470 470
             }
471 471
         }
472 472
 
473 473
         $comment = "Pagantis id=$this->pagantisOrderId/Via=".ucfirst($this->origin)."/".$metadataInfo;
474
-        $query = "insert into ".TABLE_ORDERS_STATUS_HISTORY ."(comments, orders_id, orders_status_id, customer_notified,
474
+        $query = "insert into ".TABLE_ORDERS_STATUS_HISTORY."(comments, orders_id, orders_status_id, customer_notified,
475 475
         date_added) values ('$comment', ".$insert_id.", '2', -1, now() )";
476 476
         tep_db_query($query);
477 477
 
@@ -501,10 +501,10 @@  discard block
 block discarded – undo
501 501
      */
502 502
     private function insertLog($exception = null, $message = null)
503 503
     {
504
-        $logEntry= new LogEntry();
504
+        $logEntry = new LogEntry();
505 505
         if ($exception instanceof \Exception) {
506 506
             $logEntryJson = $logEntry->error($exception)->toJson();
507
-        } else {
507
+        }else {
508 508
             $logEntryJson = $logEntry->info($message)->toJson();
509 509
         }
510 510
             $query = "insert into ".TABLE_PAGANTIS_LOG."(log) values ('$logEntryJson')";
Please login to merge, or discard this patch.
catalog/includes/modules/header_tags/ht_pagantis.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         ) {
36 36
             $this->enabled = ((MODULE_HEADER_TAGS_PAGANTIS_STATUS == 'True') &&
37 37
                 (MODULE_PAYMENT_PAGANTIS_STATUS == 'True') &&
38
-                (MODULE_PAYMENT_PAGANTIS_SIMULATOR == 'True')) ;
38
+                (MODULE_PAYMENT_PAGANTIS_SIMULATOR == 'True'));
39 39
         }
40 40
 
41 41
         $this->extraConfig = $this->getExtraConfig();
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      */
72 72
     private function getConfig($config = '')
73 73
     {
74
-        $query       = "select * from ".TABLE_CONFIGURATION . " where configuration_key ='" . $config . "'";
74
+        $query       = "select * from ".TABLE_CONFIGURATION." where configuration_key ='".$config."'";
75 75
         $result      = tep_db_query($query);
76 76
         $resultArray = tep_db_fetch_array($result);
77 77
         return $resultArray['configuration_value'];
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     private function getProductPrice()
84 84
     {
85
-        $query       = "select products_price from products where products_id ='" . urlencode($_GET['products_id']) . "'";
85
+        $query       = "select products_price from products where products_id ='".urlencode($_GET['products_id'])."'";
86 86
         $result      = tep_db_query($query);
87 87
         $resultArray = tep_db_fetch_array($result);
88 88
         return (int)$resultArray['products_price'];
@@ -99,40 +99,40 @@  discard block
 block discarded – undo
99 99
         $productId = $GLOBALS["HTTP_GET_VARS"]["products_id"];
100 100
         $checkoutPage = strpos($_SERVER[REQUEST_URI], "checkout_payment.php") > 0;
101 101
 
102
-        if (isset($productId) && $checkoutPage!='1') {
102
+        if (isset($productId) && $checkoutPage != '1') {
103 103
             $productPrice = $this->getProductPrice();
104 104
             $pagantisDisplayMinAmount = $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'];
105 105
             $pagantisDisplayMaxAmount = $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_MAX_AMOUNT'];
106
-            if (($productPrice > (int)$pagantisDisplayMaxAmount  && (int)$pagantisDisplayMaxAmount != '0') ||
106
+            if (($productPrice > (int)$pagantisDisplayMaxAmount && (int)$pagantisDisplayMaxAmount != '0') ||
107 107
                 $productPrice < (int)$pagantisDisplayMinAmount) {
108 108
                 return false;
109 109
             }
110 110
         }
111 111
         //Show promoted html
112
-        if ($this->isPromoted($productId) && $checkoutPage!='1') {
112
+        if ($this->isPromoted($productId) && $checkoutPage != '1') {
113 113
             echo "<style> #promotedText{margin-left: 10%;} .pmt-no-interest{color: #00c1d5 }</style>";
114 114
             echo "<div id='promotedText' style='display:none'><br/>".$this->extraConfig['PAGANTIS_PROMOTED_PRODUCT_CODE']."</div>";
115
-            echo '<script>'. PHP_EOL;
116
-            echo '        function loadPromoted()'. PHP_EOL;
117
-            echo '        {'. PHP_EOL;
118
-            echo 'var positionSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR']. '\';'. PHP_EOL;
119
-            echo 'if (positionSelector === \'default\') {'. PHP_EOL;
120
-            echo 'positionSelector = \'.buttonSet\''. PHP_EOL;
121
-            echo '}'. PHP_EOL;
115
+            echo '<script>'.PHP_EOL;
116
+            echo '        function loadPromoted()'.PHP_EOL;
117
+            echo '        {'.PHP_EOL;
118
+            echo 'var positionSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'].'\';'.PHP_EOL;
119
+            echo 'if (positionSelector === \'default\') {'.PHP_EOL;
120
+            echo 'positionSelector = \'.buttonSet\''.PHP_EOL;
121
+            echo '}'.PHP_EOL;
122 122
             echo 'var docFather = document.querySelector(positionSelector);'.PHP_EOL;
123
-            echo 'if (typeof docFather != \'undefined\') {'. PHP_EOL;
123
+            echo 'if (typeof docFather != \'undefined\') {'.PHP_EOL;
124 124
             echo 'var promotedNode = document.getElementById("promotedText");'.PHP_EOL;
125 125
             echo 'docFather.appendChild(promotedNode);'.PHP_EOL;
126
-            echo 'promotedNode.style.display=""' . PHP_EOL;
127
-            echo '               clearInterval(window.OSPromotedId);'. PHP_EOL;
128
-            echo '               return true;'. PHP_EOL;
129
-            echo '       }'. PHP_EOL;
130
-            echo '               return false;'. PHP_EOL;
131
-            echo '       }'. PHP_EOL;
132
-            echo '       window.OSPromotedId = setInterval(function () {'. PHP_EOL;
133
-            echo '          loadPromoted();'. PHP_EOL;
134
-            echo '       }, 2000);'. PHP_EOL;
135
-            echo '</script>'. PHP_EOL;
126
+            echo 'promotedNode.style.display=""'.PHP_EOL;
127
+            echo '               clearInterval(window.OSPromotedId);'.PHP_EOL;
128
+            echo '               return true;'.PHP_EOL;
129
+            echo '       }'.PHP_EOL;
130
+            echo '               return false;'.PHP_EOL;
131
+            echo '       }'.PHP_EOL;
132
+            echo '       window.OSPromotedId = setInterval(function () {'.PHP_EOL;
133
+            echo '          loadPromoted();'.PHP_EOL;
134
+            echo '       }, 2000);'.PHP_EOL;
135
+            echo '</script>'.PHP_EOL;
136 136
         }
137 137
 
138 138
         if (isset($productId) || $checkoutPage) {
@@ -145,111 +145,111 @@  discard block
 block discarded – undo
145 145
                 $productId = array_shift($productId);
146 146
                 $promotedProduct = $this->isPromoted($productId);
147 147
                 if ($promotedProduct) {
148
-                    $promotedAmount+=number_format(($item['price'] * $item['qty']), 2);
148
+                    $promotedAmount += number_format(($item['price'] * $item['qty']), 2);
149 149
                 }
150 150
             }
151 151
 
152
-            echo "<script src='".$this->sdkFile."'></script>". PHP_EOL;
153
-            echo '<style>#bodyContent>form>div>iframe {float: right; width: 280px !important; margin-right: -90px;} .contentContainer {clear: both;}</style>'. PHP_EOL;
154
-            echo '<script>'. PHP_EOL;
155
-            echo '        function loadSimulator()'. PHP_EOL;
156
-            echo '        {'. PHP_EOL;
157
-            echo '           if (typeof '.$simulatorCode.' != \'undefined\') {'. PHP_EOL;
158
-            echo '               var sdk = '.$simulatorCode.';'. PHP_EOL;
159
-            echo '               var positionSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR']. '\';'. PHP_EOL;
160
-            echo '               var priceSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']. '\';'. PHP_EOL;
161
-            echo '               var checkoutPriceSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']. '\';'. PHP_EOL;
162
-            echo '               var quantitySelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR']. '\';'. PHP_EOL;
163
-            echo '               var checkoutPage =     \'' . $checkoutPage.'\';'. PHP_EOL;
164
-            echo '               var promotedAmount =     \'' . $promotedAmount.'\';'. PHP_EOL;
165
-            echo '               var langCode =     \'' . $this->langCode.'\';'. PHP_EOL;
166
-
167
-            echo '               if (positionSelector === \'default\') {'. PHP_EOL;
168
-            echo '                   positionSelector = \'#bodyContent>form>div\''. PHP_EOL;
169
-            echo '               }'. PHP_EOL;
170
-
171
-            echo '               if (priceSelector === \'default\') {'. PHP_EOL;
172
-            echo '                   priceSelector = \'#bodyContent>form>div>h1:first-child\''. PHP_EOL;
173
-            echo '               }'. PHP_EOL;
174
-
175
-            echo '               if (checkoutPriceSelector == \'default\' && checkoutPage == \'1\')  {'. PHP_EOL;
176
-            echo '                   priceSelector = \'#columnRight > .infoBoxContainer > .infoBoxContents > tbody > tr:last-child > td\';'. PHP_EOL;
177
-            echo '               }'. PHP_EOL;
178
-
179
-            echo '               product_simulator = {};'. PHP_EOL;
180
-            echo '               product_simulator.locale = \'' . strtolower($this->langCode) . '\';'. PHP_EOL;
181
-            echo '               product_simulator.country = \'' . strtolower($this->langCode) . '\';'. PHP_EOL;
182
-            echo '               product_simulator.publicKey = \'' . $this->pk . '\';'. PHP_EOL;
183
-            echo '               product_simulator.selector = positionSelector;'. PHP_EOL;
184
-            echo '               product_simulator.numInstalments = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'] . '\';'. PHP_EOL;
185
-            echo '               product_simulator.type = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'] . ';'. PHP_EOL;
186
-            echo '               product_simulator.skin = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'] . ';'. PHP_EOL;
187
-            echo '               product_simulator.position = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'] . ';'. PHP_EOL;
188
-            echo '               product_simulator.amountParserConfig = {};'. PHP_EOL;
189
-            echo '               product_simulator.amountParserConfig.thousandSeparator = "' . $this->extraConfig['PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR'] . '";'. PHP_EOL;
190
-            echo '               product_simulator.amountParserConfig.decimalSeparator = "' . $this->extraConfig['PAGANTIS_SIMULATOR_DECIMAL_SEPARATOR'] .  '";'. PHP_EOL;
152
+            echo "<script src='".$this->sdkFile."'></script>".PHP_EOL;
153
+            echo '<style>#bodyContent>form>div>iframe {float: right; width: 280px !important; margin-right: -90px;} .contentContainer {clear: both;}</style>'.PHP_EOL;
154
+            echo '<script>'.PHP_EOL;
155
+            echo '        function loadSimulator()'.PHP_EOL;
156
+            echo '        {'.PHP_EOL;
157
+            echo '           if (typeof '.$simulatorCode.' != \'undefined\') {'.PHP_EOL;
158
+            echo '               var sdk = '.$simulatorCode.';'.PHP_EOL;
159
+            echo '               var positionSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'].'\';'.PHP_EOL;
160
+            echo '               var priceSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'].'\';'.PHP_EOL;
161
+            echo '               var checkoutPriceSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'].'\';'.PHP_EOL;
162
+            echo '               var quantitySelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'].'\';'.PHP_EOL;
163
+            echo '               var checkoutPage =     \''.$checkoutPage.'\';'.PHP_EOL;
164
+            echo '               var promotedAmount =     \''.$promotedAmount.'\';'.PHP_EOL;
165
+            echo '               var langCode =     \''.$this->langCode.'\';'.PHP_EOL;
166
+
167
+            echo '               if (positionSelector === \'default\') {'.PHP_EOL;
168
+            echo '                   positionSelector = \'#bodyContent>form>div\''.PHP_EOL;
169
+            echo '               }'.PHP_EOL;
170
+
171
+            echo '               if (priceSelector === \'default\') {'.PHP_EOL;
172
+            echo '                   priceSelector = \'#bodyContent>form>div>h1:first-child\''.PHP_EOL;
173
+            echo '               }'.PHP_EOL;
174
+
175
+            echo '               if (checkoutPriceSelector == \'default\' && checkoutPage == \'1\')  {'.PHP_EOL;
176
+            echo '                   priceSelector = \'#columnRight > .infoBoxContainer > .infoBoxContents > tbody > tr:last-child > td\';'.PHP_EOL;
177
+            echo '               }'.PHP_EOL;
178
+
179
+            echo '               product_simulator = {};'.PHP_EOL;
180
+            echo '               product_simulator.locale = \''.strtolower($this->langCode).'\';'.PHP_EOL;
181
+            echo '               product_simulator.country = \''.strtolower($this->langCode).'\';'.PHP_EOL;
182
+            echo '               product_simulator.publicKey = \''.$this->pk.'\';'.PHP_EOL;
183
+            echo '               product_simulator.selector = positionSelector;'.PHP_EOL;
184
+            echo '               product_simulator.numInstalments = \''.$this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'].'\';'.PHP_EOL;
185
+            echo '               product_simulator.type = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'].';'.PHP_EOL;
186
+            echo '               product_simulator.skin = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'].';'.PHP_EOL;
187
+            echo '               product_simulator.position = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'].';'.PHP_EOL;
188
+            echo '               product_simulator.amountParserConfig = {};'.PHP_EOL;
189
+            echo '               product_simulator.amountParserConfig.thousandSeparator = "'.$this->extraConfig['PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR'].'";'.PHP_EOL;
190
+            echo '               product_simulator.amountParserConfig.decimalSeparator = "'.$this->extraConfig['PAGANTIS_SIMULATOR_DECIMAL_SEPARATOR'].'";'.PHP_EOL;
191 191
 
192 192
             //Amount in product page
193
-            echo '               var promotedProduct = \'' . $this->isPromoted($productId) .'\';'. PHP_EOL;
194
-            echo '               if(checkoutPage != \'1\' ) {'. PHP_EOL;
195
-            echo '               product_simulator.itemAmountSelector = priceSelector;'. PHP_EOL;
196
-            echo '                   if(promotedProduct == \'1\') { ' . PHP_EOL;
197
-            echo '                    product_simulator.itemPromotedAmountSelector = priceSelector;'. PHP_EOL;
198
-            echo '                   }' . PHP_EOL;
193
+            echo '               var promotedProduct = \''.$this->isPromoted($productId).'\';'.PHP_EOL;
194
+            echo '               if(checkoutPage != \'1\' ) {'.PHP_EOL;
195
+            echo '               product_simulator.itemAmountSelector = priceSelector;'.PHP_EOL;
196
+            echo '                   if(promotedProduct == \'1\') { '.PHP_EOL;
197
+            echo '                    product_simulator.itemPromotedAmountSelector = priceSelector;'.PHP_EOL;
198
+            echo '                   }'.PHP_EOL;
199 199
             echo '               }';
200 200
 
201 201
             //Amount in checkout page
202
-            echo '               if(checkoutPage == \'1\' ) { ' . PHP_EOL;
203
-            echo '                  product_simulator.totalAmountSelector = priceSelector;'. PHP_EOL;
204
-            echo '                  if(promotedAmount != \'0\' && checkoutPage == \'1\' ) { ' . PHP_EOL;
205
-            echo '                      product_simulator.totalPromotedAmount = promotedAmount;'. PHP_EOL;
206
-            echo '                  }' . PHP_EOL;
207
-            echo '                  product_simulator.selector = \'.buttonSet\';' . PHP_EOL;
208
-            echo '                  product_simulator.type = ' .$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE_CHECKOUT'] . PHP_EOL;
209
-            echo '               }' . PHP_EOL;
210
-            echo '               sdk.simulator.init(product_simulator);'. PHP_EOL;
211
-            echo '               clearInterval(window.OSSimulatorId);'. PHP_EOL;
212
-            echo '               return true;'. PHP_EOL;
213
-            echo '           }'. PHP_EOL;
214
-            echo '           return false;'. PHP_EOL;
215
-            echo '       }'. PHP_EOL;
202
+            echo '               if(checkoutPage == \'1\' ) { '.PHP_EOL;
203
+            echo '                  product_simulator.totalAmountSelector = priceSelector;'.PHP_EOL;
204
+            echo '                  if(promotedAmount != \'0\' && checkoutPage == \'1\' ) { '.PHP_EOL;
205
+            echo '                      product_simulator.totalPromotedAmount = promotedAmount;'.PHP_EOL;
206
+            echo '                  }'.PHP_EOL;
207
+            echo '                  product_simulator.selector = \'.buttonSet\';'.PHP_EOL;
208
+            echo '                  product_simulator.type = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE_CHECKOUT'].PHP_EOL;
209
+            echo '               }'.PHP_EOL;
210
+            echo '               sdk.simulator.init(product_simulator);'.PHP_EOL;
211
+            echo '               clearInterval(window.OSSimulatorId);'.PHP_EOL;
212
+            echo '               return true;'.PHP_EOL;
213
+            echo '           }'.PHP_EOL;
214
+            echo '           return false;'.PHP_EOL;
215
+            echo '       }'.PHP_EOL;
216 216
 
217 217
             //Invoke to main method
218
-            echo '       window.OSSimulatorId = setInterval(function () {'. PHP_EOL;
219
-            echo '          loadSimulator();'. PHP_EOL;
220
-            echo '       }, 2500);'. PHP_EOL;
221
-            echo '</script>'. PHP_EOL;
218
+            echo '       window.OSSimulatorId = setInterval(function () {'.PHP_EOL;
219
+            echo '          loadSimulator();'.PHP_EOL;
220
+            echo '       }, 2500);'.PHP_EOL;
221
+            echo '</script>'.PHP_EOL;
222 222
 
223 223
             //Checkout simulator
224 224
             if ($checkoutPage) {
225
-                echo '<script>' . PHP_EOL;
226
-
227
-                echo 'function checkSelected(value)'. PHP_EOL;
228
-                echo '{ '. PHP_EOL;
229
-                echo 'var simulator = document.getElementsByClassName("buttonSet");'  . PHP_EOL;
230
-                echo ' if(simulator == "undefined") { return false;  } '. PHP_EOL;
231
-                echo 'var pagantisCheckbox = document.querySelector("input[value=\'pagantis\']"); ' . PHP_EOL;
232
-                echo 'var grandparentNode = pagantisCheckbox.parentNode.parentNode;' . PHP_EOL;
233
-                echo 'if(grandparentNode == value) { var status="" } ' . PHP_EOL;
234
-                echo 'else { var status="none";} '. PHP_EOL;
235
-                echo 'simulator[0].style.display=status; ' . PHP_EOL;
236
-                echo '}'. PHP_EOL;
237
-
238
-                echo 'function showSimulator()'. PHP_EOL;
239
-                echo '{'. PHP_EOL;
240
-                echo 'var elements = document.querySelectorAll("tr[class^=\'moduleRow\']");' . PHP_EOL;
241
-                echo 'if(elements == null) { return false };' . PHP_EOL;
225
+                echo '<script>'.PHP_EOL;
226
+
227
+                echo 'function checkSelected(value)'.PHP_EOL;
228
+                echo '{ '.PHP_EOL;
229
+                echo 'var simulator = document.getElementsByClassName("buttonSet");'.PHP_EOL;
230
+                echo ' if(simulator == "undefined") { return false;  } '.PHP_EOL;
231
+                echo 'var pagantisCheckbox = document.querySelector("input[value=\'pagantis\']"); '.PHP_EOL;
232
+                echo 'var grandparentNode = pagantisCheckbox.parentNode.parentNode;'.PHP_EOL;
233
+                echo 'if(grandparentNode == value) { var status="" } '.PHP_EOL;
234
+                echo 'else { var status="none";} '.PHP_EOL;
235
+                echo 'simulator[0].style.display=status; '.PHP_EOL;
236
+                echo '}'.PHP_EOL;
237
+
238
+                echo 'function showSimulator()'.PHP_EOL;
239
+                echo '{'.PHP_EOL;
240
+                echo 'var elements = document.querySelectorAll("tr[class^=\'moduleRow\']");'.PHP_EOL;
241
+                echo 'if(elements == null) { return false };'.PHP_EOL;
242 242
                 echo 'for(var i = 0, max = elements.length; i < max; i++) { elements[i].onclick = function() {
243 243
                         checkSelected(this);
244 244
                     } }' . PHP_EOL;
245 245
                 echo 'clearInterval(window.OSdisplayId);';
246
-                echo 'return true;'. PHP_EOL;
247
-                echo '};'. PHP_EOL;
246
+                echo 'return true;'.PHP_EOL;
247
+                echo '};'.PHP_EOL;
248 248
 
249
-                echo '       window.OSdisplayId = setInterval(function () {'. PHP_EOL;
250
-                echo '          showSimulator();'. PHP_EOL;
251
-                echo '       }, 2000);'. PHP_EOL;
252
-                echo '</script>'. PHP_EOL;
249
+                echo '       window.OSdisplayId = setInterval(function () {'.PHP_EOL;
250
+                echo '          showSimulator();'.PHP_EOL;
251
+                echo '       }, 2000);'.PHP_EOL;
252
+                echo '</script>'.PHP_EOL;
253 253
             }
254 254
         }
255 255
         $oscTemplate->addBlock(ob_get_clean(), $this->group);
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
      * install
274 274
      */
275 275
     function install() {
276
-        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Pagantis Module', 'MODULE_HEADER_TAGS_PAGANTIS_STATUS', 'True', '', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
276
+        tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Pagantis Module', 'MODULE_HEADER_TAGS_PAGANTIS_STATUS', 'True', '', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
277 277
 
278 278
     }
279 279
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
      * remove
282 282
      */
283 283
     function remove() {
284
-        tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
284
+        tep_db_query("delete from ".TABLE_CONFIGURATION." where configuration_key in ('".implode("', '", $this->keys())."')");
285 285
     }
286 286
 
287 287
     /**
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 
305 305
         if ($this->extraConfig['PAGANTIS_PROMOTION'] == '') {
306 306
             $promotedProducts = array();
307
-        } else {
307
+        }else {
308 308
             $promotedProducts = array_values((array)unserialize($this->extraConfig['PAGANTIS_PROMOTION']));
309 309
         }
310 310
 
Please login to merge, or discard this patch.