BuyCourses plugin: update display of payment methods if no method available or only one method

pull/2487/head
Yannick Warnier 7 years ago
parent 27dd647ce5
commit 4ec2affebb
  1. 2
      plugin/buycourses/lang/english.php
  2. 3
      plugin/buycourses/lang/french.php
  3. 4
      plugin/buycourses/lang/spanish.php
  4. 29
      plugin/buycourses/src/process.php

@ -135,3 +135,5 @@ $strings['PaymentMethod'] = "Payment method";
$strings['SWIFT'] = "SWIFT code";
$strings['SWIFT_help'] = "Standard format of Bank Identifier Codes (BIC) and serves as a unique identifier for a bank or financial institution";
$strings['PleaseSelectThePaymentMethodBeforeConfirmYourOrder'] = "Please select your favorite payment method before confirming your order";
$strings['NoPaymentOptionAvailable'] = 'No payment option available. Please report to the administrator.';
$strings['XIsOnlyPaymentMethodAvailable'] = '%s is the only payment method available for this purchase.';

@ -133,3 +133,6 @@ $strings['ByUser'] = "Par utilisateur";
$strings['PaymentMethod'] = "Méthodes de paiement";
$strings['SWIFT'] = "Code SWIFT";
$strings['SWIFT_help'] = "Format standard des codes d'identification de banque (BIC) et sert un identifiant unique pour une banque ou une institution financière.";
$strings['PleaseSelectThePaymentMethodBeforeConfirmYourOrder'] = 'Veuillez sélectionner votre méthode de paiement préférée avant de confirmer';
$strings['NoPaymentOptionAvailable'] = 'Aucune méthode de paiement disponible. Merci de bien vouloir rapporter ce problème à l\'administrateur.';
$strings['XIsOnlyPaymentMethodAvailable'] = '%s est la seule méthode de paiement disponible pour cet achat.';

@ -157,7 +157,7 @@ $strings['IConfirmIReadAndAcceptTermsAndCondition'] = "He leído y aceptado los
$strings['NoTermsAndConditionsProvided'] = "Terminos y condiciones no establecidos";
$strings['GlobalConfig'] = "Configuración global:";
$strings['WriteHereTheTermsAndConditionsOfYourECommerce'] = "Escriba aquí los terminos y condiciones para su tienda virtual";
$strings['PleaseSelectThePaymentMethodBeforeConfirmYourOrder'] = "Porfavor seleccione el método de pago de su preferencia antes de confirmar su orden";
$strings['PleaseSelectThePaymentMethodBeforeConfirmYourOrder'] = "Por favor seleccione el método de pago de su preferencia antes de confirmar su orden";
$strings['MyServices'] = "Mis servicios";
$strings['ServiceId'] = "Id de servicio";
$strings['BoughtBy'] = "Comprado por";
@ -171,3 +171,5 @@ $strings['AdditionalInfoRequired'] = 'Se requiere que se elija la información a
$strings['ServiceDeleted'] = 'Servicio eliminado';
$strings['DeleteThisService'] = 'Eliminar este servicio';
$strings['YourCoursesNeedAtLeastOneLearningPath'] = 'Los cursos en los que estás registrado necesitan tener al menos una lección que contenga un item de cerficado final';
$strings['NoPaymentOptionAvailable'] = 'No existen opciones de pago. Por favor reporte este problema al administrador.';
$strings['XIsOnlyPaymentMethodAvailable'] = '%s es el único método de pago disponible para esta compra.';

@ -82,11 +82,30 @@ if (!$culqiEnabled) {
unset($paymentTypesOptions[BuyCoursesPlugin::PAYMENT_TYPE_CULQI]);
}
$form->addHtml(
Display::return_message($plugin->get_lang('PleaseSelectThePaymentMethodBeforeConfirmYourOrder'),
'info')
);
$form->addRadio('payment_type', null, $paymentTypesOptions);
$count = count($paymentTypesOptions);
if ($count === 0) {
$form->addHtml($plugin->get_lang('NoPaymentOptionAvailable'));
$form->addHtml('<br />');
$form->addHtml('<br />');
} elseif ($count === 1) {
$text = '';
// get the only array item
foreach ($paymentTypesOptions as $type => $value) {
$form->addHtml(sprintf($plugin->get_lang('XIsOnlyPaymentMethodAvailable'), $value));
$form->addHtml('<br />');
$form->addHtml('<br />');
$form->addHidden('payment_type', $type);
}
} else {
$form->addHtml(
Display::return_message(
$plugin->get_lang('PleaseSelectThePaymentMethodBeforeConfirmYourOrder'),
'info'
)
);
$form->addRadio('payment_type', null, $paymentTypesOptions);
}
$form->addHidden('t', intval($_GET['t']));
$form->addHidden('i', intval($_GET['i']));
$form->addButton('submit', $plugin->get_lang('ConfirmOrder'), 'check', 'success');

Loading…
Cancel
Save