Hi,
I try to develop a simple custom plugin.
I have use the
function plgVmConfirmedOrder($cart, $order) to do some calls when an order confirmed.
But how can I get the order id when the user confirm the order? As I can see there is no post data on the confirm form.
Some help please.
Thanks
In those functions the order number is available
$order['details']['BT']->order_number
so try
$order['details']['BT']->virtuemart_order_id
if that does not work, query the id from the order number
To call some script when the order is confirmed I use function plgVmOnPaymentNotification()
in that function:
if($paypal_data['payment_status']=='Completed'){
$this->add_sold_product_to_counter($virtuemart_order_id);
}
I hope that helps
Thanks for your help.
I understand the call of $order['details']['BT']->order_number but I have problem how to catch the $order var.
In paypal payment plugin these is some code like
$paypal_data = JRequest::get('post');
to retrieve the data from payment and then
$order_number = $paypal_data['invoice'];
$virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($paypal_data['invoice']);
to get the id. Then it is clearly how to retrive data.
With your code example we need to have the $order var filled with data and then to use it.
I want to use my custom plugin to all payment methods, not only on some install like paypal.
So I need to know how can I access the $order var.
Some help on this issue?
Thanks
OK I found the solution. I need to create payment plugin and not custom. When I create payment vm plugin the $order var is accessible.
Thanks.
can you tell me how you did this?hoe you called vm paymebt plugin and how the first function?