diff --git a/README.md b/README.md index 63b89fc..7acc518 100644 --- a/README.md +++ b/README.md @@ -40,4 +40,10 @@ Under the extension settings, you can: * Set payment mode (test/live) * Change the capture type (Instant/Manual via Paylike Tool) - +## Limitations + + * In order to use the Paylike module you'll need to set "Number of decimals" option to match the paylike supported decimals. Since this is a global setting that affects all currencies you cannot use at the same time currencies with different decimals. + Change this option from: Admin -> Preferences -> General + + * Paylike doesn't provide support for customizable decimals display. In order to display the correct values durring the payment process you'll need to set "Decimals" option to value "True" for the "Edit" panel of the currencies used in your store. + Change this option from: Admin -> Localization -> Currencies \ No newline at end of file diff --git a/paylikepayment/paylikepayment.php b/paylikepayment/paylikepayment.php index 7d41fc4..5f8ccc9 100644 --- a/paylikepayment/paylikepayment.php +++ b/paylikepayment/paylikepayment.php @@ -269,6 +269,7 @@ public function getContent() { public function renderCurrencyWarning() { $currencies = Currency::getCurrencies(); $warning_currencies = array(); + $warning_decimals = array(); foreach ( $currencies as $currency ) { if ( $this->getPaylikeCurrencyMultiplier( $currency['iso_code'] ) == 1 && Configuration::get( 'PS_PRICE_DISPLAY_PRECISION' ) != 0 ) { $warning_currencies[0][] = $currency['iso_code']; @@ -280,14 +281,20 @@ public function renderCurrencyWarning() { $warning_currencies[3][] = $currency['iso_code']; } elseif ( $this->getPaylikeCurrencyMultiplier( $currency['iso_code'] ) == 10000 && Configuration::get( 'PS_PRICE_DISPLAY_PRECISION' ) != 4 ) { $warning_currencies[4][] = $currency['iso_code']; + } + + if ( !$currency['decimals'] ) { + $warning_decimals[] = $currency['iso_code']; } } - if ( count( $warning_currencies ) ) { + + if ( count( $warning_currencies ) || count( $warning_decimals ) ) { $this->context->smarty->assign( array( 'warning_currencies_decimal' => $warning_currencies, - 'PS_PRICE_DISPLAY_PRECISION' => Configuration::get( 'PS_PRICE_DISPLAY_PRECISION' ), - 'preferences_url' => $this->context->link->getAdminLink( 'AdminPreferences' ) + 'warning_currencies_display_decimals' => $warning_decimals, + 'preferences_url' => $this->context->link->getAdminLink( 'AdminPreferences' ), + 'currencies_url' => $this->context->link->getAdminLink( 'AdminCurrencies' ) ) ); diff --git a/paylikepayment/views/templates/admin/currency-warning.tpl b/paylikepayment/views/templates/admin/currency-warning.tpl index 49fc5d9..95951b5 100644 --- a/paylikepayment/views/templates/admin/currency-warning.tpl +++ b/paylikepayment/views/templates/admin/currency-warning.tpl @@ -7,14 +7,32 @@ * @link http://www.derikon.com/ * *} -

- {l s='Note: Due to prestashop standards we need to abide to, currencies decimals must match the paylike supported decimals. In order to use the Paylike module for the following currencies, you\'ll need to set "Number of decimals" option to the number shown bellow from tab. Since this is a global setting that affects all currencies you cannot use at the same time currencies with different decimals.' mod='paylikepayment'} - {l s='Preferences -> General' mod='paylikepayment'} -
- {foreach from=$warning_currencies_decimal key=decimals item=currency} - {foreach from=$currency item=iso_code} - {$iso_code} {l s='supports only' mod='paylikepayment'} {$decimals} {l s='decimals' mod='paylikepayment'} -
+{if $warning_currencies_decimal|@count} +

+ {l s='Note: Due to prestashop standards we need to abide to, currencies decimals must match the paylike supported decimals. In order to use the Paylike module for the following currencies, you\'ll need to set "Number of decimals" option to the number shown bellow from tab. Since this is a global setting that affects all currencies you cannot use at the same time currencies with different decimals.' mod='paylikepayment'} +
+ {l s='Preferences -> General' mod='paylikepayment'} +
+ {foreach from=$warning_currencies_decimal key=decimals item=currency} + {foreach from=$currency item=iso_code} + {$iso_code} {l s='supports only' mod='paylikepayment'} {$decimals} {l s='decimals' mod='paylikepayment'} +
+ {/foreach} {/foreach} - {/foreach} -

\ No newline at end of file +

+ {/if} + + {if $warning_currencies_display_decimals|@count} +

+ {l s='Warning: Paylike doesn`t provide support for customizable decimals display. In order to display the correct values durring the payment process you`ll need to set "Decimals" option to value "True" for the edit menu of the currencies listed below.' mod='paylikepayment'} +
+ {l s='Localization -> Currencies' mod='paylikepayment'} +
+ {foreach from=$warning_currencies_decimal key=decimals item=currency} + {foreach from=$currency item=iso_code} + {$iso_code} +
+ {/foreach} + {/foreach} +

+{/if} \ No newline at end of file