@@ -10,7 +10,6 @@ |
||
10 | 10 | * @package Test\Configure |
11 | 11 | * |
12 | 12 | * @group oscommerce-configure |
13 | - |
|
14 | 13 | */ |
15 | 14 | class ConfigureTest extends AbstractConfigure |
16 | 15 | { |
@@ -10,7 +10,6 @@ |
||
10 | 10 | * @package Test\Configure |
11 | 11 | * |
12 | 12 | * @group oscommerce-configure-ppp |
13 | - |
|
14 | 13 | */ |
15 | 14 | class ConfigurePPPTest extends AbstractConfigure |
16 | 15 | { |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function loginToBackOffice() |
19 | 19 | { |
20 | - $this->webDriver->get(self::OSCURL . self::BACKOFFICE_FOLDER); |
|
20 | + $this->webDriver->get(self::OSCURL.self::BACKOFFICE_FOLDER); |
|
21 | 21 | sleep(2); |
22 | 22 | |
23 | 23 | $usernameElementSearch = WebDriverBy::name('username'); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | sleep(3); |
121 | 121 | $productLinkElement->click(); |
122 | 122 | $this->assertSame( |
123 | - self::PRODUCT_NAME . ', ' . self::TITLE, |
|
123 | + self::PRODUCT_NAME.', '.self::TITLE, |
|
124 | 124 | $this->webDriver->getTitle() |
125 | 125 | ); |
126 | 126 | } |
@@ -232,9 +232,9 @@ discard block |
||
232 | 232 | $paymentFormElement = WebDriverBy::className('FieldsPreview-desc'); |
233 | 233 | $condition = WebDriverExpectedCondition::visibilityOfElementLocated($paymentFormElement); |
234 | 234 | $this->webDriver->wait()->until($condition); |
235 | - $this->assertTrue((bool) $condition); |
|
235 | + $this->assertTrue((bool)$condition); |
|
236 | 236 | $this->assertSame( |
237 | - $this->configuration['firstname'] . ' ' . $this->configuration['lastname'], |
|
237 | + $this->configuration['firstname'].' '.$this->configuration['lastname'], |
|
238 | 238 | $this->findByClass('FieldsPreview-desc')->getText() |
239 | 239 | ); |
240 | 240 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | protected function checkPagantisOrderId() |
296 | 296 | { |
297 | - $orderId=0; |
|
297 | + $orderId = 0; |
|
298 | 298 | $notifyUrl = self::OSCURL.self::NOTIFICATION_FOLDER.'?order='.$orderId; |
299 | 299 | $this->assertNotEmpty($notifyUrl, $notifyUrl); |
300 | 300 | $response = Request::post($notifyUrl)->expects('json')->send(); |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | $this->assertEquals( |
305 | 305 | $response->body->merchant_order_id, |
306 | 306 | $orderId, |
307 | - $response->body->merchant_order_id.'!='. $orderId |
|
307 | + $response->body->merchant_order_id.'!='.$orderId |
|
308 | 308 | ); |
309 | 309 | $this->assertContains( |
310 | 310 | NoIdentificationException::ERROR_MESSAGE, |
@@ -42,23 +42,23 @@ discard block |
||
42 | 42 | public $errorLinkMessage; |
43 | 43 | |
44 | 44 | public $defaultConfigs = array('PAGANTIS_TITLE'=>'Instant Financing', |
45 | - 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE', |
|
46 | - 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE', |
|
47 | - 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
48 | - 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
49 | - 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
50 | - 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
51 | - 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER', |
|
52 | - 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
53 | - 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
54 | - 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR_CHECKOUT'=>'default', |
|
55 | - 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
56 | - 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
57 | - 'PAGANTIS_URL_OK'=>'', |
|
58 | - 'PAGANTIS_URL_KO'=>'', |
|
59 | - 'PAGANTIS_TITLE_EXTRA' => 'Paga hasta en 12 cómodas cuotas con Paga+Tarde. Solicitud totalmente online y sin papeleos,¡y la respuesta es inmediata!', |
|
60 | - 'PAGANTIS_PROMOTION' => '', |
|
61 | - 'PAGANTIS_PROMOTED_PRODUCT_CODE' => '<p>¡Financia este producto sin intereses! - 0% TAE</p>' |
|
45 | + 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE', |
|
46 | + 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE', |
|
47 | + 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
48 | + 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
49 | + 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
50 | + 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
51 | + 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER', |
|
52 | + 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
53 | + 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
54 | + 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR_CHECKOUT'=>'default', |
|
55 | + 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
56 | + 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
57 | + 'PAGANTIS_URL_OK'=>'', |
|
58 | + 'PAGANTIS_URL_KO'=>'', |
|
59 | + 'PAGANTIS_TITLE_EXTRA' => 'Paga hasta en 12 cómodas cuotas con Paga+Tarde. Solicitud totalmente online y sin papeleos,¡y la respuesta es inmediata!', |
|
60 | + 'PAGANTIS_PROMOTION' => '', |
|
61 | + 'PAGANTIS_PROMOTED_PRODUCT_CODE' => '<p>¡Financia este producto sin intereses! - 0% TAE</p>' |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | /** |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | try { |
182 | 182 | include_once('./ext/modules/payment/pagantis/vendor/autoload.php'); |
183 | 183 | global $order, $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, |
184 | - $payment, $comments, $customer_default_address_id, $cartID; |
|
184 | + $payment, $comments, $customer_default_address_id, $cartID; |
|
185 | 185 | $global_vars = array(); |
186 | 186 | $global_vars['customer_id'] = serialize($customer_id); |
187 | 187 | $global_vars['sendTo'] = serialize($sendto); |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | |
75 | 75 | if (strpos($_SERVER[REQUEST_URI], "checkout_payment.php") <= 0) { |
76 | 76 | $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_ADMIN_TITLE; // Payment module title in Admin |
77 | - } else { |
|
78 | - $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_CHECKOUT .'<br/><br/><div class="buttonSet" style="display:none"></div><br/>'; // Payment module title in Catalog |
|
77 | + }else { |
|
78 | + $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_CHECKOUT.'<br/><br/><div class="buttonSet" style="display:none"></div><br/>'; // Payment module title in Catalog |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | $this->enabled = ((MODULE_PAYMENT_PAGANTIS_STATUS == 'True') ? true : false); |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | "%s://%s%s%s", |
86 | 86 | isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', |
87 | 87 | $_SERVER['SERVER_NAME'], |
88 | - isset($_SERVER['SERVER_PORT']) ? ":" . $_SERVER['SERVER_PORT'] : '', |
|
88 | + isset($_SERVER['SERVER_PORT']) ? ":".$_SERVER['SERVER_PORT'] : '', |
|
89 | 89 | $_SERVER['REQUEST_URI'] |
90 | 90 | ) |
91 | 91 | ); |
92 | 92 | |
93 | - $this->form_action_url = $this->base_url . '/ext/modules/payment/pagantis/bypass.php'; |
|
93 | + $this->form_action_url = $this->base_url.'/ext/modules/payment/pagantis/bypass.php'; |
|
94 | 94 | |
95 | 95 | if (defined('MODULE_PAYMENT_PAGANTIS_LANG_CODE')) { |
96 | 96 | $this->langCode = strtoupper(MODULE_PAYMENT_PAGANTIS_LANG_CODE); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $userAddress = new Address(); |
212 | 212 | $userAddress |
213 | 213 | ->setZipCode($order->billing['postcode']) |
214 | - ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname']) |
|
214 | + ->setFullName($order->billing['firstname'].' '.$order->billing['lastname']) |
|
215 | 215 | ->setCountryCode('ES') |
216 | 216 | ->setCity($order->billing['city']) |
217 | 217 | ->setAddress($order->billing['street_address']) |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $orderShippingAddress = new Address(); |
226 | 226 | $orderShippingAddress |
227 | 227 | ->setZipCode($order->delivery['postcode']) |
228 | - ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname']) |
|
228 | + ->setFullName($order->billing['firstname'].' '.$order->billing['lastname']) |
|
229 | 229 | ->setCountryCode('ES') |
230 | 230 | ->setCity($order->delivery['city']) |
231 | 231 | ->setAddress($order->delivery['street_address']) |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $orderUser = new \Pagantis\OrdersApiClient\Model\Order\User(); |
236 | 236 | $orderUser |
237 | 237 | ->setAddress($userAddress) |
238 | - ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname']) |
|
238 | + ->setFullName($order->billing['firstname'].' '.$order->billing['lastname']) |
|
239 | 239 | ->setBillingAddress($orderBillingAddress) |
240 | 240 | ->setEmail($order->customer['email_address']) |
241 | 241 | ->setFixPhone($order->customer['telephone']) |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | ->setQuantity(intval($item['qty'])) |
277 | 277 | ->setDescription($item['name']); |
278 | 278 | if ($promotedProduct) { |
279 | - $promotedAmount+=$product->getAmount(); |
|
279 | + $promotedAmount += $product->getAmount(); |
|
280 | 280 | $promotedMessage = $product->getDescription()."-Price:".$item['final_price']."-Qty:".$product->getQuantity(); |
281 | 281 | $metadataOrder->addMetadata('promotedProduct', $promotedMessage); |
282 | 282 | } |
@@ -296,9 +296,9 @@ discard block |
||
296 | 296 | ); |
297 | 297 | |
298 | 298 | $cancelUrl = trim(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL', false)); |
299 | - if ($this->extraConfig['PAGANTIS_URL_KO']!='') { |
|
299 | + if ($this->extraConfig['PAGANTIS_URL_KO'] != '') { |
|
300 | 300 | $koUrl = $this->extraConfig['PAGANTIS_URL_KO']; |
301 | - } else { |
|
301 | + }else { |
|
302 | 302 | $koUrl = $cancelUrl; |
303 | 303 | } |
304 | 304 | |
@@ -336,25 +336,25 @@ discard block |
||
336 | 336 | if ($pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) { |
337 | 337 | $url = $pagantisOrder->getActionUrls()->getForm(); |
338 | 338 | $this->insertRow($this->os_order_reference, $pagantisOrder->getId(), serialize($global_vars)); |
339 | - } else { |
|
339 | + }else { |
|
340 | 340 | throw new OrderNotFoundException(); |
341 | 341 | } |
342 | 342 | |
343 | 343 | if ($url == "") { |
344 | 344 | throw new UnknownException(_("No ha sido posible obtener una respuesta de Pagantis")); |
345 | - } else { |
|
345 | + }else { |
|
346 | 346 | $output = "\n"; |
347 | - $output .= tep_draw_hidden_field("formUrl", $url) . "\n"; |
|
348 | - $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl) . "\n"; |
|
347 | + $output .= tep_draw_hidden_field("formUrl", $url)."\n"; |
|
348 | + $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl)."\n"; |
|
349 | 349 | return $output; |
350 | 350 | |
351 | 351 | } //TODO IFRAME |
352 | 352 | } catch (\Exception $exception) { |
353 | 353 | $this->insertLog($exception); |
354 | 354 | $output = "\n"; |
355 | - $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl) . "\n"; |
|
356 | - $output .= tep_draw_hidden_field("errorMessage", $exception->getMessage()) . "\n"; |
|
357 | - $output .= tep_draw_hidden_field("errorCode", $exception->getCode()) . "\n"; |
|
355 | + $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl)."\n"; |
|
356 | + $output .= tep_draw_hidden_field("errorMessage", $exception->getMessage())."\n"; |
|
357 | + $output .= tep_draw_hidden_field("errorCode", $exception->getCode())."\n"; |
|
358 | 358 | $output .= "<p>".$this->errorMessage.", <a href='$cancelUrl' style='text-decoration:underline'><b>"; |
359 | 359 | $output .= $this->errorLinkMessage." </b></a></p>"; |
360 | 360 | |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | return 'failed'; |
419 | 419 | } |
420 | 420 | |
421 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " |
|
421 | + tep_db_query("insert into ".TABLE_CONFIGURATION." |
|
422 | 422 | ( |
423 | 423 | configuration_title, |
424 | 424 | configuration_key, |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | ', |
442 | 442 | now() |
443 | 443 | )"); |
444 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " |
|
444 | + tep_db_query("insert into ".TABLE_CONFIGURATION." |
|
445 | 445 | ( |
446 | 446 | configuration_title, |
447 | 447 | configuration_key, |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | '0', |
462 | 462 | now() |
463 | 463 | )"); |
464 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " |
|
464 | + tep_db_query("insert into ".TABLE_CONFIGURATION." |
|
465 | 465 | ( |
466 | 466 | configuration_title, |
467 | 467 | configuration_key, |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | '0', |
482 | 482 | now() |
483 | 483 | )"); |
484 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " |
|
484 | + tep_db_query("insert into ".TABLE_CONFIGURATION." |
|
485 | 485 | ( |
486 | 486 | configuration_title, |
487 | 487 | configuration_key, |
@@ -513,14 +513,14 @@ discard block |
||
513 | 513 | */ |
514 | 514 | private function installPagantisTables() |
515 | 515 | { |
516 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_LOG . " ( |
|
516 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_LOG." ( |
|
517 | 517 | id int NOT NULL AUTO_INCREMENT, |
518 | 518 | log text NOT NULL, |
519 | 519 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, |
520 | 520 | UNIQUE KEY id (id))"; |
521 | 521 | tep_db_query($sql); |
522 | 522 | |
523 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONFIG . " ( |
|
523 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONFIG." ( |
|
524 | 524 | id int NOT NULL AUTO_INCREMENT, |
525 | 525 | config varchar(60) NOT NULL, |
526 | 526 | value varchar(200) NOT NULL, |
@@ -528,10 +528,10 @@ discard block |
||
528 | 528 | tep_db_query($sql); |
529 | 529 | |
530 | 530 | // check if table has records |
531 | - $check_query = tep_db_query("select value from " . TABLE_PAGANTIS_CONFIG); |
|
531 | + $check_query = tep_db_query("select value from ".TABLE_PAGANTIS_CONFIG); |
|
532 | 532 | if (tep_db_num_rows($check_query) === 0) { |
533 | 533 | foreach ((array)$this->defaultConfigs as $configKey => $configValue) { |
534 | - $query = "INSERT INTO " . TABLE_PAGANTIS_CONFIG . " |
|
534 | + $query = "INSERT INTO ".TABLE_PAGANTIS_CONFIG." |
|
535 | 535 | ( |
536 | 536 | config, |
537 | 537 | value |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | } |
546 | 546 | } |
547 | 547 | |
548 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_ORDERS . " ( |
|
548 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_ORDERS." ( |
|
549 | 549 | id int NOT NULL AUTO_INCREMENT, |
550 | 550 | os_order_id varchar(50), |
551 | 551 | os_order_reference varchar(50) NOT NULL, |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | UNIQUE KEY id(id))"; |
555 | 555 | tep_db_query($sql); |
556 | 556 | |
557 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONCURRENCY . " ( |
|
557 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONCURRENCY." ( |
|
558 | 558 | id varchar(50) NOT NULL, |
559 | 559 | `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, |
560 | 560 | UNIQUE KEY id(id))"; |
@@ -566,29 +566,29 @@ discard block |
||
566 | 566 | */ |
567 | 567 | public function remove() |
568 | 568 | { |
569 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_LOG . "'"); |
|
569 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_LOG."'"); |
|
570 | 570 | if (tep_db_num_rows($checkTable) > 0) { |
571 | - tep_db_query("drop table " . TABLE_PAGANTIS_LOG); |
|
571 | + tep_db_query("drop table ".TABLE_PAGANTIS_LOG); |
|
572 | 572 | } |
573 | 573 | |
574 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONFIG . "'"); |
|
574 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONFIG."'"); |
|
575 | 575 | if (tep_db_num_rows($checkTable) > 0) { |
576 | - tep_db_query("drop table " . TABLE_PAGANTIS_CONFIG); |
|
576 | + tep_db_query("drop table ".TABLE_PAGANTIS_CONFIG); |
|
577 | 577 | } |
578 | 578 | |
579 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_ORDERS . "'"); |
|
579 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_ORDERS."'"); |
|
580 | 580 | if (tep_db_num_rows($checkTable) > 0) { |
581 | - tep_db_query("drop table " . TABLE_PAGANTIS_ORDERS); |
|
581 | + tep_db_query("drop table ".TABLE_PAGANTIS_ORDERS); |
|
582 | 582 | } |
583 | 583 | |
584 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONCURRENCY . "'"); |
|
584 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONCURRENCY."'"); |
|
585 | 585 | if (tep_db_num_rows($checkTable) > 0) { |
586 | - tep_db_query("drop table " . TABLE_PAGANTIS_CONCURRENCY); |
|
586 | + tep_db_query("drop table ".TABLE_PAGANTIS_CONCURRENCY); |
|
587 | 587 | } |
588 | 588 | |
589 | - tep_db_query("DELETE FROM ". TABLE_CONFIGURATION ." where configuration_key in ('MODULE_PAYMENT_PAGANTIS_STATUS','MODULE_PAYMENT_PAGANTIS_PK','MODULE_PAYMENT_PAGANTIS_SK')"); |
|
589 | + tep_db_query("DELETE FROM ".TABLE_CONFIGURATION." where configuration_key in ('MODULE_PAYMENT_PAGANTIS_STATUS','MODULE_PAYMENT_PAGANTIS_PK','MODULE_PAYMENT_PAGANTIS_SK')"); |
|
590 | 590 | |
591 | - $query = "delete from " . TABLE_CONFIGURATION . " where configuration_key like '%_PAGANTIS_%'"; |
|
591 | + $query = "delete from ".TABLE_CONFIGURATION." where configuration_key like '%_PAGANTIS_%'"; |
|
592 | 592 | tep_db_query($query); |
593 | 593 | |
594 | 594 | $this->uninstallSimulator(); |
@@ -643,13 +643,13 @@ discard block |
||
643 | 643 | */ |
644 | 644 | private function insertRow($orderId, $pagantisOrderId, $globalVars) |
645 | 645 | { |
646 | - $query = "select * from " . TABLE_PAGANTIS_ORDERS . " where os_order_reference='$orderId'"; |
|
646 | + $query = "select * from ".TABLE_PAGANTIS_ORDERS." where os_order_reference='$orderId'"; |
|
647 | 647 | $resultsSelect = tep_db_query($query); |
648 | 648 | $countResults = tep_db_num_rows($resultsSelect); |
649 | 649 | if ($countResults == 0) { |
650 | - $query = "INSERT INTO " . TABLE_PAGANTIS_ORDERS . " |
|
650 | + $query = "INSERT INTO ".TABLE_PAGANTIS_ORDERS." |
|
651 | 651 | (os_order_reference, pagantis_order_id, globals) values ('$orderId', '$pagantisOrderId','$globalVars')"; |
652 | - } else { |
|
652 | + }else { |
|
653 | 653 | $query = "UPDATE ".TABLE_PAGANTIS_ORDERS." set pagantis_order_id='$pagantisOrderId' |
654 | 654 | where os_order_reference='$orderId'"; |
655 | 655 | } |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | |
688 | 688 | if ($this->extraConfig['PAGANTIS_PROMOTION'] == '') { |
689 | 689 | $promotedProducts = array(); |
690 | - } else { |
|
690 | + }else { |
|
691 | 691 | $promotedProducts = array_values((array)unserialize($this->extraConfig['PAGANTIS_PROMOTION'])); |
692 | 692 | } |
693 | 693 | |
@@ -700,13 +700,13 @@ discard block |
||
700 | 700 | private function getDescription() |
701 | 701 | { |
702 | 702 | $descriptionCode = "<img src=\"images/icon_info.gif\" border=\"0\" alt=\"Info\" title=\"Info\"> <strong>Module version:</strong> $this->version<br/><br/>"; |
703 | - $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/>"; |
|
704 | - $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/>"; |
|
703 | + $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/>"; |
|
704 | + $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/>"; |
|
705 | 705 | |
706 | 706 | if (MODULE_PAYMENT_PAGANTIS_STATUS == 'True') { |
707 | 707 | $pagantisPromotionUrl = $this->base_url.'/admin/promotion.php'; |
708 | 708 | $linkDescription = "Si deseas ofrecer financiación sin intereses para alguno de tus productos "; |
709 | - $descriptionCode.= "<img src='images/icon_info.gif' border='0'/> $linkDescription<a href='$pagantisPromotionUrl' style='text-decoration: underline; font-weight: bold;'>haz click aquí</a>"; |
|
709 | + $descriptionCode .= "<img src='images/icon_info.gif' border='0'/> $linkDescription<a href='$pagantisPromotionUrl' style='text-decoration: underline; font-weight: bold;'>haz click aquí</a>"; |
|
710 | 710 | } |
711 | 711 | |
712 | 712 | return $descriptionCode; |
@@ -717,18 +717,18 @@ discard block |
||
717 | 717 | */ |
718 | 718 | private function installSimulator() |
719 | 719 | { |
720 | - $checkSimulator = tep_db_query("select configuration_key, configuration_value from " .TABLE_CONFIGURATION ." |
|
720 | + $checkSimulator = tep_db_query("select configuration_key, configuration_value from ".TABLE_CONFIGURATION." |
|
721 | 721 | where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED' |
722 | 722 | and configuration_value like '%ht_pagantis.php%';"); |
723 | 723 | if (tep_db_num_rows($checkSimulator) > 0) { |
724 | 724 | return true; |
725 | 725 | } |
726 | 726 | |
727 | - $query = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = concat(configuration_value, ';ht_pagantis.php') |
|
727 | + $query = "UPDATE ".TABLE_CONFIGURATION." set configuration_value = concat(configuration_value, ';ht_pagantis.php') |
|
728 | 728 | where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'"; |
729 | 729 | tep_db_query($query); |
730 | 730 | |
731 | - 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())"); |
|
731 | + 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())"); |
|
732 | 732 | } |
733 | 733 | |
734 | 734 | /** |
@@ -736,18 +736,18 @@ discard block |
||
736 | 736 | */ |
737 | 737 | private function uninstallSimulator() |
738 | 738 | { |
739 | - $checkSimulator = tep_db_query("select configuration_key, configuration_value from " .TABLE_CONFIGURATION ." |
|
739 | + $checkSimulator = tep_db_query("select configuration_key, configuration_value from ".TABLE_CONFIGURATION." |
|
740 | 740 | where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED' |
741 | 741 | and configuration_value like '%ht_pagantis.php%';"); |
742 | 742 | if (tep_db_num_rows($checkSimulator) == 0) { |
743 | 743 | return true; |
744 | 744 | } |
745 | 745 | |
746 | - $query = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = REPLACE(configuration_value, ';ht_pagantis.php', '') |
|
746 | + $query = "UPDATE ".TABLE_CONFIGURATION." set configuration_value = REPLACE(configuration_value, ';ht_pagantis.php', '') |
|
747 | 747 | where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'"; |
748 | 748 | tep_db_query($query); |
749 | 749 | |
750 | - $query = "delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_HEADER_TAGS_PAGANTIS_STATUS'"; |
|
750 | + $query = "delete from ".TABLE_CONFIGURATION." where configuration_key = 'MODULE_HEADER_TAGS_PAGANTIS_STATUS'"; |
|
751 | 751 | tep_db_query($query); |
752 | 752 | } |
753 | 753 | |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | private function insertLog($exception) |
758 | 758 | { |
759 | 759 | if ($exception instanceof \Exception) { |
760 | - $logEntry= new LogEntry(); |
|
760 | + $logEntry = new LogEntry(); |
|
761 | 761 | $logEntryJson = $logEntry->error($exception)->toJson(); |
762 | 762 | $logEntryJson = addslashes($logEntryJson); |
763 | 763 | |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | return $order->customer['national_id']; |
777 | 777 | } elseif (isset($order->billing['piva'])) { |
778 | 778 | return $order->billing['piva']; |
779 | - } else { |
|
779 | + }else { |
|
780 | 780 | return null; |
781 | 781 | } |
782 | 782 | } |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | return $order->customer['tax_id']; |
792 | 792 | } elseif (isset($order->billing['cf'])) { |
793 | 793 | return $order->billing['cf']; |
794 | - } else { |
|
794 | + }else { |
|
795 | 795 | return null; |
796 | 796 | } |
797 | 797 | } |
@@ -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) { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'] = 'pmtSDK.simulator.types.SIMPLE'; |
121 | 121 | $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'] = 'pmtSDK.simulator.skins.BLUE'; |
122 | 122 | $simulatorCode = 'pmtSDK'; |
123 | - } else { |
|
123 | + }else { |
|
124 | 124 | return true; |
125 | 125 | } |
126 | 126 | |
@@ -131,102 +131,102 @@ discard block |
||
131 | 131 | $productId = array_shift($productId); |
132 | 132 | $promotedProduct = $this->isPromoted($productId); |
133 | 133 | if ($promotedProduct) { |
134 | - $promotedAmount+=number_format(($item['price'] * $item['qty']), 2); |
|
134 | + $promotedAmount += number_format(($item['price'] * $item['qty']), 2); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
138 | - echo "<script src='".$this->sdkFile."'></script>". PHP_EOL; |
|
139 | - echo '<script>'. PHP_EOL; |
|
140 | - echo ' function loadSimulator()'. PHP_EOL; |
|
141 | - echo ' {'. PHP_EOL; |
|
142 | - echo ' if (typeof '.$simulatorCode.' != \'undefined\') {'. PHP_EOL; |
|
143 | - echo ' var positionSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR']. '\';'. PHP_EOL; |
|
144 | - echo ' var priceSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']. '\';'. PHP_EOL; |
|
145 | - echo ' var checkoutPriceSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']. '\';'. PHP_EOL; |
|
146 | - echo ' var quantitySelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR']. '\';'. PHP_EOL; |
|
147 | - echo ' var checkoutPage = \'' . $checkoutPage.'\';'. PHP_EOL; |
|
148 | - echo ' var promotedAmount = \'' . $promotedAmount.'\';'. PHP_EOL; |
|
149 | - echo ' var langCode = \'' . $this->langCode.'\';'. PHP_EOL; |
|
150 | - |
|
151 | - echo ' if (positionSelector === \'default\') {'. PHP_EOL; |
|
152 | - echo ' positionSelector = \'.buttonSet\''. PHP_EOL; |
|
153 | - echo ' }'. PHP_EOL; |
|
154 | - |
|
155 | - echo ' if (priceSelector === \'default\') {'. PHP_EOL; |
|
156 | - echo ' priceSelector = \'#bodyContent>form>div>h1\''. PHP_EOL; |
|
157 | - echo ' }'. PHP_EOL; |
|
158 | - |
|
159 | - echo ' if (checkoutPriceSelector == \'default\' && checkoutPage == \'1\') {'. PHP_EOL; |
|
160 | - echo ' priceSelector = \'#columnRight > .infoBoxContainer > .infoBoxContents > tbody > tr:last-child > td\';'. PHP_EOL; |
|
161 | - echo ' }'. PHP_EOL; |
|
162 | - echo ' '.$simulatorCode.'.product_simulator = {};'. PHP_EOL; |
|
163 | - echo ' '.$simulatorCode.'.product_simulator.id = \'product-simulator\';'. PHP_EOL; |
|
164 | - echo ' '.$simulatorCode.'.product_simulator.publicKey = \'' . $this->pk . '\';'. PHP_EOL; |
|
165 | - echo ' '.$simulatorCode.'.product_simulator.selector = positionSelector;'. PHP_EOL; |
|
166 | - echo ' '.$simulatorCode.'.product_simulator.numInstalments = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'] . '\';'. PHP_EOL; |
|
167 | - echo ' '.$simulatorCode.'.product_simulator.type = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'] . ';'. PHP_EOL; |
|
168 | - echo ' '.$simulatorCode.'.product_simulator.skin = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'] . ';'. PHP_EOL; |
|
169 | - echo ' '.$simulatorCode.'.product_simulator.position = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'] . ';'. PHP_EOL; |
|
138 | + echo "<script src='".$this->sdkFile."'></script>".PHP_EOL; |
|
139 | + echo '<script>'.PHP_EOL; |
|
140 | + echo ' function loadSimulator()'.PHP_EOL; |
|
141 | + echo ' {'.PHP_EOL; |
|
142 | + echo ' if (typeof '.$simulatorCode.' != \'undefined\') {'.PHP_EOL; |
|
143 | + echo ' var positionSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'].'\';'.PHP_EOL; |
|
144 | + echo ' var priceSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'].'\';'.PHP_EOL; |
|
145 | + echo ' var checkoutPriceSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'].'\';'.PHP_EOL; |
|
146 | + echo ' var quantitySelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'].'\';'.PHP_EOL; |
|
147 | + echo ' var checkoutPage = \''.$checkoutPage.'\';'.PHP_EOL; |
|
148 | + echo ' var promotedAmount = \''.$promotedAmount.'\';'.PHP_EOL; |
|
149 | + echo ' var langCode = \''.$this->langCode.'\';'.PHP_EOL; |
|
150 | + |
|
151 | + echo ' if (positionSelector === \'default\') {'.PHP_EOL; |
|
152 | + echo ' positionSelector = \'.buttonSet\''.PHP_EOL; |
|
153 | + echo ' }'.PHP_EOL; |
|
154 | + |
|
155 | + echo ' if (priceSelector === \'default\') {'.PHP_EOL; |
|
156 | + echo ' priceSelector = \'#bodyContent>form>div>h1\''.PHP_EOL; |
|
157 | + echo ' }'.PHP_EOL; |
|
158 | + |
|
159 | + echo ' if (checkoutPriceSelector == \'default\' && checkoutPage == \'1\') {'.PHP_EOL; |
|
160 | + echo ' priceSelector = \'#columnRight > .infoBoxContainer > .infoBoxContents > tbody > tr:last-child > td\';'.PHP_EOL; |
|
161 | + echo ' }'.PHP_EOL; |
|
162 | + echo ' '.$simulatorCode.'.product_simulator = {};'.PHP_EOL; |
|
163 | + echo ' '.$simulatorCode.'.product_simulator.id = \'product-simulator\';'.PHP_EOL; |
|
164 | + echo ' '.$simulatorCode.'.product_simulator.publicKey = \''.$this->pk.'\';'.PHP_EOL; |
|
165 | + echo ' '.$simulatorCode.'.product_simulator.selector = positionSelector;'.PHP_EOL; |
|
166 | + echo ' '.$simulatorCode.'.product_simulator.numInstalments = \''.$this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'].'\';'.PHP_EOL; |
|
167 | + echo ' '.$simulatorCode.'.product_simulator.type = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'].';'.PHP_EOL; |
|
168 | + echo ' '.$simulatorCode.'.product_simulator.skin = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'].';'.PHP_EOL; |
|
169 | + echo ' '.$simulatorCode.'.product_simulator.position = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'].';'.PHP_EOL; |
|
170 | 170 | |
171 | 171 | //Amount in product page |
172 | - echo ' var promotedProduct = \'' . $this->isPromoted($productId) .'\';'. PHP_EOL; |
|
172 | + echo ' var promotedProduct = \''.$this->isPromoted($productId).'\';'.PHP_EOL; |
|
173 | 173 | echo ' if(checkoutPage != \'1\' ) {'; |
174 | - echo ' '.$simulatorCode.'.product_simulator.itemAmountSelector = priceSelector;'. PHP_EOL; |
|
175 | - echo ' if(promotedProduct == \'1\') { ' . PHP_EOL; |
|
176 | - echo ' '.$simulatorCode.'.product_simulator.itemPromotedAmountSelector = priceSelector;'. PHP_EOL; |
|
177 | - echo ' }' . PHP_EOL; |
|
174 | + echo ' '.$simulatorCode.'.product_simulator.itemAmountSelector = priceSelector;'.PHP_EOL; |
|
175 | + echo ' if(promotedProduct == \'1\') { '.PHP_EOL; |
|
176 | + echo ' '.$simulatorCode.'.product_simulator.itemPromotedAmountSelector = priceSelector;'.PHP_EOL; |
|
177 | + echo ' }'.PHP_EOL; |
|
178 | 178 | echo ' }'; |
179 | 179 | |
180 | 180 | //Amount in checkout page |
181 | - echo ' if(checkoutPage == \'1\' ) { ' . PHP_EOL; |
|
182 | - echo ' '.$simulatorCode.'.product_simulator.totalAmountSelector = priceSelector;'. PHP_EOL; |
|
183 | - echo ' if(promotedAmount != \'0\' && checkoutPage == \'1\' ) { ' . PHP_EOL; |
|
184 | - echo ' ' .$simulatorCode.'.product_simulator.totalPromotedAmount = promotedAmount;'. PHP_EOL; |
|
185 | - echo ' }' . PHP_EOL; |
|
186 | - echo ' }' . PHP_EOL; |
|
187 | - echo ' '.$simulatorCode.'.simulator.init('.$simulatorCode.'.product_simulator);'. PHP_EOL; |
|
188 | - echo ' clearInterval(window.OSSimulatorId);'. PHP_EOL; |
|
189 | - echo ' return true;'. PHP_EOL; |
|
190 | - echo ' }'. PHP_EOL; |
|
191 | - echo ' return false;'. PHP_EOL; |
|
192 | - echo ' }'. PHP_EOL; |
|
181 | + echo ' if(checkoutPage == \'1\' ) { '.PHP_EOL; |
|
182 | + echo ' '.$simulatorCode.'.product_simulator.totalAmountSelector = priceSelector;'.PHP_EOL; |
|
183 | + echo ' if(promotedAmount != \'0\' && checkoutPage == \'1\' ) { '.PHP_EOL; |
|
184 | + echo ' '.$simulatorCode.'.product_simulator.totalPromotedAmount = promotedAmount;'.PHP_EOL; |
|
185 | + echo ' }'.PHP_EOL; |
|
186 | + echo ' }'.PHP_EOL; |
|
187 | + echo ' '.$simulatorCode.'.simulator.init('.$simulatorCode.'.product_simulator);'.PHP_EOL; |
|
188 | + echo ' clearInterval(window.OSSimulatorId);'.PHP_EOL; |
|
189 | + echo ' return true;'.PHP_EOL; |
|
190 | + echo ' }'.PHP_EOL; |
|
191 | + echo ' return false;'.PHP_EOL; |
|
192 | + echo ' }'.PHP_EOL; |
|
193 | 193 | |
194 | 194 | //Invoke to main method |
195 | - echo ' window.OSSimulatorId = setInterval(function () {'. PHP_EOL; |
|
196 | - echo ' loadSimulator();'. PHP_EOL; |
|
197 | - echo ' }, 2000);'. PHP_EOL; |
|
198 | - echo '</script>'. PHP_EOL; |
|
195 | + echo ' window.OSSimulatorId = setInterval(function () {'.PHP_EOL; |
|
196 | + echo ' loadSimulator();'.PHP_EOL; |
|
197 | + echo ' }, 2000);'.PHP_EOL; |
|
198 | + echo '</script>'.PHP_EOL; |
|
199 | 199 | |
200 | 200 | //Checkout simulator |
201 | 201 | if ($checkoutPage) { |
202 | - echo '<script>' . PHP_EOL; |
|
203 | - |
|
204 | - echo 'function checkSelected(value)'. PHP_EOL; |
|
205 | - echo '{ '. PHP_EOL; |
|
206 | - echo 'var simulator = document.getElementsByClassName("buttonSet");' . PHP_EOL; |
|
207 | - echo ' if(simulator == "undefined") { return false; } '. PHP_EOL; |
|
208 | - echo 'var pagantisCheckbox = document.querySelector("input[value=\'pagantis\']"); ' . PHP_EOL; |
|
209 | - echo 'var grandparentNode = pagantisCheckbox.parentNode.parentNode;' . PHP_EOL; |
|
210 | - echo 'if(grandparentNode == value) { var status="" } ' . PHP_EOL; |
|
211 | - echo 'else { var status="none";} '. PHP_EOL; |
|
212 | - echo 'simulator[0].style.display=status; ' . PHP_EOL; |
|
213 | - echo '}'. PHP_EOL; |
|
214 | - |
|
215 | - echo 'function showSimulator()'. PHP_EOL; |
|
216 | - echo '{'. PHP_EOL; |
|
217 | - echo 'var elements = document.querySelectorAll("tr[class^=\'moduleRow\']");' . PHP_EOL; |
|
218 | - echo 'if(elements == null) { return false };' . PHP_EOL; |
|
202 | + echo '<script>'.PHP_EOL; |
|
203 | + |
|
204 | + echo 'function checkSelected(value)'.PHP_EOL; |
|
205 | + echo '{ '.PHP_EOL; |
|
206 | + echo 'var simulator = document.getElementsByClassName("buttonSet");'.PHP_EOL; |
|
207 | + echo ' if(simulator == "undefined") { return false; } '.PHP_EOL; |
|
208 | + echo 'var pagantisCheckbox = document.querySelector("input[value=\'pagantis\']"); '.PHP_EOL; |
|
209 | + echo 'var grandparentNode = pagantisCheckbox.parentNode.parentNode;'.PHP_EOL; |
|
210 | + echo 'if(grandparentNode == value) { var status="" } '.PHP_EOL; |
|
211 | + echo 'else { var status="none";} '.PHP_EOL; |
|
212 | + echo 'simulator[0].style.display=status; '.PHP_EOL; |
|
213 | + echo '}'.PHP_EOL; |
|
214 | + |
|
215 | + echo 'function showSimulator()'.PHP_EOL; |
|
216 | + echo '{'.PHP_EOL; |
|
217 | + echo 'var elements = document.querySelectorAll("tr[class^=\'moduleRow\']");'.PHP_EOL; |
|
218 | + echo 'if(elements == null) { return false };'.PHP_EOL; |
|
219 | 219 | echo 'for(var i = 0, max = elements.length; i < max; i++) { elements[i].onclick = function() { |
220 | 220 | checkSelected(this); |
221 | 221 | } }' . PHP_EOL; |
222 | 222 | echo 'clearInterval(window.OSdisplayId);'; |
223 | - echo 'return true;'. PHP_EOL; |
|
224 | - echo '};'. PHP_EOL; |
|
223 | + echo 'return true;'.PHP_EOL; |
|
224 | + echo '};'.PHP_EOL; |
|
225 | 225 | |
226 | - echo ' window.OSdisplayId = setInterval(function () {'. PHP_EOL; |
|
227 | - echo ' showSimulator();'. PHP_EOL; |
|
228 | - echo ' }, 2000);'. PHP_EOL; |
|
229 | - echo '</script>'. PHP_EOL; |
|
226 | + echo ' window.OSdisplayId = setInterval(function () {'.PHP_EOL; |
|
227 | + echo ' showSimulator();'.PHP_EOL; |
|
228 | + echo ' }, 2000);'.PHP_EOL; |
|
229 | + echo '</script>'.PHP_EOL; |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * install |
250 | 250 | */ |
251 | 251 | function install() { |
252 | - 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())"); |
|
252 | + 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())"); |
|
253 | 253 | |
254 | 254 | } |
255 | 255 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * remove |
258 | 258 | */ |
259 | 259 | function remove() { |
260 | - tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); |
|
260 | + tep_db_query("delete from ".TABLE_CONFIGURATION." where configuration_key in ('".implode("', '", $this->keys())."')"); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | |
281 | 281 | if ($this->extraConfig['PAGANTIS_PROMOTION'] == '') { |
282 | 282 | $promotedProducts = array(); |
283 | - } else { |
|
283 | + }else { |
|
284 | 284 | $promotedProducts = array_values((array)unserialize($this->extraConfig['PAGANTIS_PROMOTION'])); |
285 | 285 | } |
286 | 286 |