@@ -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, |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | sleep(3); |
| 97 | 97 | $productLinkElement->click(); |
| 98 | 98 | $this->assertSame( |
| 99 | - self::PRODUCT_NAME . ', ' . self::TITLE, |
|
| 99 | + self::PRODUCT_NAME.', '.self::TITLE, |
|
| 100 | 100 | $this->webDriver->getTitle() |
| 101 | 101 | ); |
| 102 | 102 | } |
@@ -181,9 +181,9 @@ discard block |
||
| 181 | 181 | $paymentFormElement = WebDriverBy::className('FieldsPreview-desc'); |
| 182 | 182 | $condition = WebDriverExpectedCondition::visibilityOfElementLocated($paymentFormElement); |
| 183 | 183 | $this->webDriver->wait()->until($condition); |
| 184 | - $this->assertTrue((bool) $condition); |
|
| 184 | + $this->assertTrue((bool)$condition); |
|
| 185 | 185 | $this->assertSame( |
| 186 | - $this->configuration['firstname'] . ' ' . $this->configuration['lastname'], |
|
| 186 | + $this->configuration['firstname'].' '.$this->configuration['lastname'], |
|
| 187 | 187 | $this->findByClass('FieldsPreview-desc')->getText() |
| 188 | 188 | ); |
| 189 | 189 | } |
@@ -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 | } |
@@ -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 | } |
@@ -205,12 +205,12 @@ discard block |
||
| 205 | 205 | try { |
| 206 | 206 | $this->checkPagantisStatus(array('AUTHORIZED')); |
| 207 | 207 | } catch (\Exception $e) { |
| 208 | - if ($this->findOscommerceOrderId()!='') { |
|
| 208 | + if ($this->findOscommerceOrderId() != '') { |
|
| 209 | 209 | throw new AlreadyProcessedException(); |
| 210 | - } else { |
|
| 210 | + }else { |
|
| 211 | 211 | if ($this->pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) { |
| 212 | 212 | $status = $this->pagantisOrder->getStatus(); |
| 213 | - } else { |
|
| 213 | + }else { |
|
| 214 | 214 | $status = '-'; |
| 215 | 215 | } |
| 216 | 216 | throw new WrongStatusException($status); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | { |
| 226 | 226 | global $order; |
| 227 | 227 | |
| 228 | - if ($order->info['order_status']!=='1') { |
|
| 228 | + if ($order->info['order_status'] !== '1') { |
|
| 229 | 229 | throw new AlreadyProcessedException(); |
| 230 | 230 | } |
| 231 | 231 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | if ($orderId == null) { |
| 303 | 303 | $query = "delete from ".TABLE_PAGANTIS_CONCURRENCY." where timestamp<".(time() - 5); |
| 304 | 304 | tep_db_query($query); |
| 305 | - } elseif ($orderId!='') { |
|
| 305 | + } elseif ($orderId != '') { |
|
| 306 | 306 | $query = "delete from ".TABLE_PAGANTIS_CONCURRENCY." where id='$orderId'"; |
| 307 | 307 | tep_db_query($query); |
| 308 | 308 | } |
@@ -354,12 +354,12 @@ discard block |
||
| 354 | 354 | if (!$payed) { |
| 355 | 355 | if ($this->pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) { |
| 356 | 356 | $status = $this->pagantisOrder->getStatus(); |
| 357 | - } else { |
|
| 357 | + }else { |
|
| 358 | 358 | $status = '-'; |
| 359 | 359 | } |
| 360 | 360 | throw new WrongStatusException($status); |
| 361 | 361 | } |
| 362 | - } else { |
|
| 362 | + }else { |
|
| 363 | 363 | throw new OrderNotFoundException(); |
| 364 | 364 | } |
| 365 | 365 | } |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | tep_db_query($query); |
| 393 | 393 | |
| 394 | 394 | $comment = "Pagantis id=$this->pagantisOrderId/Via=".ucfirst($this->origin); |
| 395 | - $query = "insert into ".TABLE_ORDERS_STATUS_HISTORY ."(comments, orders_id, orders_status_id, customer_notified, date_added) values |
|
| 395 | + $query = "insert into ".TABLE_ORDERS_STATUS_HISTORY."(comments, orders_id, orders_status_id, customer_notified, date_added) values |
|
| 396 | 396 | ('$comment', ".$insert_id.", '2', -1, now() )"; |
| 397 | 397 | tep_db_query($query); |
| 398 | 398 | |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | private function insertLog($exception) |
| 418 | 418 | { |
| 419 | 419 | if ($exception instanceof \Exception) { |
| 420 | - $logEntry= new LogEntry(); |
|
| 420 | + $logEntry = new LogEntry(); |
|
| 421 | 421 | $logEntryJson = $logEntry->error($exception)->toJson(); |
| 422 | 422 | |
| 423 | 423 | $query = "insert into ".TABLE_PAGANTIS_LOG."(log) values ('$logEntryJson')"; |
@@ -32,23 +32,23 @@ discard block |
||
| 32 | 32 | public $pgNotify; |
| 33 | 33 | |
| 34 | 34 | public $defaultConfigs = array('PAGANTIS_TITLE'=>'Instant Financing', |
| 35 | - 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE', |
|
| 36 | - 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE', |
|
| 37 | - 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
| 38 | - 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
| 39 | - 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
| 40 | - 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
| 41 | - 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER', |
|
| 42 | - 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
| 43 | - 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
| 44 | - 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR_CHECKOUT'=>'default', |
|
| 45 | - 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
| 46 | - 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
| 47 | - 'PAGANTIS_URL_OK'=>'', |
|
| 48 | - 'PAGANTIS_URL_KO'=>'', |
|
| 49 | - 'PAGANTIS_TITLE_EXTRA' => 'Paga hasta en 12 cómodas cuotas con Paga+Tarde. Solicitud totalmente online y sin papeleos,¡y la respuesta es inmediata!', |
|
| 50 | - 'PAGANTIS_PROMOTION' => '', |
|
| 51 | - 'PAGANTIS_PROMOTED_PRODUCT_CODE' => '<p>PRODUCTO PROMOCIONADO CON PAGANTIS</p><img src="/ext/modules/payment/pagantis/img/sin_intereses.png"/>' |
|
| 35 | + 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE', |
|
| 36 | + 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE', |
|
| 37 | + 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
| 38 | + 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
| 39 | + 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
| 40 | + 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
| 41 | + 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER', |
|
| 42 | + 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
| 43 | + 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
| 44 | + 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR_CHECKOUT'=>'default', |
|
| 45 | + 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
| 46 | + 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
| 47 | + 'PAGANTIS_URL_OK'=>'', |
|
| 48 | + 'PAGANTIS_URL_KO'=>'', |
|
| 49 | + 'PAGANTIS_TITLE_EXTRA' => 'Paga hasta en 12 cómodas cuotas con Paga+Tarde. Solicitud totalmente online y sin papeleos,¡y la respuesta es inmediata!', |
|
| 50 | + 'PAGANTIS_PROMOTION' => '', |
|
| 51 | + 'PAGANTIS_PROMOTED_PRODUCT_CODE' => '<p>PRODUCTO PROMOCIONADO CON PAGANTIS</p><img src="/ext/modules/payment/pagantis/img/sin_intereses.png"/>' |
|
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | try { |
| 160 | 160 | include_once('./ext/modules/payment/pagantis/vendor/autoload.php'); |
| 161 | 161 | global $order, $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, |
| 162 | - $payment, $comments, $customer_default_address_id, $cartID; |
|
| 162 | + $payment, $comments, $customer_default_address_id, $cartID; |
|
| 163 | 163 | $global_vars = array(); |
| 164 | 164 | $global_vars['customer_id'] = serialize($customer_id); |
| 165 | 165 | $global_vars['sendTo'] = serialize($sendto); |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | if (strpos($_SERVER[REQUEST_URI], "checkout_payment.php") <= 0) { |
| 66 | 66 | $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_ADMIN_TITLE; // Payment module title in Admin |
| 67 | - } else { |
|
| 68 | - $this->title = $this->extraConfig['PAGANTIS_TITLE'] .'<br/><br/><div class="buttonSet" style="display:none"></div><br/>'; // Payment module title in Catalog |
|
| 67 | + }else { |
|
| 68 | + $this->title = $this->extraConfig['PAGANTIS_TITLE'].'<br/><br/><div class="buttonSet" style="display:none"></div><br/>'; // Payment module title in Catalog |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $this->enabled = ((MODULE_PAYMENT_PAGANTIS_STATUS == 'True') ? true : false); |
@@ -75,12 +75,12 @@ discard block |
||
| 75 | 75 | "%s://%s%s%s", |
| 76 | 76 | isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', |
| 77 | 77 | $_SERVER['SERVER_NAME'], |
| 78 | - isset($_SERVER['SERVER_PORT']) ? ":" . $_SERVER['SERVER_PORT'] : '', |
|
| 78 | + isset($_SERVER['SERVER_PORT']) ? ":".$_SERVER['SERVER_PORT'] : '', |
|
| 79 | 79 | $_SERVER['REQUEST_URI'] |
| 80 | 80 | ) |
| 81 | 81 | ); |
| 82 | 82 | |
| 83 | - $this->form_action_url = $this->base_url . '/ext/modules/payment/pagantis/bypass.php'; |
|
| 83 | + $this->form_action_url = $this->base_url.'/ext/modules/payment/pagantis/bypass.php'; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /*************** |
@@ -179,14 +179,14 @@ discard block |
||
| 179 | 179 | throw new UnknownException("Order not found"); |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - $id_hash = time() . serialize($order->products) . '' . serialize($order->customer) . '' . serialize($order->delivery); |
|
| 182 | + $id_hash = time().serialize($order->products).''.serialize($order->customer).''.serialize($order->delivery); |
|
| 183 | 183 | $this->os_order_reference = md5($id_hash); |
| 184 | 184 | $_SESSION['order_id'] = $this->os_order_reference; |
| 185 | 185 | |
| 186 | 186 | $userAddress = new Address(); |
| 187 | 187 | $userAddress |
| 188 | 188 | ->setZipCode($order->billing['postcode']) |
| 189 | - ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname']) |
|
| 189 | + ->setFullName($order->billing['firstname'].' '.$order->billing['lastname']) |
|
| 190 | 190 | ->setCountryCode('ES') |
| 191 | 191 | ->setCity($order->billing['city']) |
| 192 | 192 | ->setAddress($order->billing['street_address']) |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $orderShippingAddress = new Address(); |
| 199 | 199 | $orderShippingAddress |
| 200 | 200 | ->setZipCode($order->delivery['postcode']) |
| 201 | - ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname']) |
|
| 201 | + ->setFullName($order->billing['firstname'].' '.$order->billing['lastname']) |
|
| 202 | 202 | ->setCountryCode('ES') |
| 203 | 203 | ->setCity($order->delivery['city']) |
| 204 | 204 | ->setAddress($order->delivery['street_address']) |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $orderUser = new \Pagantis\OrdersApiClient\Model\Order\User(); |
| 209 | 209 | $orderUser |
| 210 | 210 | ->setAddress($userAddress) |
| 211 | - ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname']) |
|
| 211 | + ->setFullName($order->billing['firstname'].' '.$order->billing['lastname']) |
|
| 212 | 212 | ->setBillingAddress($orderBillingAddress) |
| 213 | 213 | ->setEmail($order->customer['email_address']) |
| 214 | 214 | ->setFixPhone($order->customer['telephone']) |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | ->setQuantity(intval($item['qty'])) |
| 238 | 238 | ->setDescription($item['name']); |
| 239 | 239 | if ($promotedProduct) { |
| 240 | - $promotedAmount+=$product->getAmount(); |
|
| 240 | + $promotedAmount += $product->getAmount(); |
|
| 241 | 241 | } |
| 242 | 242 | $details->addProduct($product); |
| 243 | 243 | } |
@@ -256,9 +256,9 @@ discard block |
||
| 256 | 256 | ); |
| 257 | 257 | |
| 258 | 258 | $cancelUrl = trim(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL', false)); |
| 259 | - if ($this->extraConfig['PAGANTIS_URL_KO']!='') { |
|
| 259 | + if ($this->extraConfig['PAGANTIS_URL_KO'] != '') { |
|
| 260 | 260 | $koUrl = $this->extraConfig['PAGANTIS_URL_KO']; |
| 261 | - } else { |
|
| 261 | + }else { |
|
| 262 | 262 | $koUrl = $cancelUrl; |
| 263 | 263 | } |
| 264 | 264 | |
@@ -303,16 +303,16 @@ discard block |
||
| 303 | 303 | if ($pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) { |
| 304 | 304 | $url = $pagantisOrder->getActionUrls()->getForm(); |
| 305 | 305 | $this->insertRow($this->os_order_reference, $pagantisOrder->getId(), serialize($global_vars)); |
| 306 | - } else { |
|
| 306 | + }else { |
|
| 307 | 307 | throw new OrderNotFoundException(); |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | if ($url == "") { |
| 311 | 311 | throw new UnknownException(_("No ha sido posible obtener una respuesta de Pagantis")); |
| 312 | - } else { |
|
| 312 | + }else { |
|
| 313 | 313 | $output = "\n"; |
| 314 | - $output .= tep_draw_hidden_field("formUrl", $url) . "\n"; |
|
| 315 | - $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl) . "\n"; |
|
| 314 | + $output .= tep_draw_hidden_field("formUrl", $url)."\n"; |
|
| 315 | + $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl)."\n"; |
|
| 316 | 316 | return $output; |
| 317 | 317 | |
| 318 | 318 | } //TODO IFRAME |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | return 'failed'; |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " |
|
| 381 | + tep_db_query("insert into ".TABLE_CONFIGURATION." |
|
| 382 | 382 | ( |
| 383 | 383 | configuration_title, |
| 384 | 384 | configuration_key, |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | ', |
| 402 | 402 | now() |
| 403 | 403 | )"); |
| 404 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " |
|
| 404 | + tep_db_query("insert into ".TABLE_CONFIGURATION." |
|
| 405 | 405 | ( |
| 406 | 406 | configuration_title, |
| 407 | 407 | configuration_key, |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | '0', |
| 422 | 422 | now() |
| 423 | 423 | )"); |
| 424 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " |
|
| 424 | + tep_db_query("insert into ".TABLE_CONFIGURATION." |
|
| 425 | 425 | ( |
| 426 | 426 | configuration_title, |
| 427 | 427 | configuration_key, |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | '0', |
| 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, |
@@ -474,14 +474,14 @@ discard block |
||
| 474 | 474 | */ |
| 475 | 475 | private function installPagantisTables() |
| 476 | 476 | { |
| 477 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_LOG . " ( |
|
| 477 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_LOG." ( |
|
| 478 | 478 | id int NOT NULL AUTO_INCREMENT, |
| 479 | 479 | log text NOT NULL, |
| 480 | 480 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, |
| 481 | 481 | UNIQUE KEY id (id))"; |
| 482 | 482 | tep_db_query($sql); |
| 483 | 483 | |
| 484 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONFIG . " ( |
|
| 484 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONFIG." ( |
|
| 485 | 485 | id int NOT NULL AUTO_INCREMENT, |
| 486 | 486 | config varchar(60) NOT NULL, |
| 487 | 487 | value varchar(200) NOT NULL, |
@@ -489,10 +489,10 @@ discard block |
||
| 489 | 489 | tep_db_query($sql); |
| 490 | 490 | |
| 491 | 491 | // check if table has records |
| 492 | - $check_query = tep_db_query("select value from " . TABLE_PAGANTIS_CONFIG); |
|
| 492 | + $check_query = tep_db_query("select value from ".TABLE_PAGANTIS_CONFIG); |
|
| 493 | 493 | if (tep_db_num_rows($check_query) === 0) { |
| 494 | 494 | foreach ((array)$this->defaultConfigs as $configKey => $configValue) { |
| 495 | - $query = "INSERT INTO " . TABLE_PAGANTIS_CONFIG . " |
|
| 495 | + $query = "INSERT INTO ".TABLE_PAGANTIS_CONFIG." |
|
| 496 | 496 | ( |
| 497 | 497 | config, |
| 498 | 498 | value |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_ORDERS . " ( |
|
| 509 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_ORDERS." ( |
|
| 510 | 510 | id int NOT NULL AUTO_INCREMENT, |
| 511 | 511 | os_order_id varchar(50), |
| 512 | 512 | os_order_reference varchar(50) NOT NULL, |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | UNIQUE KEY id(id))"; |
| 516 | 516 | tep_db_query($sql); |
| 517 | 517 | |
| 518 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONCURRENCY . " ( |
|
| 518 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONCURRENCY." ( |
|
| 519 | 519 | id varchar(50) NOT NULL, |
| 520 | 520 | `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, |
| 521 | 521 | UNIQUE KEY id(id))"; |
@@ -527,29 +527,29 @@ discard block |
||
| 527 | 527 | */ |
| 528 | 528 | public function remove() |
| 529 | 529 | { |
| 530 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_LOG . "'"); |
|
| 530 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_LOG."'"); |
|
| 531 | 531 | if (tep_db_num_rows($checkTable) > 0) { |
| 532 | - tep_db_query("drop table " . TABLE_PAGANTIS_LOG); |
|
| 532 | + tep_db_query("drop table ".TABLE_PAGANTIS_LOG); |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONFIG . "'"); |
|
| 535 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONFIG."'"); |
|
| 536 | 536 | if (tep_db_num_rows($checkTable) > 0) { |
| 537 | - tep_db_query("drop table " . TABLE_PAGANTIS_CONFIG); |
|
| 537 | + tep_db_query("drop table ".TABLE_PAGANTIS_CONFIG); |
|
| 538 | 538 | } |
| 539 | 539 | |
| 540 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_ORDERS . "'"); |
|
| 540 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_ORDERS."'"); |
|
| 541 | 541 | if (tep_db_num_rows($checkTable) > 0) { |
| 542 | - tep_db_query("drop table " . TABLE_PAGANTIS_ORDERS); |
|
| 542 | + tep_db_query("drop table ".TABLE_PAGANTIS_ORDERS); |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONCURRENCY . "'"); |
|
| 545 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONCURRENCY."'"); |
|
| 546 | 546 | if (tep_db_num_rows($checkTable) > 0) { |
| 547 | - tep_db_query("drop table " . TABLE_PAGANTIS_CONCURRENCY); |
|
| 547 | + tep_db_query("drop table ".TABLE_PAGANTIS_CONCURRENCY); |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | - tep_db_query("DELETE FROM ". TABLE_CONFIGURATION ." where configuration_key in ('MODULE_PAYMENT_PAGANTIS_STATUS','MODULE_PAYMENT_PAGANTIS_PK','MODULE_PAYMENT_PAGANTIS_SK')"); |
|
| 550 | + tep_db_query("DELETE FROM ".TABLE_CONFIGURATION." where configuration_key in ('MODULE_PAYMENT_PAGANTIS_STATUS','MODULE_PAYMENT_PAGANTIS_PK','MODULE_PAYMENT_PAGANTIS_SK')"); |
|
| 551 | 551 | |
| 552 | - $query = "delete from " . TABLE_CONFIGURATION . " where configuration_key like '%_PAGANTIS_%'"; |
|
| 552 | + $query = "delete from ".TABLE_CONFIGURATION." where configuration_key like '%_PAGANTIS_%'"; |
|
| 553 | 553 | tep_db_query($query); |
| 554 | 554 | |
| 555 | 555 | $this->uninstallSimulator(); |
@@ -603,13 +603,13 @@ discard block |
||
| 603 | 603 | */ |
| 604 | 604 | private function insertRow($orderId, $pagantisOrderId, $globalVars) |
| 605 | 605 | { |
| 606 | - $query = "select * from " . TABLE_PAGANTIS_ORDERS . " where os_order_reference='$orderId'"; |
|
| 606 | + $query = "select * from ".TABLE_PAGANTIS_ORDERS." where os_order_reference='$orderId'"; |
|
| 607 | 607 | $resultsSelect = tep_db_query($query); |
| 608 | 608 | $countResults = tep_db_num_rows($resultsSelect); |
| 609 | 609 | if ($countResults == 0) { |
| 610 | - $query = "INSERT INTO " . TABLE_PAGANTIS_ORDERS . " |
|
| 610 | + $query = "INSERT INTO ".TABLE_PAGANTIS_ORDERS." |
|
| 611 | 611 | (os_order_reference, pagantis_order_id, globals) values ('$orderId', '$pagantisOrderId','$globalVars')"; |
| 612 | - } else { |
|
| 612 | + }else { |
|
| 613 | 613 | $query = "UPDATE ".TABLE_PAGANTIS_ORDERS." set pagantis_order_id='$pagantisOrderId' |
| 614 | 614 | where os_order_reference='$orderId'"; |
| 615 | 615 | } |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | |
| 651 | 651 | if ($this->extraConfig['PAGANTIS_PROMOTION'] == '') { |
| 652 | 652 | $promotedProducts = array(); |
| 653 | - } else { |
|
| 653 | + }else { |
|
| 654 | 654 | $promotedProducts = array_values((array)unserialize($this->extraConfig['PAGANTIS_PROMOTION'])); |
| 655 | 655 | } |
| 656 | 656 | |
@@ -663,12 +663,12 @@ discard block |
||
| 663 | 663 | private function getDescription() |
| 664 | 664 | { |
| 665 | 665 | $descriptionCode = "<img src=\"images/icon_info.gif\" border=\"0\" alt=\"Info\" title=\"Info\"> <strong>Module version:</strong> $this->version<br/><br/>"; |
| 666 | - $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/>"; |
|
| 667 | - $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/>"; |
|
| 666 | + $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/>"; |
|
| 667 | + $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/>"; |
|
| 668 | 668 | if (MODULE_PAYMENT_PAGANTIS_STATUS == 'True') { |
| 669 | 669 | $pagantisPromotionUrl = $this->base_url.'/ext/modules/payment/pagantis/promotion.php'; |
| 670 | 670 | $linkDescription = "Si desea gestionar los productos promocionados pulse aquí"; |
| 671 | - $descriptionCode.= "<a href='$pagantisPromotionUrl'>$linkDescription</a>"; |
|
| 671 | + $descriptionCode .= "<a href='$pagantisPromotionUrl'>$linkDescription</a>"; |
|
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | return $descriptionCode; |
@@ -679,34 +679,34 @@ discard block |
||
| 679 | 679 | */ |
| 680 | 680 | private function installSimulator() |
| 681 | 681 | { |
| 682 | - $checkSimulator = tep_db_query("select configuration_key, configuration_value from " .TABLE_CONFIGURATION ." |
|
| 682 | + $checkSimulator = tep_db_query("select configuration_key, configuration_value from ".TABLE_CONFIGURATION." |
|
| 683 | 683 | where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED' |
| 684 | 684 | and configuration_value like '%ht_pagantis.php%';"); |
| 685 | 685 | if (tep_db_num_rows($checkSimulator) > 0) { |
| 686 | 686 | return true; |
| 687 | 687 | } |
| 688 | 688 | |
| 689 | - $query = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = concat(configuration_value, ';ht_pagantis.php') |
|
| 689 | + $query = "UPDATE ".TABLE_CONFIGURATION." set configuration_value = concat(configuration_value, ';ht_pagantis.php') |
|
| 690 | 690 | where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'"; |
| 691 | 691 | tep_db_query($query); |
| 692 | 692 | |
| 693 | - 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())"); |
|
| 693 | + 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())"); |
|
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | private function uninstallSimulator() |
| 697 | 697 | { |
| 698 | - $checkSimulator = tep_db_query("select configuration_key, configuration_value from " .TABLE_CONFIGURATION ." |
|
| 698 | + $checkSimulator = tep_db_query("select configuration_key, configuration_value from ".TABLE_CONFIGURATION." |
|
| 699 | 699 | where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED' |
| 700 | 700 | and configuration_value like '%ht_pagantis.php%';"); |
| 701 | 701 | if (tep_db_num_rows($checkSimulator) == 0) { |
| 702 | 702 | return true; |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | - $query = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = REPLACE(configuration_value, ';ht_pagantis.php', '') |
|
| 705 | + $query = "UPDATE ".TABLE_CONFIGURATION." set configuration_value = REPLACE(configuration_value, ';ht_pagantis.php', '') |
|
| 706 | 706 | where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'"; |
| 707 | 707 | tep_db_query($query); |
| 708 | 708 | |
| 709 | - $query = "delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_HEADER_TAGS_PAGANTIS_STATUS'"; |
|
| 709 | + $query = "delete from ".TABLE_CONFIGURATION." where configuration_key = 'MODULE_HEADER_TAGS_PAGANTIS_STATUS'"; |
|
| 710 | 710 | tep_db_query($query); |
| 711 | 711 | } |
| 712 | 712 | } |
@@ -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']; |
@@ -88,105 +88,105 @@ discard block |
||
| 88 | 88 | $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'] = 'pmtSDK.simulator.skins.BLUE'; |
| 89 | 89 | $simulatorCode = 'pmtSDK'; |
| 90 | 90 | } |
| 91 | - echo "<script src='".$this->sdkFile."'></script>". PHP_EOL; |
|
| 92 | - echo '<script>'. PHP_EOL; |
|
| 93 | - echo ' function loadSimulator()'. PHP_EOL; |
|
| 94 | - echo ' {'. PHP_EOL; |
|
| 95 | - echo ' if (typeof '.$simulatorCode.' != \'undefined\') {'. PHP_EOL; |
|
| 96 | - echo ' var positionSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR']. '\';'. PHP_EOL; |
|
| 97 | - echo ' var priceSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']. '\';'. PHP_EOL; |
|
| 98 | - echo ' var checkoutPriceSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']. '\';'. PHP_EOL; |
|
| 99 | - echo ' var quantitySelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR']. '\';'. PHP_EOL; |
|
| 100 | - echo ' var checkoutPage = \'' . $checkoutPage.'\';'. PHP_EOL; |
|
| 101 | - |
|
| 102 | - echo ' if (positionSelector === \'default\') {'. PHP_EOL; |
|
| 103 | - echo ' positionSelector = \'.buttonSet\''. PHP_EOL; |
|
| 104 | - echo ' }'. PHP_EOL; |
|
| 105 | - |
|
| 106 | - echo ' if (priceSelector === \'default\') {'. PHP_EOL; |
|
| 107 | - echo ' priceSelector = \'#bodyContent>form>div>h1\''. PHP_EOL; |
|
| 108 | - echo ' }'. PHP_EOL; |
|
| 109 | - |
|
| 110 | - echo ' if (checkoutPriceSelector == \'default\' && checkoutPage == \'1\') {'. PHP_EOL; |
|
| 111 | - echo ' priceSelector = \'#columnRight > .infoBoxContainer > .infoBoxContents > tbody > tr:last-child > td\';'. PHP_EOL; |
|
| 112 | - echo ' }'. PHP_EOL; |
|
| 113 | - echo ' '.$simulatorCode.'.product_simulator = {};'. PHP_EOL; |
|
| 114 | - echo ' '.$simulatorCode.'.product_simulator.id = \'product-simulator\';'. PHP_EOL; |
|
| 115 | - echo ' '.$simulatorCode.'.product_simulator.publicKey = \'' . $this->pk . '\';'. PHP_EOL; |
|
| 116 | - echo ' '.$simulatorCode.'.product_simulator.selector = positionSelector;'. PHP_EOL; |
|
| 117 | - echo ' '.$simulatorCode.'.product_simulator.numInstalments = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'] . '\';'. PHP_EOL; |
|
| 118 | - echo ' '.$simulatorCode.'.product_simulator.type = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'] . ';'. PHP_EOL; |
|
| 119 | - echo ' '.$simulatorCode.'.product_simulator.skin = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'] . ';'. PHP_EOL; |
|
| 120 | - echo ' '.$simulatorCode.'.product_simulator.position = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'] . ';'. PHP_EOL; |
|
| 121 | - echo ' '.$simulatorCode.'.product_simulator.itemAmountSelector = priceSelector;'. PHP_EOL; |
|
| 122 | - echo ' var promotedProduct = \'' . $this->isPromoted($productId) .'\';'. PHP_EOL; |
|
| 123 | - echo ' if(promotedProduct == true) { ' . PHP_EOL; |
|
| 124 | - echo ' '.$simulatorCode.'.product_simulator.itemPromotedAmountSelector = priceSelector;'. PHP_EOL; |
|
| 125 | - echo ' }' . PHP_EOL; |
|
| 126 | - echo ' '.$simulatorCode.'.simulator.init('.$simulatorCode.'.product_simulator);'. PHP_EOL; |
|
| 127 | - echo ' clearInterval(window.OSSimulatorId);'. PHP_EOL; |
|
| 128 | - echo ' return true;'. PHP_EOL; |
|
| 129 | - echo ' }'. PHP_EOL; |
|
| 130 | - echo ' return false;'. PHP_EOL; |
|
| 131 | - echo ' }'. PHP_EOL; |
|
| 132 | - echo ' window.OSSimulatorId = setInterval(function () {'. PHP_EOL; |
|
| 133 | - echo ' loadSimulator();'. PHP_EOL; |
|
| 134 | - echo ' }, 2000);'. PHP_EOL; |
|
| 135 | - echo '</script>'. PHP_EOL; |
|
| 91 | + echo "<script src='".$this->sdkFile."'></script>".PHP_EOL; |
|
| 92 | + echo '<script>'.PHP_EOL; |
|
| 93 | + echo ' function loadSimulator()'.PHP_EOL; |
|
| 94 | + echo ' {'.PHP_EOL; |
|
| 95 | + echo ' if (typeof '.$simulatorCode.' != \'undefined\') {'.PHP_EOL; |
|
| 96 | + echo ' var positionSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'].'\';'.PHP_EOL; |
|
| 97 | + echo ' var priceSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'].'\';'.PHP_EOL; |
|
| 98 | + echo ' var checkoutPriceSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'].'\';'.PHP_EOL; |
|
| 99 | + echo ' var quantitySelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'].'\';'.PHP_EOL; |
|
| 100 | + echo ' var checkoutPage = \''.$checkoutPage.'\';'.PHP_EOL; |
|
| 101 | + |
|
| 102 | + echo ' if (positionSelector === \'default\') {'.PHP_EOL; |
|
| 103 | + echo ' positionSelector = \'.buttonSet\''.PHP_EOL; |
|
| 104 | + echo ' }'.PHP_EOL; |
|
| 105 | + |
|
| 106 | + echo ' if (priceSelector === \'default\') {'.PHP_EOL; |
|
| 107 | + echo ' priceSelector = \'#bodyContent>form>div>h1\''.PHP_EOL; |
|
| 108 | + echo ' }'.PHP_EOL; |
|
| 109 | + |
|
| 110 | + echo ' if (checkoutPriceSelector == \'default\' && checkoutPage == \'1\') {'.PHP_EOL; |
|
| 111 | + echo ' priceSelector = \'#columnRight > .infoBoxContainer > .infoBoxContents > tbody > tr:last-child > td\';'.PHP_EOL; |
|
| 112 | + echo ' }'.PHP_EOL; |
|
| 113 | + echo ' '.$simulatorCode.'.product_simulator = {};'.PHP_EOL; |
|
| 114 | + echo ' '.$simulatorCode.'.product_simulator.id = \'product-simulator\';'.PHP_EOL; |
|
| 115 | + echo ' '.$simulatorCode.'.product_simulator.publicKey = \''.$this->pk.'\';'.PHP_EOL; |
|
| 116 | + echo ' '.$simulatorCode.'.product_simulator.selector = positionSelector;'.PHP_EOL; |
|
| 117 | + echo ' '.$simulatorCode.'.product_simulator.numInstalments = \''.$this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'].'\';'.PHP_EOL; |
|
| 118 | + echo ' '.$simulatorCode.'.product_simulator.type = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'].';'.PHP_EOL; |
|
| 119 | + echo ' '.$simulatorCode.'.product_simulator.skin = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'].';'.PHP_EOL; |
|
| 120 | + echo ' '.$simulatorCode.'.product_simulator.position = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'].';'.PHP_EOL; |
|
| 121 | + echo ' '.$simulatorCode.'.product_simulator.itemAmountSelector = priceSelector;'.PHP_EOL; |
|
| 122 | + echo ' var promotedProduct = \''.$this->isPromoted($productId).'\';'.PHP_EOL; |
|
| 123 | + echo ' if(promotedProduct == true) { '.PHP_EOL; |
|
| 124 | + echo ' '.$simulatorCode.'.product_simulator.itemPromotedAmountSelector = priceSelector;'.PHP_EOL; |
|
| 125 | + echo ' }'.PHP_EOL; |
|
| 126 | + echo ' '.$simulatorCode.'.simulator.init('.$simulatorCode.'.product_simulator);'.PHP_EOL; |
|
| 127 | + echo ' clearInterval(window.OSSimulatorId);'.PHP_EOL; |
|
| 128 | + echo ' return true;'.PHP_EOL; |
|
| 129 | + echo ' }'.PHP_EOL; |
|
| 130 | + echo ' return false;'.PHP_EOL; |
|
| 131 | + echo ' }'.PHP_EOL; |
|
| 132 | + echo ' window.OSSimulatorId = setInterval(function () {'.PHP_EOL; |
|
| 133 | + echo ' loadSimulator();'.PHP_EOL; |
|
| 134 | + echo ' }, 2000);'.PHP_EOL; |
|
| 135 | + echo '</script>'.PHP_EOL; |
|
| 136 | 136 | |
| 137 | 137 | //Show promoted html |
| 138 | 138 | if (isset($productId) && $this->isPromoted($productId)) { |
| 139 | 139 | echo "<div id='promotedText' style='display:none'><br/>".$this->extraConfig['PAGANTIS_PROMOTED_PRODUCT_CODE']."</div>"; |
| 140 | - echo '<script>'. PHP_EOL; |
|
| 141 | - echo ' function loadPromoted()'. PHP_EOL; |
|
| 142 | - echo ' {'. PHP_EOL; |
|
| 143 | - echo 'var positionSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR']. '\';'. PHP_EOL; |
|
| 144 | - echo 'if (positionSelector === \'default\') {'. PHP_EOL; |
|
| 145 | - echo 'positionSelector = \'.buttonSet\''. PHP_EOL; |
|
| 146 | - echo '}'. PHP_EOL; |
|
| 140 | + echo '<script>'.PHP_EOL; |
|
| 141 | + echo ' function loadPromoted()'.PHP_EOL; |
|
| 142 | + echo ' {'.PHP_EOL; |
|
| 143 | + echo 'var positionSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'].'\';'.PHP_EOL; |
|
| 144 | + echo 'if (positionSelector === \'default\') {'.PHP_EOL; |
|
| 145 | + echo 'positionSelector = \'.buttonSet\''.PHP_EOL; |
|
| 146 | + echo '}'.PHP_EOL; |
|
| 147 | 147 | echo 'var docFather = document.querySelector(positionSelector);'.PHP_EOL; |
| 148 | - echo 'if (typeof docFather != \'undefined\') {'. PHP_EOL; |
|
| 148 | + echo 'if (typeof docFather != \'undefined\') {'.PHP_EOL; |
|
| 149 | 149 | echo 'var promotedNode = document.getElementById("promotedText");'.PHP_EOL; |
| 150 | 150 | echo 'docFather.appendChild(promotedNode);'.PHP_EOL; |
| 151 | - echo 'promotedNode.style.display=""' . PHP_EOL; |
|
| 152 | - echo ' clearInterval(window.OSPromotedId);'. PHP_EOL; |
|
| 153 | - echo ' return true;'. PHP_EOL; |
|
| 154 | - echo ' }'. PHP_EOL; |
|
| 155 | - echo ' return false;'. PHP_EOL; |
|
| 156 | - echo ' }'. PHP_EOL; |
|
| 157 | - echo ' window.OSPromotedId = setInterval(function () {'. PHP_EOL; |
|
| 158 | - echo ' loadPromoted();'. PHP_EOL; |
|
| 159 | - echo ' }, 2000);'. PHP_EOL; |
|
| 160 | - echo '</script>'. PHP_EOL; |
|
| 151 | + echo 'promotedNode.style.display=""'.PHP_EOL; |
|
| 152 | + echo ' clearInterval(window.OSPromotedId);'.PHP_EOL; |
|
| 153 | + echo ' return true;'.PHP_EOL; |
|
| 154 | + echo ' }'.PHP_EOL; |
|
| 155 | + echo ' return false;'.PHP_EOL; |
|
| 156 | + echo ' }'.PHP_EOL; |
|
| 157 | + echo ' window.OSPromotedId = setInterval(function () {'.PHP_EOL; |
|
| 158 | + echo ' loadPromoted();'.PHP_EOL; |
|
| 159 | + echo ' }, 2000);'.PHP_EOL; |
|
| 160 | + echo '</script>'.PHP_EOL; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | if ($checkoutPage) { |
| 164 | - echo '<script>' . PHP_EOL; |
|
| 165 | - echo 'function checkSelected(value)'. PHP_EOL; |
|
| 166 | - echo '{'. PHP_EOL; |
|
| 167 | - echo 'var simulator = document.getElementsByClassName("buttonSet");' . PHP_EOL; |
|
| 168 | - echo ' if(simulator == "undefined") { return false; } '. PHP_EOL; |
|
| 169 | - echo 'if(value==\'pagantis\') { var status="" } else { var status="none";} simulator[0].style.display=status; ' . PHP_EOL; |
|
| 170 | - echo '}'. PHP_EOL; |
|
| 171 | - |
|
| 172 | - echo 'function showSimulator()'. PHP_EOL; |
|
| 173 | - echo '{'. PHP_EOL; |
|
| 174 | - echo 'var elements = document.querySelectorAll("input[name=\'payment\']");' . PHP_EOL; |
|
| 175 | - echo 'if(elements == null) { return false };' . PHP_EOL; |
|
| 164 | + echo '<script>'.PHP_EOL; |
|
| 165 | + echo 'function checkSelected(value)'.PHP_EOL; |
|
| 166 | + echo '{'.PHP_EOL; |
|
| 167 | + echo 'var simulator = document.getElementsByClassName("buttonSet");'.PHP_EOL; |
|
| 168 | + echo ' if(simulator == "undefined") { return false; } '.PHP_EOL; |
|
| 169 | + echo 'if(value==\'pagantis\') { var status="" } else { var status="none";} simulator[0].style.display=status; '.PHP_EOL; |
|
| 170 | + echo '}'.PHP_EOL; |
|
| 171 | + |
|
| 172 | + echo 'function showSimulator()'.PHP_EOL; |
|
| 173 | + echo '{'.PHP_EOL; |
|
| 174 | + echo 'var elements = document.querySelectorAll("input[name=\'payment\']");'.PHP_EOL; |
|
| 175 | + echo 'if(elements == null) { return false };'.PHP_EOL; |
|
| 176 | 176 | |
| 177 | 177 | echo 'for(var i = 0, max = elements.length; i < max; i++) { elements[i].onclick = function() { |
| 178 | 178 | checkSelected(this.value); |
| 179 | 179 | } }' . PHP_EOL; |
| 180 | 180 | echo 'clearInterval(window.OSdisplayId);'; |
| 181 | - echo 'return true;'. PHP_EOL; |
|
| 182 | - echo '};'. PHP_EOL; |
|
| 181 | + echo 'return true;'.PHP_EOL; |
|
| 182 | + echo '};'.PHP_EOL; |
|
| 183 | 183 | |
| 184 | - echo ' window.OSdisplayId = setInterval(function () {'. PHP_EOL; |
|
| 185 | - echo ' showSimulator();'. PHP_EOL; |
|
| 186 | - echo ' }, 2000);'. PHP_EOL; |
|
| 184 | + echo ' window.OSdisplayId = setInterval(function () {'.PHP_EOL; |
|
| 185 | + echo ' showSimulator();'.PHP_EOL; |
|
| 186 | + echo ' }, 2000);'.PHP_EOL; |
|
| 187 | 187 | |
| 188 | 188 | |
| 189 | - echo '</script>'. PHP_EOL; |
|
| 189 | + echo '</script>'.PHP_EOL; |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * install |
| 210 | 210 | */ |
| 211 | 211 | function install() { |
| 212 | - 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())"); |
|
| 212 | + 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())"); |
|
| 213 | 213 | |
| 214 | 214 | } |
| 215 | 215 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * remove |
| 218 | 218 | */ |
| 219 | 219 | function remove() { |
| 220 | - tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); |
|
| 220 | + tep_db_query("delete from ".TABLE_CONFIGURATION." where configuration_key in ('".implode("', '", $this->keys())."')"); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /** |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | if ($this->extraConfig['PAGANTIS_PROMOTION'] == '') { |
| 245 | 245 | $promotedProducts = array(); |
| 246 | - } else { |
|
| 246 | + }else { |
|
| 247 | 247 | $promotedProducts = array_values((array)unserialize($this->extraConfig['PAGANTIS_PROMOTION'])); |
| 248 | 248 | } |
| 249 | 249 | |