Hi,
I'm using VirtueMart for demos and I would need today a fake payment method ( fake as there will be no real payment nor money sent and received )
Note that I can not use paypal in sandbox mode ( this is what I was doing till now ...)
Here would be the flow :
Customer select payment Method and click chekckout
New window/ pop-up is displayed with HTML/php/JS ..etc.. inside
user "is paying "
go back to virtuemart with payment OK / KO
Virtuemart order is updated
anyone would have some insights doing this, keeping in mind that I'm not a great coder.
I checked the "standard" payemnt method but seems that there is no "payment feedback" done no ?
Thanks in advance
QuoteNew window/ pop-up is displayed with HTML/php/JS ..etc.. inside
user "is paying "
Custom developing for every payments method
hi,
in can be in the same window...
In fact I'm looking for some samples or insghts of the plugin itself.
having a pop up is just a detail ...
Easier just to use the standard payment plugin, as used in VM demo for Cash on delivery
Hi jenkinhill,
thanks for your attention
That was my first understanding yes.
But how can I do that ?
I can "duplicate" the standard plugin with a different name and update everything accordingly ( name, variables ...etc.). This should be fine
Now, how /where can I trigger my code ( for example for me to start, jsut a javascript like "console.log("blablabla" ) ?
Thx
You are likely to need to develop functionality in the trigger function:
function plgVmConfirmedOrder ($cart, $order) {
Hi AH,
sorry for my dummy quesiton I guess, but to be sure
I "just" to add code in this function and that's it ?
it will take care about the feedback and update the cart / payement in virtuemart ? ( means I shoudl have to do somehting no ? like a return type or content ? )
like
function plgVmConfirmedOrder ($cart, $order) {
echo " hello world" ;
}
It might need to be a little more complex than that
e.g. You could clear data, set cart session "stuff, set vars - whatever..
$html .= $this->renderByLayout($layout, SOME STUFF IF REQUIRED));
$cart->_confirmDone = FALSE;
$cart->_dataValidated = FALSE;
$cart->setCartIntoSession ();
vRequest::setVar ('html', $html);
I was doing some tests in the meantime
I tried to have a look at the documentation but far to be clear for me ...
thanks for the info
in your SOME STUFF IS REQUIRED, from what I see in the code , I must put :
array(
'order_number' =>$order['details']['BT']->order_number,
'order_pass' =>$order['details']['BT']->order_pass,
'payment_name' => $dbValues['payment_name'],
'displayTotalInPaymentCurrency' => $totalInPaymentCurrency['display'])
right ?
Now I assume this is that line qhich updates the order status
$modelOrder->updateStatusForOneOrder ($order['details']['BT']->virtuemart_order_id, $order, TRUE);
Should I change it to something else to get the payment status to "paid" ?
Osrry again for all these basic and dummies questions, I guess it
sounds obvious but my plan is not to become an expert coder on Virtuemart but to have somehting
basic working
thanks !
right?
It depends on what you want to achieve
Should I change it to something else to get the payment status to "paid" ?
No - this should be handled by the plugin configuration for a confirmed order
The basics are working. 8)
What you are trying to Will probably be a Long Journey for you. The plugins are self explanatory. You might want to look Up basics Joomla plugin programming before you go any further. Plenty of examples if you just Google.
Jörgen @ Kreativ Fotografi
Hello,
Using the standard payment plugin, I finally managed to get what I needed ( and using code example from the forum on other dicussions)
remains just 1 point I do not get and make it working : change the order status as confirmed through a javascript function.
I found that code in ajax , this update the status when payment is ok
jQuery(document).ready(function ($) {
$('#checkout-payment-ok').click(function () {
$.ajax({
url: '<?php echo $redirect_emtry_cart; ?>',
type: 'post',
data: {'type': $('#type_success').val()},
dataType: 'html',
success: function (data, textStatus, jqXHR) {
$('#type_success').val('none');
$('.message-thankyou').show();
$('#checkout-payment-ok').unbind('click');
console.log('payment OK');
}
})
})
How can I change this to a basic function like
set_payment_ok ()
{
XXX
}
I tried replacing some stuff , but it is not working.
I have see as well some API calls, which coudl be fine to me as well ( very easy for me to do an API call during the fake payment process )
Thanks for your insights !
why not use the native php payment confirm status change?
$modelOrder = VmModel::getModel ('orders');
$order['order_status'] = $this->getNewStatus ($method);
$order['customer_notified'] = 1;
$order['comments'] = '';
$modelOrder->updateStatusForOneOrder ($order['details']['BT']->virtuemart_order_id, $order, TRUE);
or have I misunderstood?
Because my "payment method confirmation " is done trough javascript, that's why I can not use PHP :(