Skip to content

Commit

Permalink
Merge pull request #26 from pagantis/INT-705
Browse files Browse the repository at this point in the history
Int 705
  • Loading branch information
pgarcess authored Sep 19, 2019
2 parents 51997ef + d06927e commit 582e6ee
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
7 changes: 4 additions & 3 deletions WC_Pagantis.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Pagantis
* Plugin URI: http://www.pagantis.com/
* Description: Financiar con Pagantis
* Version: 8.2.2
* Version: 8.2.3
* Author: Pagantis
*/

Expand Down Expand Up @@ -280,7 +280,7 @@ public function pagantisAddProductSimulator()
$allowedCountries = unserialize($this->extraConfig['PAGANTIS_ALLOWED_COUNTRIES']);
$allowedCountry = (in_array(strtolower($locale), $allowedCountries));
if ($cfg['enabled'] !== 'yes' || $cfg['pagantis_public_key'] == '' || $cfg['pagantis_private_key'] == '' ||
$cfg['simulator'] !== 'yes' || $product->price < $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] ||
$cfg['simulator'] !== 'yes' || $product->get_price() < $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] ||
!$allowedCountry ) {
return;
}
Expand All @@ -293,8 +293,9 @@ public function pagantisAddProductSimulator()
'positionSelector' => $this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'],
'quantitySelector' => unserialize($this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR']),
'priceSelector' => unserialize($this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']),
'totalAmount' => is_numeric($product->price) ? $product->price : 0,
'totalAmount' => is_numeric($product->get_price()) ? $product->get_price() : 0,
'locale' => $locale,
'country' => $locale,
'promoted' => $this->isPromoted($post_id),
'promotedMessage' => $this->extraConfig['PAGANTIS_PROMOTION_EXTRA'],
'thousandSeparator' => $this->extraConfig['PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR'],
Expand Down
5 changes: 3 additions & 2 deletions controllers/paymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,10 @@ public function payment_fields()
'total' => WC()->session->cart_totals['total'],
'enabled' => $this->settings['enabled'],
'min_installments' => $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'],
'simulator_enabled' => $this->settings['pagantis_simulator'],
'simulator_enabled' => $this->settings['simulator'],
'locale' => $locale,
'allowedCountry' => $allowedCountry,
'country' => $locale,
'allowed_country' => $allowedCountry,
'simulator_type' => $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'],
'promoted_amount' => $promotedAmount,
'thousandSeparator' => $this->extraConfig['PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR'],
Expand Down
6 changes: 4 additions & 2 deletions templates/checkout_description.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php if ($enabled!=='0' && isset($total) && $simulator_enabled!=='0' && $allowed_country!=='0') { ?>
<?php if ($enabled==='yes' && isset($total) && $simulator_enabled==='yes' && $allowed_country===true) { ?>
<div class="pagantisSimulator"></div>
<script>
window.WCsimulatorId = null;
Expand Down Expand Up @@ -26,6 +26,7 @@ function loadSimulator()
}
}

var country = '<?php echo $country; ?>';
var locale = '<?php echo $locale; ?>';
if (locale == 'es' || locale == '') {
var sdk = pmtSDK;
Expand All @@ -39,7 +40,8 @@ function loadSimulator()
selector: '.pagantisSimulator',
totalAmount: '<?php echo $total; ?>',
totalPromotedAmount: '<?php echo $promoted_amount; ?>',
locale: locale
locale: locale,
country: country
});
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions templates/product_simulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function loadSimulatorPagantis()

var price = '<?php echo $total;?>';

var country = '<?php echo $country; ?>';
var locale = '<?php echo $locale; ?>';
if (locale == 'es' || locale == '') {
var sdk = pmtSDK;
Expand All @@ -82,6 +83,7 @@ function loadSimulatorPagantis()
selector: positionSelector,
itemQuantitySelector: quantitySelector,
locale: locale,
country: country,
itemAmountSelector: priceSelector,
amountParserConfig : {
thousandSeparator: '<?php echo $thousandSeparator;?>',
Expand Down

0 comments on commit 582e6ee

Please sign in to comment.