[SOLVED] How to get the order id after the order confirmed?

Started by mtaras, March 24, 2012, 09:27:56 AM

Previous topic - Next topic

mtaras

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

carsten888

#1
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

mtaras

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


mtaras

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.

pm4698

can you tell me how you did this?hoe you called vm paymebt plugin and how the first function?