@@ -3,12 +3,12 @@ discard block |
||
| 3 | 3 | require('includes/application_top.php'); |
| 4 | 4 | |
| 5 | 5 | define('TABLE_PAGANTIS_CONFIG', 'pagantis_config'); |
| 6 | -define('TABLE_PRODUCTS_DESCRIPTIONS','products_description'); |
|
| 6 | +define('TABLE_PRODUCTS_DESCRIPTIONS', 'products_description'); |
|
| 7 | 7 | |
| 8 | 8 | //Check if module is installed |
| 9 | -$result = tep_db_query("select * from " . TABLE_CONFIGURATION . " where configuration_key='MODULE_PAYMENT_PAGANTIS_STATUS'"); |
|
| 9 | +$result = tep_db_query("select * from ".TABLE_CONFIGURATION." where configuration_key='MODULE_PAYMENT_PAGANTIS_STATUS'"); |
|
| 10 | 10 | $resultSelect = tep_db_fetch_array($result); |
| 11 | -if (tep_db_num_rows($result) == 0 || $resultSelect['configuration_value'] !=='True') { |
|
| 11 | +if (tep_db_num_rows($result) == 0 || $resultSelect['configuration_value'] !== 'True') { |
|
| 12 | 12 | tep_redirect('/admin/index.php'); |
| 13 | 13 | } |
| 14 | 14 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $resultSelect = tep_db_fetch_array($result); |
| 32 | 32 | if ($resultSelect['value'] == '') { |
| 33 | 33 | $promotedProducts = array(); |
| 34 | - } else { |
|
| 34 | + }else { |
|
| 35 | 35 | $promotedProducts = array_values((array)unserialize($resultSelect['value'])); |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | protected function checkPagantisOrderId() |
| 141 | 141 | { |
| 142 | - $orderId=0; |
|
| 142 | + $orderId = 0; |
|
| 143 | 143 | $notifyUrl = self::OSCURL.self::NOTIFICATION_FOLDER.'?order='.$orderId; |
| 144 | 144 | $this->assertNotEmpty($notifyUrl, $notifyUrl); |
| 145 | 145 | $response = Request::post($notifyUrl)->expects('json')->send(); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $this->assertEquals( |
| 150 | 150 | $response->body->merchant_order_id, |
| 151 | 151 | $orderId, |
| 152 | - $response->body->merchant_order_id.'!='. $orderId |
|
| 152 | + $response->body->merchant_order_id.'!='.$orderId |
|
| 153 | 153 | ); |
| 154 | 154 | $this->assertContains( |
| 155 | 155 | NoIdentificationException::ERROR_MESSAGE, |
@@ -83,22 +83,22 @@ discard block |
||
| 83 | 83 | $jsonResponse->setException($exception); |
| 84 | 84 | $this->insertLog($exception); |
| 85 | 85 | |
| 86 | - if ($this->extraConfig['PAGANTIS_URL_KO'] =! '') { |
|
| 86 | + if ($this->extraConfig['PAGANTIS_URL_KO'] = !'') { |
|
| 87 | 87 | $koUrl = $this->extraConfig['PAGANTIS_URL_KO']; |
| 88 | - } else { |
|
| 88 | + }else { |
|
| 89 | 89 | $koUrl = trim(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL', false)); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | if ($this->origin == 'notify') { |
| 93 | 93 | $jsonResponse->printResponse(); |
| 94 | - } else { |
|
| 94 | + }else { |
|
| 95 | 95 | if ($exception->getMessage() == AlreadyProcessedException::ERROR_MESSAGE) { |
| 96 | - if ($this->extraConfig['PAGANTIS_URL_OK']!='') { |
|
| 96 | + if ($this->extraConfig['PAGANTIS_URL_OK'] != '') { |
|
| 97 | 97 | $confirmationUrl = $this->extraConfig['PAGANTIS_URL_OK']; |
| 98 | - $confirmationUrl.="?order_id=$this->merchantOrderId"; |
|
| 99 | - } else { |
|
| 98 | + $confirmationUrl .= "?order_id=$this->merchantOrderId"; |
|
| 99 | + }else { |
|
| 100 | 100 | $confirmationUrl = trim(tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, '', 'SSL', false)); |
| 101 | - $confirmationUrl.="?order_id=$this->merchantOrderId"; |
|
| 101 | + $confirmationUrl .= "?order_id=$this->merchantOrderId"; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | header("Location: $confirmationUrl"); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | if ($this->origin == 'notify') { |
| 135 | 135 | $jsonResponse->printResponse(); |
| 136 | - } else { |
|
| 136 | + }else { |
|
| 137 | 137 | return $jsonResponse; |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -206,12 +206,12 @@ discard block |
||
| 206 | 206 | try { |
| 207 | 207 | $this->checkPagantisStatus(array('AUTHORIZED')); |
| 208 | 208 | } catch (\Exception $e) { |
| 209 | - if ($this->findOscommerceOrderId()!='') { |
|
| 209 | + if ($this->findOscommerceOrderId() != '') { |
|
| 210 | 210 | throw new AlreadyProcessedException(); |
| 211 | - } else { |
|
| 211 | + }else { |
|
| 212 | 212 | if ($this->pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) { |
| 213 | 213 | $status = $this->pagantisOrder->getStatus(); |
| 214 | - } else { |
|
| 214 | + }else { |
|
| 215 | 215 | $status = '-'; |
| 216 | 216 | } |
| 217 | 217 | throw new WrongStatusException($status); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | { |
| 227 | 227 | global $order; |
| 228 | 228 | |
| 229 | - if ($order->info['order_status']!=='1') { |
|
| 229 | + if ($order->info['order_status'] !== '1') { |
|
| 230 | 230 | throw new AlreadyProcessedException(); |
| 231 | 231 | } |
| 232 | 232 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | if ($orderId == null) { |
| 304 | 304 | $query = "delete from ".TABLE_PAGANTIS_CONCURRENCY." where timestamp<".(time() - 5); |
| 305 | 305 | tep_db_query($query); |
| 306 | - } elseif ($orderId!='') { |
|
| 306 | + } elseif ($orderId != '') { |
|
| 307 | 307 | $query = "delete from ".TABLE_PAGANTIS_CONCURRENCY." where id='$orderId'"; |
| 308 | 308 | tep_db_query($query); |
| 309 | 309 | } |
@@ -355,12 +355,12 @@ discard block |
||
| 355 | 355 | if (!$payed) { |
| 356 | 356 | if ($this->pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) { |
| 357 | 357 | $status = $this->pagantisOrder->getStatus(); |
| 358 | - } else { |
|
| 358 | + }else { |
|
| 359 | 359 | $status = '-'; |
| 360 | 360 | } |
| 361 | 361 | throw new WrongStatusException($status); |
| 362 | 362 | } |
| 363 | - } else { |
|
| 363 | + }else { |
|
| 364 | 364 | throw new OrderNotFoundException(); |
| 365 | 365 | } |
| 366 | 366 | } |
@@ -397,12 +397,12 @@ discard block |
||
| 397 | 397 | $metadataInfo = ''; |
| 398 | 398 | foreach ($metadataOrder as $metadataKey => $metadataValue) { |
| 399 | 399 | if ($metadataKey == 'promotedProduct') { |
| 400 | - $metadataInfo.= "/Producto promocionado = $metadataValue"; |
|
| 400 | + $metadataInfo .= "/Producto promocionado = $metadataValue"; |
|
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | $comment = "Pagantis id=$this->pagantisOrderId/Via=".ucfirst($this->origin)."/".$metadataInfo; |
| 405 | - $query = "insert into ".TABLE_ORDERS_STATUS_HISTORY ."(comments, orders_id, orders_status_id, customer_notified, date_added) values |
|
| 405 | + $query = "insert into ".TABLE_ORDERS_STATUS_HISTORY."(comments, orders_id, orders_status_id, customer_notified, date_added) values |
|
| 406 | 406 | ('$comment', ".$insert_id.", '2', -1, now() )"; |
| 407 | 407 | tep_db_query($query); |
| 408 | 408 | |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | private function insertLog($exception) |
| 428 | 428 | { |
| 429 | 429 | if ($exception instanceof \Exception) { |
| 430 | - $logEntry= new LogEntry(); |
|
| 430 | + $logEntry = new LogEntry(); |
|
| 431 | 431 | $logEntryJson = $logEntry->error($exception)->toJson(); |
| 432 | 432 | |
| 433 | 433 | $query = "insert into ".TABLE_PAGANTIS_LOG."(log) values ('$logEntryJson')"; |
@@ -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'); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | ) { |
| 35 | 35 | $this->enabled = ((MODULE_HEADER_TAGS_PAGANTIS_STATUS == 'True') && |
| 36 | 36 | (MODULE_PAYMENT_PAGANTIS_STATUS == 'True') && |
| 37 | - (MODULE_PAYMENT_PAGANTIS_SIMULATOR == 'True')) ; |
|
| 37 | + (MODULE_PAYMENT_PAGANTIS_SIMULATOR == 'True')); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $this->extraConfig = $this->getExtraConfig(); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | private function getConfig($config = '') |
| 68 | 68 | { |
| 69 | - $query = "select * from ".TABLE_CONFIGURATION . " where configuration_key ='" . $config . "'"; |
|
| 69 | + $query = "select * from ".TABLE_CONFIGURATION." where configuration_key ='".$config."'"; |
|
| 70 | 70 | $result = tep_db_query($query); |
| 71 | 71 | $resultArray = tep_db_fetch_array($result); |
| 72 | 72 | return $resultArray['configuration_value']; |
@@ -83,29 +83,29 @@ discard block |
||
| 83 | 83 | $checkoutPage = strpos($_SERVER[REQUEST_URI], "checkout_payment.php") > 0; |
| 84 | 84 | |
| 85 | 85 | //Show promoted html |
| 86 | - if ($this->isPromoted($productId) && $checkoutPage!='1') { |
|
| 86 | + if ($this->isPromoted($productId) && $checkoutPage != '1') { |
|
| 87 | 87 | echo "<div id='promotedText' style='display:none'><br/>".$this->extraConfig['PAGANTIS_PROMOTED_PRODUCT_CODE']."</div>"; |
| 88 | - echo '<script>'. PHP_EOL; |
|
| 89 | - echo ' function loadPromoted()'. PHP_EOL; |
|
| 90 | - echo ' {'. PHP_EOL; |
|
| 91 | - echo 'var positionSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR']. '\';'. PHP_EOL; |
|
| 92 | - echo 'if (positionSelector === \'default\') {'. PHP_EOL; |
|
| 93 | - echo 'positionSelector = \'.buttonSet\''. PHP_EOL; |
|
| 94 | - echo '}'. PHP_EOL; |
|
| 88 | + echo '<script>'.PHP_EOL; |
|
| 89 | + echo ' function loadPromoted()'.PHP_EOL; |
|
| 90 | + echo ' {'.PHP_EOL; |
|
| 91 | + echo 'var positionSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'].'\';'.PHP_EOL; |
|
| 92 | + echo 'if (positionSelector === \'default\') {'.PHP_EOL; |
|
| 93 | + echo 'positionSelector = \'.buttonSet\''.PHP_EOL; |
|
| 94 | + echo '}'.PHP_EOL; |
|
| 95 | 95 | echo 'var docFather = document.querySelector(positionSelector);'.PHP_EOL; |
| 96 | - echo 'if (typeof docFather != \'undefined\') {'. PHP_EOL; |
|
| 96 | + echo 'if (typeof docFather != \'undefined\') {'.PHP_EOL; |
|
| 97 | 97 | echo 'var promotedNode = document.getElementById("promotedText");'.PHP_EOL; |
| 98 | 98 | echo 'docFather.appendChild(promotedNode);'.PHP_EOL; |
| 99 | - echo 'promotedNode.style.display=""' . PHP_EOL; |
|
| 100 | - echo ' clearInterval(window.OSPromotedId);'. PHP_EOL; |
|
| 101 | - echo ' return true;'. PHP_EOL; |
|
| 102 | - echo ' }'. PHP_EOL; |
|
| 103 | - echo ' return false;'. PHP_EOL; |
|
| 104 | - echo ' }'. PHP_EOL; |
|
| 105 | - echo ' window.OSPromotedId = setInterval(function () {'. PHP_EOL; |
|
| 106 | - echo ' loadPromoted();'. PHP_EOL; |
|
| 107 | - echo ' }, 2000);'. PHP_EOL; |
|
| 108 | - echo '</script>'. PHP_EOL; |
|
| 99 | + echo 'promotedNode.style.display=""'.PHP_EOL; |
|
| 100 | + echo ' clearInterval(window.OSPromotedId);'.PHP_EOL; |
|
| 101 | + echo ' return true;'.PHP_EOL; |
|
| 102 | + echo ' }'.PHP_EOL; |
|
| 103 | + echo ' return false;'.PHP_EOL; |
|
| 104 | + echo ' }'.PHP_EOL; |
|
| 105 | + echo ' window.OSPromotedId = setInterval(function () {'.PHP_EOL; |
|
| 106 | + echo ' loadPromoted();'.PHP_EOL; |
|
| 107 | + echo ' }, 2000);'.PHP_EOL; |
|
| 108 | + echo '</script>'.PHP_EOL; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | if (isset($productId) || $checkoutPage) { |
@@ -124,101 +124,101 @@ discard block |
||
| 124 | 124 | $productId = array_shift($productId); |
| 125 | 125 | $promotedProduct = $this->isPromoted($productId); |
| 126 | 126 | if ($promotedProduct) { |
| 127 | - $promotedAmount+=number_format(($item['price'] * $item['qty']), 2); |
|
| 127 | + $promotedAmount += number_format(($item['price'] * $item['qty']), 2); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - echo "<script src='".$this->sdkFile."'></script>". PHP_EOL; |
|
| 132 | - echo '<script>'. PHP_EOL; |
|
| 133 | - echo ' function loadSimulator()'. PHP_EOL; |
|
| 134 | - echo ' {'. PHP_EOL; |
|
| 135 | - echo ' if (typeof '.$simulatorCode.' != \'undefined\') {'. PHP_EOL; |
|
| 136 | - echo ' var positionSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR']. '\';'. PHP_EOL; |
|
| 137 | - echo ' var priceSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']. '\';'. PHP_EOL; |
|
| 138 | - echo ' var checkoutPriceSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']. '\';'. PHP_EOL; |
|
| 139 | - echo ' var quantitySelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR']. '\';'. PHP_EOL; |
|
| 140 | - echo ' var checkoutPage = \'' . $checkoutPage.'\';'. PHP_EOL; |
|
| 141 | - echo ' var promotedAmount = \'' . $promotedAmount.'\';'. PHP_EOL; |
|
| 142 | - |
|
| 143 | - echo ' if (positionSelector === \'default\') {'. PHP_EOL; |
|
| 144 | - echo ' positionSelector = \'.buttonSet\''. PHP_EOL; |
|
| 145 | - echo ' }'. PHP_EOL; |
|
| 146 | - |
|
| 147 | - echo ' if (priceSelector === \'default\') {'. PHP_EOL; |
|
| 148 | - echo ' priceSelector = \'#bodyContent>form>div>h1\''. PHP_EOL; |
|
| 149 | - echo ' }'. PHP_EOL; |
|
| 150 | - |
|
| 151 | - echo ' if (checkoutPriceSelector == \'default\' && checkoutPage == \'1\') {'. PHP_EOL; |
|
| 152 | - echo ' priceSelector = \'#columnRight > .infoBoxContainer > .infoBoxContents > tbody > tr:last-child > td\';'. PHP_EOL; |
|
| 153 | - echo ' }'. PHP_EOL; |
|
| 154 | - echo ' '.$simulatorCode.'.product_simulator = {};'. PHP_EOL; |
|
| 155 | - echo ' '.$simulatorCode.'.product_simulator.id = \'product-simulator\';'. PHP_EOL; |
|
| 156 | - echo ' '.$simulatorCode.'.product_simulator.publicKey = \'' . $this->pk . '\';'. PHP_EOL; |
|
| 157 | - echo ' '.$simulatorCode.'.product_simulator.selector = positionSelector;'. PHP_EOL; |
|
| 158 | - echo ' '.$simulatorCode.'.product_simulator.numInstalments = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'] . '\';'. PHP_EOL; |
|
| 159 | - echo ' '.$simulatorCode.'.product_simulator.type = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'] . ';'. PHP_EOL; |
|
| 160 | - echo ' '.$simulatorCode.'.product_simulator.skin = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'] . ';'. PHP_EOL; |
|
| 161 | - echo ' '.$simulatorCode.'.product_simulator.position = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'] . ';'. PHP_EOL; |
|
| 131 | + echo "<script src='".$this->sdkFile."'></script>".PHP_EOL; |
|
| 132 | + echo '<script>'.PHP_EOL; |
|
| 133 | + echo ' function loadSimulator()'.PHP_EOL; |
|
| 134 | + echo ' {'.PHP_EOL; |
|
| 135 | + echo ' if (typeof '.$simulatorCode.' != \'undefined\') {'.PHP_EOL; |
|
| 136 | + echo ' var positionSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'].'\';'.PHP_EOL; |
|
| 137 | + echo ' var priceSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'].'\';'.PHP_EOL; |
|
| 138 | + echo ' var checkoutPriceSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'].'\';'.PHP_EOL; |
|
| 139 | + echo ' var quantitySelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'].'\';'.PHP_EOL; |
|
| 140 | + echo ' var checkoutPage = \''.$checkoutPage.'\';'.PHP_EOL; |
|
| 141 | + echo ' var promotedAmount = \''.$promotedAmount.'\';'.PHP_EOL; |
|
| 142 | + |
|
| 143 | + echo ' if (positionSelector === \'default\') {'.PHP_EOL; |
|
| 144 | + echo ' positionSelector = \'.buttonSet\''.PHP_EOL; |
|
| 145 | + echo ' }'.PHP_EOL; |
|
| 146 | + |
|
| 147 | + echo ' if (priceSelector === \'default\') {'.PHP_EOL; |
|
| 148 | + echo ' priceSelector = \'#bodyContent>form>div>h1\''.PHP_EOL; |
|
| 149 | + echo ' }'.PHP_EOL; |
|
| 150 | + |
|
| 151 | + echo ' if (checkoutPriceSelector == \'default\' && checkoutPage == \'1\') {'.PHP_EOL; |
|
| 152 | + echo ' priceSelector = \'#columnRight > .infoBoxContainer > .infoBoxContents > tbody > tr:last-child > td\';'.PHP_EOL; |
|
| 153 | + echo ' }'.PHP_EOL; |
|
| 154 | + echo ' '.$simulatorCode.'.product_simulator = {};'.PHP_EOL; |
|
| 155 | + echo ' '.$simulatorCode.'.product_simulator.id = \'product-simulator\';'.PHP_EOL; |
|
| 156 | + echo ' '.$simulatorCode.'.product_simulator.publicKey = \''.$this->pk.'\';'.PHP_EOL; |
|
| 157 | + echo ' '.$simulatorCode.'.product_simulator.selector = positionSelector;'.PHP_EOL; |
|
| 158 | + echo ' '.$simulatorCode.'.product_simulator.numInstalments = \''.$this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'].'\';'.PHP_EOL; |
|
| 159 | + echo ' '.$simulatorCode.'.product_simulator.type = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'].';'.PHP_EOL; |
|
| 160 | + echo ' '.$simulatorCode.'.product_simulator.skin = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'].';'.PHP_EOL; |
|
| 161 | + echo ' '.$simulatorCode.'.product_simulator.position = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'].';'.PHP_EOL; |
|
| 162 | 162 | |
| 163 | 163 | //Amount in product page |
| 164 | - echo ' var promotedProduct = \'' . $this->isPromoted($productId) .'\';'. PHP_EOL; |
|
| 164 | + echo ' var promotedProduct = \''.$this->isPromoted($productId).'\';'.PHP_EOL; |
|
| 165 | 165 | echo ' if(checkoutPage != \'1\' ) {'; |
| 166 | - echo ' '.$simulatorCode.'.product_simulator.itemAmountSelector = priceSelector;'. PHP_EOL; |
|
| 167 | - echo ' if(promotedProduct == \'1\') { ' . PHP_EOL; |
|
| 168 | - echo ' '.$simulatorCode.'.product_simulator.itemPromotedAmountSelector = priceSelector;'. PHP_EOL; |
|
| 169 | - echo ' }' . PHP_EOL; |
|
| 166 | + echo ' '.$simulatorCode.'.product_simulator.itemAmountSelector = priceSelector;'.PHP_EOL; |
|
| 167 | + echo ' if(promotedProduct == \'1\') { '.PHP_EOL; |
|
| 168 | + echo ' '.$simulatorCode.'.product_simulator.itemPromotedAmountSelector = priceSelector;'.PHP_EOL; |
|
| 169 | + echo ' }'.PHP_EOL; |
|
| 170 | 170 | echo ' }'; |
| 171 | 171 | |
| 172 | 172 | //Amount in checkout page |
| 173 | - echo ' if(checkoutPage == \'1\' ) { ' . PHP_EOL; |
|
| 174 | - echo ' '.$simulatorCode.'.product_simulator.totalAmountSelector = priceSelector;'. PHP_EOL; |
|
| 175 | - echo ' if(promotedAmount != \'0\' && checkoutPage == \'1\' ) { ' . PHP_EOL; |
|
| 176 | - echo ' ' .$simulatorCode.'.product_simulator.totalPromotedAmount = promotedAmount;'. PHP_EOL; |
|
| 177 | - echo ' }' . PHP_EOL; |
|
| 178 | - echo ' }' . PHP_EOL; |
|
| 179 | - echo ' '.$simulatorCode.'.simulator.init('.$simulatorCode.'.product_simulator);'. PHP_EOL; |
|
| 180 | - echo ' clearInterval(window.OSSimulatorId);'. PHP_EOL; |
|
| 181 | - echo ' return true;'. PHP_EOL; |
|
| 182 | - echo ' }'. PHP_EOL; |
|
| 183 | - echo ' return false;'. PHP_EOL; |
|
| 184 | - echo ' }'. PHP_EOL; |
|
| 185 | - echo ' window.OSSimulatorId = setInterval(function () {'. PHP_EOL; |
|
| 186 | - echo ' loadSimulator();'. PHP_EOL; |
|
| 187 | - echo ' }, 2000);'. PHP_EOL; |
|
| 188 | - echo '</script>'. PHP_EOL; |
|
| 173 | + echo ' if(checkoutPage == \'1\' ) { '.PHP_EOL; |
|
| 174 | + echo ' '.$simulatorCode.'.product_simulator.totalAmountSelector = priceSelector;'.PHP_EOL; |
|
| 175 | + echo ' if(promotedAmount != \'0\' && checkoutPage == \'1\' ) { '.PHP_EOL; |
|
| 176 | + echo ' '.$simulatorCode.'.product_simulator.totalPromotedAmount = promotedAmount;'.PHP_EOL; |
|
| 177 | + echo ' }'.PHP_EOL; |
|
| 178 | + echo ' }'.PHP_EOL; |
|
| 179 | + echo ' '.$simulatorCode.'.simulator.init('.$simulatorCode.'.product_simulator);'.PHP_EOL; |
|
| 180 | + echo ' clearInterval(window.OSSimulatorId);'.PHP_EOL; |
|
| 181 | + echo ' return true;'.PHP_EOL; |
|
| 182 | + echo ' }'.PHP_EOL; |
|
| 183 | + echo ' return false;'.PHP_EOL; |
|
| 184 | + echo ' }'.PHP_EOL; |
|
| 185 | + echo ' window.OSSimulatorId = setInterval(function () {'.PHP_EOL; |
|
| 186 | + echo ' loadSimulator();'.PHP_EOL; |
|
| 187 | + echo ' }, 2000);'.PHP_EOL; |
|
| 188 | + echo '</script>'.PHP_EOL; |
|
| 189 | 189 | |
| 190 | 190 | //Checkout simulator |
| 191 | 191 | if ($checkoutPage) { |
| 192 | - echo '<script>' . PHP_EOL; |
|
| 193 | - echo 'function checkSelected(value)'. PHP_EOL; |
|
| 194 | - echo '{ '. PHP_EOL; |
|
| 195 | - echo 'var simulator = document.getElementsByClassName("buttonSet");' . PHP_EOL; |
|
| 196 | - echo ' if(simulator == "undefined") { return false; } '. PHP_EOL; |
|
| 197 | - echo 'var pagantisCheckbox = document.querySelector("input[value=\'pagantis\']"); ' . PHP_EOL; |
|
| 198 | - echo 'var grandparentNode = pagantisCheckbox.parentNode.parentNode;' . PHP_EOL; |
|
| 199 | - echo 'if(grandparentNode == value) { var status="" } ' . PHP_EOL; |
|
| 200 | - echo 'else { var status="none";} '. PHP_EOL; |
|
| 201 | - echo 'simulator[0].style.display=status; ' . PHP_EOL; |
|
| 202 | - echo '}'. PHP_EOL; |
|
| 203 | - |
|
| 204 | - echo 'function showSimulator()'. PHP_EOL; |
|
| 205 | - echo '{'. PHP_EOL; |
|
| 206 | - echo 'var elements = document.querySelectorAll("tr[class^=\'moduleRow\']");' . PHP_EOL; |
|
| 207 | - echo 'if(elements == null) { return false };' . PHP_EOL; |
|
| 192 | + echo '<script>'.PHP_EOL; |
|
| 193 | + echo 'function checkSelected(value)'.PHP_EOL; |
|
| 194 | + echo '{ '.PHP_EOL; |
|
| 195 | + echo 'var simulator = document.getElementsByClassName("buttonSet");'.PHP_EOL; |
|
| 196 | + echo ' if(simulator == "undefined") { return false; } '.PHP_EOL; |
|
| 197 | + echo 'var pagantisCheckbox = document.querySelector("input[value=\'pagantis\']"); '.PHP_EOL; |
|
| 198 | + echo 'var grandparentNode = pagantisCheckbox.parentNode.parentNode;'.PHP_EOL; |
|
| 199 | + echo 'if(grandparentNode == value) { var status="" } '.PHP_EOL; |
|
| 200 | + echo 'else { var status="none";} '.PHP_EOL; |
|
| 201 | + echo 'simulator[0].style.display=status; '.PHP_EOL; |
|
| 202 | + echo '}'.PHP_EOL; |
|
| 203 | + |
|
| 204 | + echo 'function showSimulator()'.PHP_EOL; |
|
| 205 | + echo '{'.PHP_EOL; |
|
| 206 | + echo 'var elements = document.querySelectorAll("tr[class^=\'moduleRow\']");'.PHP_EOL; |
|
| 207 | + echo 'if(elements == null) { return false };'.PHP_EOL; |
|
| 208 | 208 | |
| 209 | 209 | echo 'for(var i = 0, max = elements.length; i < max; i++) { elements[i].onclick = function() { |
| 210 | 210 | checkSelected(this); |
| 211 | 211 | } }' . PHP_EOL; |
| 212 | 212 | echo 'clearInterval(window.OSdisplayId);'; |
| 213 | - echo 'return true;'. PHP_EOL; |
|
| 214 | - echo '};'. PHP_EOL; |
|
| 213 | + echo 'return true;'.PHP_EOL; |
|
| 214 | + echo '};'.PHP_EOL; |
|
| 215 | 215 | |
| 216 | - echo ' window.OSdisplayId = setInterval(function () {'. PHP_EOL; |
|
| 217 | - echo ' showSimulator();'. PHP_EOL; |
|
| 218 | - echo ' }, 2000);'. PHP_EOL; |
|
| 216 | + echo ' window.OSdisplayId = setInterval(function () {'.PHP_EOL; |
|
| 217 | + echo ' showSimulator();'.PHP_EOL; |
|
| 218 | + echo ' }, 2000);'.PHP_EOL; |
|
| 219 | 219 | |
| 220 | 220 | |
| 221 | - echo '</script>'. PHP_EOL; |
|
| 221 | + echo '</script>'.PHP_EOL; |
|
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | * install |
| 242 | 242 | */ |
| 243 | 243 | function install() { |
| 244 | - 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())"); |
|
| 244 | + 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())"); |
|
| 245 | 245 | |
| 246 | 246 | } |
| 247 | 247 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | * remove |
| 250 | 250 | */ |
| 251 | 251 | function remove() { |
| 252 | - tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); |
|
| 252 | + tep_db_query("delete from ".TABLE_CONFIGURATION." where configuration_key in ('".implode("', '", $this->keys())."')"); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | /** |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | if ($this->extraConfig['PAGANTIS_PROMOTION'] == '') { |
| 277 | 277 | $promotedProducts = array(); |
| 278 | - } else { |
|
| 278 | + }else { |
|
| 279 | 279 | $promotedProducts = array_values((array)unserialize($this->extraConfig['PAGANTIS_PROMOTION'])); |
| 280 | 280 | } |
| 281 | 281 | |
@@ -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 = $this->extraConfig['PAGANTIS_TITLE'] .'<br/><br/><div class="buttonSet" style="display:none"></div><br/>'; // Payment module title in Catalog |
|
| 71 | + }else { |
|
| 72 | + $this->title = $this->extraConfig['PAGANTIS_TITLE'].'<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)"; |