@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | |
69 | 69 | if (strpos($_SERVER[REQUEST_URI], "checkout_payment.php") <= 0) { |
70 | 70 | $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_ADMIN_TITLE; // Payment module title in Admin |
71 | - } else { |
|
72 | - $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_CHECKOUT .'<br/><br/><div class="buttonSet" style="display:none"></div><br/>'; // Payment module title in Catalog |
|
71 | + }else { |
|
72 | + $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_CHECKOUT.'<br/><br/><div class="buttonSet" style="display:none"></div><br/>'; // Payment module title in Catalog |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | $this->enabled = ((MODULE_PAYMENT_PAGANTIS_STATUS == 'True') ? true : false); |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | "%s://%s%s%s", |
80 | 80 | isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', |
81 | 81 | $_SERVER['SERVER_NAME'], |
82 | - isset($_SERVER['SERVER_PORT']) ? ":" . $_SERVER['SERVER_PORT'] : '', |
|
82 | + isset($_SERVER['SERVER_PORT']) ? ":".$_SERVER['SERVER_PORT'] : '', |
|
83 | 83 | $_SERVER['REQUEST_URI'] |
84 | 84 | ) |
85 | 85 | ); |
86 | 86 | |
87 | - $this->form_action_url = $this->base_url . '/ext/modules/payment/pagantis/bypass.php'; |
|
87 | + $this->form_action_url = $this->base_url.'/ext/modules/payment/pagantis/bypass.php'; |
|
88 | 88 | |
89 | 89 | if (defined('MODULE_PAYMENT_PAGANTIS_LANG_CODE')) { |
90 | 90 | $this->langCode = MODULE_PAYMENT_PAGANTIS_LANG_CODE; |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $userAddress = new Address(); |
195 | 195 | $userAddress |
196 | 196 | ->setZipCode($order->billing['postcode']) |
197 | - ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname']) |
|
197 | + ->setFullName($order->billing['firstname'].' '.$order->billing['lastname']) |
|
198 | 198 | ->setCountryCode('ES') |
199 | 199 | ->setCity($order->billing['city']) |
200 | 200 | ->setAddress($order->billing['street_address']) |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $orderShippingAddress = new Address(); |
207 | 207 | $orderShippingAddress |
208 | 208 | ->setZipCode($order->delivery['postcode']) |
209 | - ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname']) |
|
209 | + ->setFullName($order->billing['firstname'].' '.$order->billing['lastname']) |
|
210 | 210 | ->setCountryCode('ES') |
211 | 211 | ->setCity($order->delivery['city']) |
212 | 212 | ->setAddress($order->delivery['street_address']) |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $orderUser = new \Pagantis\OrdersApiClient\Model\Order\User(); |
217 | 217 | $orderUser |
218 | 218 | ->setAddress($userAddress) |
219 | - ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname']) |
|
219 | + ->setFullName($order->billing['firstname'].' '.$order->billing['lastname']) |
|
220 | 220 | ->setBillingAddress($orderBillingAddress) |
221 | 221 | ->setEmail($order->customer['email_address']) |
222 | 222 | ->setFixPhone($order->customer['telephone']) |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | ->setQuantity(intval($item['qty'])) |
256 | 256 | ->setDescription($item['name']); |
257 | 257 | if ($promotedProduct) { |
258 | - $promotedAmount+=$product->getAmount(); |
|
258 | + $promotedAmount += $product->getAmount(); |
|
259 | 259 | $promotedMessage = $product->getDescription()."-Price:".$item['final_price']."-Qty:".$product->getQuantity(); |
260 | 260 | $metadataOrder->addMetadata('promotedProduct', $promotedMessage); |
261 | 261 | } |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | ); |
276 | 276 | |
277 | 277 | $cancelUrl = trim(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL', false)); |
278 | - if ($this->extraConfig['PAGANTIS_URL_KO']!='') { |
|
278 | + if ($this->extraConfig['PAGANTIS_URL_KO'] != '') { |
|
279 | 279 | $koUrl = $this->extraConfig['PAGANTIS_URL_KO']; |
280 | - } else { |
|
280 | + }else { |
|
281 | 281 | $koUrl = $cancelUrl; |
282 | 282 | } |
283 | 283 | |
@@ -313,16 +313,16 @@ discard block |
||
313 | 313 | if ($pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) { |
314 | 314 | $url = $pagantisOrder->getActionUrls()->getForm(); |
315 | 315 | $this->insertRow($this->os_order_reference, $pagantisOrder->getId(), serialize($global_vars)); |
316 | - } else { |
|
316 | + }else { |
|
317 | 317 | throw new OrderNotFoundException(); |
318 | 318 | } |
319 | 319 | |
320 | 320 | if ($url == "") { |
321 | 321 | throw new UnknownException(_("No ha sido posible obtener una respuesta de Pagantis")); |
322 | - } else { |
|
322 | + }else { |
|
323 | 323 | $output = "\n"; |
324 | - $output .= tep_draw_hidden_field("formUrl", $url) . "\n"; |
|
325 | - $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl) . "\n"; |
|
324 | + $output .= tep_draw_hidden_field("formUrl", $url)."\n"; |
|
325 | + $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl)."\n"; |
|
326 | 326 | return $output; |
327 | 327 | |
328 | 328 | } //TODO IFRAME |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | return 'failed'; |
390 | 390 | } |
391 | 391 | |
392 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " |
|
392 | + tep_db_query("insert into ".TABLE_CONFIGURATION." |
|
393 | 393 | ( |
394 | 394 | configuration_title, |
395 | 395 | configuration_key, |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | ', |
413 | 413 | now() |
414 | 414 | )"); |
415 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " |
|
415 | + tep_db_query("insert into ".TABLE_CONFIGURATION." |
|
416 | 416 | ( |
417 | 417 | configuration_title, |
418 | 418 | configuration_key, |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | '0', |
433 | 433 | now() |
434 | 434 | )"); |
435 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " |
|
435 | + tep_db_query("insert into ".TABLE_CONFIGURATION." |
|
436 | 436 | ( |
437 | 437 | configuration_title, |
438 | 438 | configuration_key, |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | '0', |
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, |
@@ -484,14 +484,14 @@ discard block |
||
484 | 484 | */ |
485 | 485 | private function installPagantisTables() |
486 | 486 | { |
487 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_LOG . " ( |
|
487 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_LOG." ( |
|
488 | 488 | id int NOT NULL AUTO_INCREMENT, |
489 | 489 | log text NOT NULL, |
490 | 490 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, |
491 | 491 | UNIQUE KEY id (id))"; |
492 | 492 | tep_db_query($sql); |
493 | 493 | |
494 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONFIG . " ( |
|
494 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONFIG." ( |
|
495 | 495 | id int NOT NULL AUTO_INCREMENT, |
496 | 496 | config varchar(60) NOT NULL, |
497 | 497 | value varchar(200) NOT NULL, |
@@ -499,10 +499,10 @@ discard block |
||
499 | 499 | tep_db_query($sql); |
500 | 500 | |
501 | 501 | // check if table has records |
502 | - $check_query = tep_db_query("select value from " . TABLE_PAGANTIS_CONFIG); |
|
502 | + $check_query = tep_db_query("select value from ".TABLE_PAGANTIS_CONFIG); |
|
503 | 503 | if (tep_db_num_rows($check_query) === 0) { |
504 | 504 | foreach ((array)$this->defaultConfigs as $configKey => $configValue) { |
505 | - $query = "INSERT INTO " . TABLE_PAGANTIS_CONFIG . " |
|
505 | + $query = "INSERT INTO ".TABLE_PAGANTIS_CONFIG." |
|
506 | 506 | ( |
507 | 507 | config, |
508 | 508 | value |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | } |
517 | 517 | } |
518 | 518 | |
519 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_ORDERS . " ( |
|
519 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_ORDERS." ( |
|
520 | 520 | id int NOT NULL AUTO_INCREMENT, |
521 | 521 | os_order_id varchar(50), |
522 | 522 | os_order_reference varchar(50) NOT NULL, |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | UNIQUE KEY id(id))"; |
526 | 526 | tep_db_query($sql); |
527 | 527 | |
528 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONCURRENCY . " ( |
|
528 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONCURRENCY." ( |
|
529 | 529 | id varchar(50) NOT NULL, |
530 | 530 | `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, |
531 | 531 | UNIQUE KEY id(id))"; |
@@ -537,29 +537,29 @@ discard block |
||
537 | 537 | */ |
538 | 538 | public function remove() |
539 | 539 | { |
540 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_LOG . "'"); |
|
540 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_LOG."'"); |
|
541 | 541 | if (tep_db_num_rows($checkTable) > 0) { |
542 | - tep_db_query("drop table " . TABLE_PAGANTIS_LOG); |
|
542 | + tep_db_query("drop table ".TABLE_PAGANTIS_LOG); |
|
543 | 543 | } |
544 | 544 | |
545 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONFIG . "'"); |
|
545 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONFIG."'"); |
|
546 | 546 | if (tep_db_num_rows($checkTable) > 0) { |
547 | - tep_db_query("drop table " . TABLE_PAGANTIS_CONFIG); |
|
547 | + tep_db_query("drop table ".TABLE_PAGANTIS_CONFIG); |
|
548 | 548 | } |
549 | 549 | |
550 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_ORDERS . "'"); |
|
550 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_ORDERS."'"); |
|
551 | 551 | if (tep_db_num_rows($checkTable) > 0) { |
552 | - tep_db_query("drop table " . TABLE_PAGANTIS_ORDERS); |
|
552 | + tep_db_query("drop table ".TABLE_PAGANTIS_ORDERS); |
|
553 | 553 | } |
554 | 554 | |
555 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONCURRENCY . "'"); |
|
555 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONCURRENCY."'"); |
|
556 | 556 | if (tep_db_num_rows($checkTable) > 0) { |
557 | - tep_db_query("drop table " . TABLE_PAGANTIS_CONCURRENCY); |
|
557 | + tep_db_query("drop table ".TABLE_PAGANTIS_CONCURRENCY); |
|
558 | 558 | } |
559 | 559 | |
560 | - tep_db_query("DELETE FROM ". TABLE_CONFIGURATION ." where configuration_key in ('MODULE_PAYMENT_PAGANTIS_STATUS','MODULE_PAYMENT_PAGANTIS_PK','MODULE_PAYMENT_PAGANTIS_SK')"); |
|
560 | + tep_db_query("DELETE FROM ".TABLE_CONFIGURATION." where configuration_key in ('MODULE_PAYMENT_PAGANTIS_STATUS','MODULE_PAYMENT_PAGANTIS_PK','MODULE_PAYMENT_PAGANTIS_SK')"); |
|
561 | 561 | |
562 | - $query = "delete from " . TABLE_CONFIGURATION . " where configuration_key like '%_PAGANTIS_%'"; |
|
562 | + $query = "delete from ".TABLE_CONFIGURATION." where configuration_key like '%_PAGANTIS_%'"; |
|
563 | 563 | tep_db_query($query); |
564 | 564 | |
565 | 565 | $this->uninstallSimulator(); |
@@ -614,13 +614,13 @@ discard block |
||
614 | 614 | */ |
615 | 615 | private function insertRow($orderId, $pagantisOrderId, $globalVars) |
616 | 616 | { |
617 | - $query = "select * from " . TABLE_PAGANTIS_ORDERS . " where os_order_reference='$orderId'"; |
|
617 | + $query = "select * from ".TABLE_PAGANTIS_ORDERS." where os_order_reference='$orderId'"; |
|
618 | 618 | $resultsSelect = tep_db_query($query); |
619 | 619 | $countResults = tep_db_num_rows($resultsSelect); |
620 | 620 | if ($countResults == 0) { |
621 | - $query = "INSERT INTO " . TABLE_PAGANTIS_ORDERS . " |
|
621 | + $query = "INSERT INTO ".TABLE_PAGANTIS_ORDERS." |
|
622 | 622 | (os_order_reference, pagantis_order_id, globals) values ('$orderId', '$pagantisOrderId','$globalVars')"; |
623 | - } else { |
|
623 | + }else { |
|
624 | 624 | $query = "UPDATE ".TABLE_PAGANTIS_ORDERS." set pagantis_order_id='$pagantisOrderId' |
625 | 625 | where os_order_reference='$orderId'"; |
626 | 626 | } |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | |
659 | 659 | if ($this->extraConfig['PAGANTIS_PROMOTION'] == '') { |
660 | 660 | $promotedProducts = array(); |
661 | - } else { |
|
661 | + }else { |
|
662 | 662 | $promotedProducts = array_values((array)unserialize($this->extraConfig['PAGANTIS_PROMOTION'])); |
663 | 663 | } |
664 | 664 | |
@@ -671,13 +671,13 @@ discard block |
||
671 | 671 | private function getDescription() |
672 | 672 | { |
673 | 673 | $descriptionCode = "<img src=\"images/icon_info.gif\" border=\"0\" alt=\"Info\" title=\"Info\"> <strong>Module version:</strong> $this->version<br/><br/>"; |
674 | - $descriptionCode.= "<img src=\"images/icon_info.gif\" border=\"0\"> <a href='https://developer.pagantis.com/' target=\"_blank\" style=\"text-decoration: underline; font-weight: bold;\">View Online Documentation</a><br/><br/>"; |
|
675 | - $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/>"; |
|
674 | + $descriptionCode .= "<img src=\"images/icon_info.gif\" border=\"0\"> <a href='https://developer.pagantis.com/' target=\"_blank\" style=\"text-decoration: underline; font-weight: bold;\">View Online Documentation</a><br/><br/>"; |
|
675 | + $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/>"; |
|
676 | 676 | |
677 | 677 | if (MODULE_PAYMENT_PAGANTIS_STATUS == 'True') { |
678 | 678 | $pagantisPromotionUrl = $this->base_url.'/admin/promotion.php'; |
679 | 679 | $linkDescription = "Si deseas ofrecer financiación sin intereses para alguno de tus productos "; |
680 | - $descriptionCode.= "<img src='images/icon_info.gif' border='0'/> $linkDescription<a href='$pagantisPromotionUrl' style='text-decoration: underline; font-weight: bold;'>haz click aquí</a>"; |
|
680 | + $descriptionCode .= "<img src='images/icon_info.gif' border='0'/> $linkDescription<a href='$pagantisPromotionUrl' style='text-decoration: underline; font-weight: bold;'>haz click aquí</a>"; |
|
681 | 681 | } |
682 | 682 | |
683 | 683 | return $descriptionCode; |
@@ -688,18 +688,18 @@ discard block |
||
688 | 688 | */ |
689 | 689 | private function installSimulator() |
690 | 690 | { |
691 | - $checkSimulator = tep_db_query("select configuration_key, configuration_value from " .TABLE_CONFIGURATION ." |
|
691 | + $checkSimulator = tep_db_query("select configuration_key, configuration_value from ".TABLE_CONFIGURATION." |
|
692 | 692 | where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED' |
693 | 693 | and configuration_value like '%ht_pagantis.php%';"); |
694 | 694 | if (tep_db_num_rows($checkSimulator) > 0) { |
695 | 695 | return true; |
696 | 696 | } |
697 | 697 | |
698 | - $query = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = concat(configuration_value, ';ht_pagantis.php') |
|
698 | + $query = "UPDATE ".TABLE_CONFIGURATION." set configuration_value = concat(configuration_value, ';ht_pagantis.php') |
|
699 | 699 | where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'"; |
700 | 700 | tep_db_query($query); |
701 | 701 | |
702 | - 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())"); |
|
702 | + 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())"); |
|
703 | 703 | } |
704 | 704 | |
705 | 705 | /** |
@@ -707,18 +707,18 @@ discard block |
||
707 | 707 | */ |
708 | 708 | private function uninstallSimulator() |
709 | 709 | { |
710 | - $checkSimulator = tep_db_query("select configuration_key, configuration_value from " .TABLE_CONFIGURATION ." |
|
710 | + $checkSimulator = tep_db_query("select configuration_key, configuration_value from ".TABLE_CONFIGURATION." |
|
711 | 711 | where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED' |
712 | 712 | and configuration_value like '%ht_pagantis.php%';"); |
713 | 713 | if (tep_db_num_rows($checkSimulator) == 0) { |
714 | 714 | return true; |
715 | 715 | } |
716 | 716 | |
717 | - $query = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = REPLACE(configuration_value, ';ht_pagantis.php', '') |
|
717 | + $query = "UPDATE ".TABLE_CONFIGURATION." set configuration_value = REPLACE(configuration_value, ';ht_pagantis.php', '') |
|
718 | 718 | where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'"; |
719 | 719 | tep_db_query($query); |
720 | 720 | |
721 | - $query = "delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_HEADER_TAGS_PAGANTIS_STATUS'"; |
|
721 | + $query = "delete from ".TABLE_CONFIGURATION." where configuration_key = 'MODULE_HEADER_TAGS_PAGANTIS_STATUS'"; |
|
722 | 722 | tep_db_query($query); |
723 | 723 | } |
724 | 724 | |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | private function insertLog($exception) |
729 | 729 | { |
730 | 730 | if ($exception instanceof \Exception) { |
731 | - $logEntry= new LogEntry(); |
|
731 | + $logEntry = new LogEntry(); |
|
732 | 732 | $logEntryJson = $logEntry->error($exception)->toJson(); |
733 | 733 | |
734 | 734 | $query = "insert into ".TABLE_PAGANTIS_LOG."(log) values ($logEntryJson)"; |
@@ -35,7 +35,7 @@ discard block |
||
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 |
||
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']; |
@@ -88,29 +88,29 @@ discard block |
||
88 | 88 | $checkoutPage = strpos($_SERVER[REQUEST_URI], "checkout_payment.php") > 0; |
89 | 89 | |
90 | 90 | //Show promoted html |
91 | - if ($this->isPromoted($productId) && $checkoutPage!='1') { |
|
91 | + if ($this->isPromoted($productId) && $checkoutPage != '1') { |
|
92 | 92 | echo "<div id='promotedText' style='display:none'><br/>".$this->extraConfig['PAGANTIS_PROMOTED_PRODUCT_CODE']."</div>"; |
93 | - echo '<script>'. PHP_EOL; |
|
94 | - echo ' function loadPromoted()'. PHP_EOL; |
|
95 | - echo ' {'. PHP_EOL; |
|
96 | - echo 'var positionSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR']. '\';'. PHP_EOL; |
|
97 | - echo 'if (positionSelector === \'default\') {'. PHP_EOL; |
|
98 | - echo 'positionSelector = \'.buttonSet\''. PHP_EOL; |
|
99 | - echo '}'. PHP_EOL; |
|
93 | + echo '<script>'.PHP_EOL; |
|
94 | + echo ' function loadPromoted()'.PHP_EOL; |
|
95 | + echo ' {'.PHP_EOL; |
|
96 | + echo 'var positionSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'].'\';'.PHP_EOL; |
|
97 | + echo 'if (positionSelector === \'default\') {'.PHP_EOL; |
|
98 | + echo 'positionSelector = \'.buttonSet\''.PHP_EOL; |
|
99 | + echo '}'.PHP_EOL; |
|
100 | 100 | echo 'var docFather = document.querySelector(positionSelector);'.PHP_EOL; |
101 | - echo 'if (typeof docFather != \'undefined\') {'. PHP_EOL; |
|
101 | + echo 'if (typeof docFather != \'undefined\') {'.PHP_EOL; |
|
102 | 102 | echo 'var promotedNode = document.getElementById("promotedText");'.PHP_EOL; |
103 | 103 | echo 'docFather.appendChild(promotedNode);'.PHP_EOL; |
104 | - echo 'promotedNode.style.display=""' . PHP_EOL; |
|
105 | - echo ' clearInterval(window.OSPromotedId);'. PHP_EOL; |
|
106 | - echo ' return true;'. PHP_EOL; |
|
107 | - echo ' }'. PHP_EOL; |
|
108 | - echo ' return false;'. PHP_EOL; |
|
109 | - echo ' }'. PHP_EOL; |
|
110 | - echo ' window.OSPromotedId = setInterval(function () {'. PHP_EOL; |
|
111 | - echo ' loadPromoted();'. PHP_EOL; |
|
112 | - echo ' }, 2000);'. PHP_EOL; |
|
113 | - echo '</script>'. PHP_EOL; |
|
104 | + echo 'promotedNode.style.display=""'.PHP_EOL; |
|
105 | + echo ' clearInterval(window.OSPromotedId);'.PHP_EOL; |
|
106 | + echo ' return true;'.PHP_EOL; |
|
107 | + echo ' }'.PHP_EOL; |
|
108 | + echo ' return false;'.PHP_EOL; |
|
109 | + echo ' }'.PHP_EOL; |
|
110 | + echo ' window.OSPromotedId = setInterval(function () {'.PHP_EOL; |
|
111 | + echo ' loadPromoted();'.PHP_EOL; |
|
112 | + echo ' }, 2000);'.PHP_EOL; |
|
113 | + echo '</script>'.PHP_EOL; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | if (isset($productId) || $checkoutPage) { |
@@ -129,102 +129,102 @@ discard block |
||
129 | 129 | $productId = array_shift($productId); |
130 | 130 | $promotedProduct = $this->isPromoted($productId); |
131 | 131 | if ($promotedProduct) { |
132 | - $promotedAmount+=number_format(($item['price'] * $item['qty']), 2); |
|
132 | + $promotedAmount += number_format(($item['price'] * $item['qty']), 2); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | - echo "<script src='".$this->sdkFile."'></script>". PHP_EOL; |
|
137 | - echo '<script>'. PHP_EOL; |
|
138 | - echo ' function loadSimulator()'. PHP_EOL; |
|
139 | - echo ' {'. PHP_EOL; |
|
140 | - echo ' if (typeof '.$simulatorCode.' != \'undefined\') {'. PHP_EOL; |
|
141 | - echo ' var positionSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR']. '\';'. PHP_EOL; |
|
142 | - echo ' var priceSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']. '\';'. PHP_EOL; |
|
143 | - echo ' var checkoutPriceSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']. '\';'. PHP_EOL; |
|
144 | - echo ' var quantitySelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR']. '\';'. PHP_EOL; |
|
145 | - echo ' var checkoutPage = \'' . $checkoutPage.'\';'. PHP_EOL; |
|
146 | - echo ' var promotedAmount = \'' . $promotedAmount.'\';'. PHP_EOL; |
|
147 | - echo ' var langCode = \'' . $this->langCode.'\';'. PHP_EOL; |
|
148 | - |
|
149 | - echo ' if (positionSelector === \'default\') {'. PHP_EOL; |
|
150 | - echo ' positionSelector = \'.buttonSet\''. PHP_EOL; |
|
151 | - echo ' }'. PHP_EOL; |
|
152 | - |
|
153 | - echo ' if (priceSelector === \'default\') {'. PHP_EOL; |
|
154 | - echo ' priceSelector = \'#bodyContent>form>div>h1\''. PHP_EOL; |
|
155 | - echo ' }'. PHP_EOL; |
|
156 | - |
|
157 | - echo ' if (checkoutPriceSelector == \'default\' && checkoutPage == \'1\') {'. PHP_EOL; |
|
158 | - echo ' priceSelector = \'#columnRight > .infoBoxContainer > .infoBoxContents > tbody > tr:last-child > td\';'. PHP_EOL; |
|
159 | - echo ' }'. PHP_EOL; |
|
160 | - echo ' '.$simulatorCode.'.product_simulator = {};'. PHP_EOL; |
|
161 | - echo ' '.$simulatorCode.'.product_simulator.id = \'product-simulator\';'. PHP_EOL; |
|
162 | - echo ' '.$simulatorCode.'.product_simulator.publicKey = \'' . $this->pk . '\';'. PHP_EOL; |
|
163 | - echo ' '.$simulatorCode.'.product_simulator.selector = positionSelector;'. PHP_EOL; |
|
164 | - echo ' '.$simulatorCode.'.product_simulator.numInstalments = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'] . '\';'. PHP_EOL; |
|
165 | - echo ' '.$simulatorCode.'.product_simulator.type = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'] . ';'. PHP_EOL; |
|
166 | - echo ' '.$simulatorCode.'.product_simulator.skin = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'] . ';'. PHP_EOL; |
|
167 | - echo ' '.$simulatorCode.'.product_simulator.position = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'] . ';'. PHP_EOL; |
|
136 | + echo "<script src='".$this->sdkFile."'></script>".PHP_EOL; |
|
137 | + echo '<script>'.PHP_EOL; |
|
138 | + echo ' function loadSimulator()'.PHP_EOL; |
|
139 | + echo ' {'.PHP_EOL; |
|
140 | + echo ' if (typeof '.$simulatorCode.' != \'undefined\') {'.PHP_EOL; |
|
141 | + echo ' var positionSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'].'\';'.PHP_EOL; |
|
142 | + echo ' var priceSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'].'\';'.PHP_EOL; |
|
143 | + echo ' var checkoutPriceSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'].'\';'.PHP_EOL; |
|
144 | + echo ' var quantitySelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'].'\';'.PHP_EOL; |
|
145 | + echo ' var checkoutPage = \''.$checkoutPage.'\';'.PHP_EOL; |
|
146 | + echo ' var promotedAmount = \''.$promotedAmount.'\';'.PHP_EOL; |
|
147 | + echo ' var langCode = \''.$this->langCode.'\';'.PHP_EOL; |
|
148 | + |
|
149 | + echo ' if (positionSelector === \'default\') {'.PHP_EOL; |
|
150 | + echo ' positionSelector = \'.buttonSet\''.PHP_EOL; |
|
151 | + echo ' }'.PHP_EOL; |
|
152 | + |
|
153 | + echo ' if (priceSelector === \'default\') {'.PHP_EOL; |
|
154 | + echo ' priceSelector = \'#bodyContent>form>div>h1\''.PHP_EOL; |
|
155 | + echo ' }'.PHP_EOL; |
|
156 | + |
|
157 | + echo ' if (checkoutPriceSelector == \'default\' && checkoutPage == \'1\') {'.PHP_EOL; |
|
158 | + echo ' priceSelector = \'#columnRight > .infoBoxContainer > .infoBoxContents > tbody > tr:last-child > td\';'.PHP_EOL; |
|
159 | + echo ' }'.PHP_EOL; |
|
160 | + echo ' '.$simulatorCode.'.product_simulator = {};'.PHP_EOL; |
|
161 | + echo ' '.$simulatorCode.'.product_simulator.id = \'product-simulator\';'.PHP_EOL; |
|
162 | + echo ' '.$simulatorCode.'.product_simulator.publicKey = \''.$this->pk.'\';'.PHP_EOL; |
|
163 | + echo ' '.$simulatorCode.'.product_simulator.selector = positionSelector;'.PHP_EOL; |
|
164 | + echo ' '.$simulatorCode.'.product_simulator.numInstalments = \''.$this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'].'\';'.PHP_EOL; |
|
165 | + echo ' '.$simulatorCode.'.product_simulator.type = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'].';'.PHP_EOL; |
|
166 | + echo ' '.$simulatorCode.'.product_simulator.skin = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'].';'.PHP_EOL; |
|
167 | + echo ' '.$simulatorCode.'.product_simulator.position = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'].';'.PHP_EOL; |
|
168 | 168 | |
169 | 169 | //Amount in product page |
170 | - echo ' var promotedProduct = \'' . $this->isPromoted($productId) .'\';'. PHP_EOL; |
|
170 | + echo ' var promotedProduct = \''.$this->isPromoted($productId).'\';'.PHP_EOL; |
|
171 | 171 | echo ' if(checkoutPage != \'1\' ) {'; |
172 | - echo ' '.$simulatorCode.'.product_simulator.itemAmountSelector = priceSelector;'. PHP_EOL; |
|
173 | - echo ' if(promotedProduct == \'1\') { ' . PHP_EOL; |
|
174 | - echo ' '.$simulatorCode.'.product_simulator.itemPromotedAmountSelector = priceSelector;'. PHP_EOL; |
|
175 | - echo ' }' . PHP_EOL; |
|
172 | + echo ' '.$simulatorCode.'.product_simulator.itemAmountSelector = priceSelector;'.PHP_EOL; |
|
173 | + echo ' if(promotedProduct == \'1\') { '.PHP_EOL; |
|
174 | + echo ' '.$simulatorCode.'.product_simulator.itemPromotedAmountSelector = priceSelector;'.PHP_EOL; |
|
175 | + echo ' }'.PHP_EOL; |
|
176 | 176 | echo ' }'; |
177 | 177 | |
178 | 178 | //Amount in checkout page |
179 | - echo ' if(checkoutPage == \'1\' ) { ' . PHP_EOL; |
|
180 | - echo ' '.$simulatorCode.'.product_simulator.totalAmountSelector = priceSelector;'. PHP_EOL; |
|
181 | - echo ' if(promotedAmount != \'0\' && checkoutPage == \'1\' ) { ' . PHP_EOL; |
|
182 | - echo ' ' .$simulatorCode.'.product_simulator.totalPromotedAmount = promotedAmount;'. PHP_EOL; |
|
183 | - echo ' }' . PHP_EOL; |
|
184 | - echo ' }' . PHP_EOL; |
|
185 | - echo ' '.$simulatorCode.'.simulator.init('.$simulatorCode.'.product_simulator);'. PHP_EOL; |
|
186 | - echo ' clearInterval(window.OSSimulatorId);'. PHP_EOL; |
|
187 | - echo ' return true;'. PHP_EOL; |
|
188 | - echo ' }'. PHP_EOL; |
|
189 | - echo ' return false;'. PHP_EOL; |
|
190 | - echo ' }'. PHP_EOL; |
|
179 | + echo ' if(checkoutPage == \'1\' ) { '.PHP_EOL; |
|
180 | + echo ' '.$simulatorCode.'.product_simulator.totalAmountSelector = priceSelector;'.PHP_EOL; |
|
181 | + echo ' if(promotedAmount != \'0\' && checkoutPage == \'1\' ) { '.PHP_EOL; |
|
182 | + echo ' '.$simulatorCode.'.product_simulator.totalPromotedAmount = promotedAmount;'.PHP_EOL; |
|
183 | + echo ' }'.PHP_EOL; |
|
184 | + echo ' }'.PHP_EOL; |
|
185 | + echo ' '.$simulatorCode.'.simulator.init('.$simulatorCode.'.product_simulator);'.PHP_EOL; |
|
186 | + echo ' clearInterval(window.OSSimulatorId);'.PHP_EOL; |
|
187 | + echo ' return true;'.PHP_EOL; |
|
188 | + echo ' }'.PHP_EOL; |
|
189 | + echo ' return false;'.PHP_EOL; |
|
190 | + echo ' }'.PHP_EOL; |
|
191 | 191 | |
192 | 192 | //Invoke to main method |
193 | - echo ' window.OSSimulatorId = setInterval(function () {'. PHP_EOL; |
|
194 | - echo ' loadSimulator();'. PHP_EOL; |
|
195 | - echo ' }, 2000);'. PHP_EOL; |
|
196 | - echo '</script>'. PHP_EOL; |
|
193 | + echo ' window.OSSimulatorId = setInterval(function () {'.PHP_EOL; |
|
194 | + echo ' loadSimulator();'.PHP_EOL; |
|
195 | + echo ' }, 2000);'.PHP_EOL; |
|
196 | + echo '</script>'.PHP_EOL; |
|
197 | 197 | |
198 | 198 | //Checkout simulator |
199 | 199 | if ($checkoutPage) { |
200 | - echo '<script>' . PHP_EOL; |
|
201 | - |
|
202 | - echo 'function checkSelected(value)'. PHP_EOL; |
|
203 | - echo '{ '. PHP_EOL; |
|
204 | - echo 'var simulator = document.getElementsByClassName("buttonSet");' . PHP_EOL; |
|
205 | - echo ' if(simulator == "undefined") { return false; } '. PHP_EOL; |
|
206 | - echo 'var pagantisCheckbox = document.querySelector("input[value=\'pagantis\']"); ' . PHP_EOL; |
|
207 | - echo 'var grandparentNode = pagantisCheckbox.parentNode.parentNode;' . PHP_EOL; |
|
208 | - echo 'if(grandparentNode == value) { var status="" } ' . PHP_EOL; |
|
209 | - echo 'else { var status="none";} '. PHP_EOL; |
|
210 | - echo 'simulator[0].style.display=status; ' . PHP_EOL; |
|
211 | - echo '}'. PHP_EOL; |
|
212 | - |
|
213 | - echo 'function showSimulator()'. PHP_EOL; |
|
214 | - echo '{'. PHP_EOL; |
|
215 | - echo 'var elements = document.querySelectorAll("tr[class^=\'moduleRow\']");' . PHP_EOL; |
|
216 | - echo 'if(elements == null) { return false };' . PHP_EOL; |
|
200 | + echo '<script>'.PHP_EOL; |
|
201 | + |
|
202 | + echo 'function checkSelected(value)'.PHP_EOL; |
|
203 | + echo '{ '.PHP_EOL; |
|
204 | + echo 'var simulator = document.getElementsByClassName("buttonSet");'.PHP_EOL; |
|
205 | + echo ' if(simulator == "undefined") { return false; } '.PHP_EOL; |
|
206 | + echo 'var pagantisCheckbox = document.querySelector("input[value=\'pagantis\']"); '.PHP_EOL; |
|
207 | + echo 'var grandparentNode = pagantisCheckbox.parentNode.parentNode;'.PHP_EOL; |
|
208 | + echo 'if(grandparentNode == value) { var status="" } '.PHP_EOL; |
|
209 | + echo 'else { var status="none";} '.PHP_EOL; |
|
210 | + echo 'simulator[0].style.display=status; '.PHP_EOL; |
|
211 | + echo '}'.PHP_EOL; |
|
212 | + |
|
213 | + echo 'function showSimulator()'.PHP_EOL; |
|
214 | + echo '{'.PHP_EOL; |
|
215 | + echo 'var elements = document.querySelectorAll("tr[class^=\'moduleRow\']");'.PHP_EOL; |
|
216 | + echo 'if(elements == null) { return false };'.PHP_EOL; |
|
217 | 217 | echo 'for(var i = 0, max = elements.length; i < max; i++) { elements[i].onclick = function() { |
218 | 218 | checkSelected(this); |
219 | 219 | } }' . PHP_EOL; |
220 | 220 | echo 'clearInterval(window.OSdisplayId);'; |
221 | - echo 'return true;'. PHP_EOL; |
|
222 | - echo '};'. PHP_EOL; |
|
221 | + echo 'return true;'.PHP_EOL; |
|
222 | + echo '};'.PHP_EOL; |
|
223 | 223 | |
224 | - echo ' window.OSdisplayId = setInterval(function () {'. PHP_EOL; |
|
225 | - echo ' showSimulator();'. PHP_EOL; |
|
226 | - echo ' }, 2000);'. PHP_EOL; |
|
227 | - echo '</script>'. PHP_EOL; |
|
224 | + echo ' window.OSdisplayId = setInterval(function () {'.PHP_EOL; |
|
225 | + echo ' showSimulator();'.PHP_EOL; |
|
226 | + echo ' }, 2000);'.PHP_EOL; |
|
227 | + echo '</script>'.PHP_EOL; |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * install |
248 | 248 | */ |
249 | 249 | function install() { |
250 | - 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())"); |
|
250 | + 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())"); |
|
251 | 251 | |
252 | 252 | } |
253 | 253 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * remove |
256 | 256 | */ |
257 | 257 | function remove() { |
258 | - tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); |
|
258 | + tep_db_query("delete from ".TABLE_CONFIGURATION." where configuration_key in ('".implode("', '", $this->keys())."')"); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | if ($this->extraConfig['PAGANTIS_PROMOTION'] == '') { |
280 | 280 | $promotedProducts = array(); |
281 | - } else { |
|
281 | + }else { |
|
282 | 282 | $promotedProducts = array_values((array)unserialize($this->extraConfig['PAGANTIS_PROMOTION'])); |
283 | 283 | } |
284 | 284 |