Payments using Paypal System in OCS

Hi @vmarinj,

I’m having a bit of a hard time following what state the code is in, but overall, every variable in the locale key, e.g.:

<message key="payment.type.conferenceRegistration">My variables are {$a}, {$b}, and {$c}</message>

…must have counterparts in the array in OCSQueuedPayment.inc.php

return __('payment.type.conferenceRegistration', array(
    'a' => 'Variable A',
    'b' => 'Variable B',
    'c' => 'Variable C'
));

If you see a leftover {$a} or similar in the locale key after it’s translated, it’s because it was missing from the left-hand side of the array.

If the values aren’t what you expect, then check the right-hand side of the array assignment (the Variable A, Variable B, Variable C part in the above example). This is where you’ll have to get the right values from the PHP $schedConf object etc. The checks of the form…

$variable?'some value':'some other value'

…are applications of PHP’s ternary operator, described here: http://php.net/manual/en/language.operators.comparison.php

If you can confirm exactly where you’re stuck, I’ll see if I can provide a specific suggestion. The screenshots are helpful.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

The thing is that I do not know where else I have to make changes so that this screen changes the Description including the actual real of the conference and the type of registration:

I changed things in two files:

  • In /locale/es_ES/locale.xml I added (it was not at the beginning):
    Registro al congreso; {$schedConf}; {$registrationType}

  • I changed in the code of /classes/payment/ocs/OCSQueuedPayment.inc.php the last part of the getDescription function to fit with the variables in the locale.xml file:

     return __('payment.type.conferenceRegistration', array(
      					'schedConf' => ($schedConf?$schedConf->getFullTitle():__('common.none')),
      					'registrationType' => ($registrationType?$registrationType->getRegistrationTypeName():__('common.none')),
      				)) . $options;
    

But it does not work yet. The same description in the step for payment with paper is still there…
Thanks.

Hi @asmecher,
I finally figured it out how to solve the problem and it is working properly now.

I changed the key in /locale/es_ES/locale.xml (screenshot using the translator plugin):

And then I changed the code in /classes/payment/ocs/OCSQueuedPayment.inc.php in getDescription function:

At the end, it seems that it was only a bit problem in the writing of the keys.

Thank you very much for your support and attention!

Best,
Victoria

Hi @vmarinj,

Glad to hear it’s working well.

Regards,
Alec Smecher
Public Knowledge Project Team