0
私は、事前定義された質問プールからのランダム質問に対する正解が支払いとして有効な質問/回答に基づいて支払方法を作成しています。カスタム支払い方法モジュール
// 1) Here I take the question with ID = 1 cycle and the possible answers
foreach (Mage :: getModel ('emme_question/question') -> load (1) -> getSelectedAnswersCollection() as $ answer) {
// 2) for each control response if it is the correct one and if it has the same ID as the one chosen by the user
if ($ answer-> getIsCorrect() && ($ answer-> getId() == $ _POST ['my_custom_answer'])) {
// 3) if so show a success message to the user
Mage :: getSingleton (core/session ') -> addSuccess (' Correct answer ');
// You should be able to go to the next step
} Else {
// 4) in the event unleashed an exception to stop the negative checkout (and returning the user to the homepage)
Mage :: ThrowException ('Wrong answer!');
}
}
コードを完成させるのに役立ちましたか?