Problem to enrol the course when when the cost is zero.

9 years 3 months ago
renato
Posts: 3
More
Topic Author
Problem to enrol the course when when the cost is zero. #1
Hi,
Let’s see if everyone can help me.
I’m using in my web site:
-Joomla 1.5.23;
-Joomdle 0.54;
- Moodle 1.9.13;
- VirtueMart 1.1.9 (using the PayPal pay method) ;
Everything is working very well, but when I offer a free course (e.g. U$=0) in this case, The user is not submitted to PayPal web site and consequently, we have no feedback from PayPal and the user is not enrolled by Joomdle. So I would like to know if someone could help me to solve this problem. Thank you very much!
The code is:

<?php
$db1 = new ps_DB();
$q = "SELECT country_2_code FROM #__vm_country WHERE country_3_code='".$user->country."' ORDER BY country_2_code ASC";
$db1->query($q);
$url = " www.paypal.com/cgi-bin/webscr k";
$tax_total = $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total = $db->f("coupon_discount") + $db->f("order_discount");
$post_variables = Array(
"cmd" => "_ext-enter",
"redirect_cmd" => "_xclick",
"upload" => "1",
"business" => PAYPAL_EMAIL,
"receiver_email" => PAYPAL_EMAIL,
"item_name" => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').": ". $db->f("order_id"),
"order_id" => $db->f("order_id"),
"invoice" => $db->f("order_number"),
"amount" => round( $db->f("order_subtotal")+$tax_total-$discount_total, 2),
"shipping" => sprintf("%.2f", $db->f("order_shipping")),
"currency_code" => $_SESSION,
"address_override" => "1",
"first_name" => $dbbt->f('first_name'),
"last_name" => $dbbt->f('last_name'),
"address1" => $dbbt->f('address_1'),
"address2" => $dbbt->f('address_2'),
"zip" => $dbbt->f('zip'),
"city" => $dbbt->f('city'),
"state" => $dbbt->f('state'),
"country" => $db1->f('country_2_code'),
"email" => $dbbt->f('user_email'),
"night_phone_b" => $dbbt->f('phone_1'),
"cpp_header_image" => $vendor_image_url,
"return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id"),
"notify_url" => SECUREURL ."administrator/components/com_joomdle/paypal_notify.php",
"cancel_return" => SECUREURL ."index.php",
"undefined_quantity" => "0",
"test_ipn" => PAYPAL_DEBUG,
"pal" => "NRUBJXESJTY24",
"no_shipping" => "1",
"no_note" => "1"
);
if( $page == "checkout.thankyou" ) {
$query_string = "?";
foreach( $post_variables as $name => $value ) {
$query_string .= $name. "=" . urlencode($value) ."&";
}
vmRedirect( $url . $query_string );
} else {
echo '<form action="'.$url.'" method="post" target="_blank">';
echo '<input type="image" name="submit" src=" www.paypal.com/en_US/i/btn/x-click-but6.gif k" alt="Click to pay with PayPal - it is fast, free and secure!" />';
foreach( $post_variables as $name => $value ) {
echo '<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />';
}
echo '</form>';
}
?>

Please Log in or Create an account to join the conversation.

9 years 3 months ago
Antonio Durán
Posts: 7252
More
Problem to enrol the course when when the cost is zero. #2
Hi.

There is currently no way of handling free courses trough VM, as is the paypal IPN which does this job.
To do that you would need to patch VM core code.

Please Log in or Create an account to join the conversation.

9 years 3 months ago
renato
Posts: 3
More
Topic Author
Problem to enrol the course when when the cost is zero. #3
Hi Antonio,
Thank you very much for you quickly feedback.
Have you already did something like it? Do you have any idea how I can do it?!
If you have step by step I will be very grateful, because I don’t have many experience, I am beginning and learning in my web site.

I was wondering another way to try to solve it, but I also not sure how I can do it. When the buy process is concluded in the VM a email is sent to the customer, so do you know if it is possible to add in this email a enroll joomdle link of the course?

I don`t know which is easer?
Thanks for your help

Please Log in or Create an account to join the conversation.

9 years 3 months ago
Antonio Durán
Posts: 7252
More
Problem to enrol the course when when the cost is zero. #4
Hi.

I have not done exactly that, but here: www.joomdle.com/wiki/Other_payment_methods k
You have a patch for VM to handle authorize.net transactions.

I think this could be modified to handle free courses, but you will need some PHP and VM knowledge to do it.

Please Log in or Create an account to join the conversation.

9 years 3 months ago
renato
Posts: 3
More
Topic Author
Problem to enrol the course when when the cost is zero. #5
Olá Antonio,
PS: observei em um outro tópico que você compreende português... acho que consigo te explicar melhor assim...
Como não é mais possível utilizar o paypal para vender para usuário não cadastrados no paypal, estou partindo para uma outra solução que é o pagseguro, também bastante utilizado aqui no Brasil. Mas ai estou batendo no mesmo problema anterior, que é de quando tenho cursos com custo zero e o VM reconhece e confirma a aquisição do curso, porém não é notificado o Joomdle e ai a matricula não é realizada....
Não existe ou seria muito difícil e caro gerar um plugin que quando confirmado a compra no VM o VM gerasse uma notificação para o Joomdle, e ai sim realizando a matricula no moodle. Se tiver idéia de custos para essa personalização me avisa, acho que seria bastante interresante e deixaria o Joomdle desvinculado da forma de pagamento e sim ao status do VM.
Novamente obrigado Antonio
Ital

Please Log in or Create an account to join the conversation.

9 years 3 months ago
Antonio Durán
Posts: 7252
More
Problem to enrol the course when when the cost is zero. #6
Olá Itai.

Vou tentar falar portugúes... no sei si consigo :)

Nao e possivel fazer um plugin de notificaçao, porque o VM nao tem um evento para "compra confirmada" ou "order status changed".
É por isso que sería precisso fazer um patch para VM, que quando o custo e zero, faz a notificaçao ao Moodle.

Com Tienda, é possivel ter um plugin geral, desvinculado da forma de pagamento.

If you want to sponsor the development of a "zero cost" patch for VM, please write us at This email address is being protected from spambots. You need JavaScript enabled to view it.

Antonio

Please Log in or Create an account to join the conversation.