Author Topic: [SOLVED] How to get the order id after the order confirmed?  (Read 4089 times)

mtaras

  • 3rd party VirtueMart Developer
  • Beginner
  • *
  • Posts: 28
    • easyTECH
[SOLVED] How to get the order id after the order confirmed?
« on: March 24, 2012, 09:27:56 am »
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

  • Jr. Member
  • **
  • Posts: 232
    • pages-and-items.com
Re: How to get the order id after the order confirmed?
« Reply #1 on: March 24, 2012, 10:07:24 am »
In those functions the order number is available
Code: [Select]
$order['details']['BT']->order_numberso try
Code: [Select]
$order['details']['BT']->virtuemart_order_idif 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:
Code: [Select]
if($paypal_data['payment_status']=='Completed'){
$this->add_sold_product_to_counter($virtuemart_order_id);
}

I hope that helps

mtaras

  • 3rd party VirtueMart Developer
  • Beginner
  • *
  • Posts: 28
    • easyTECH
Re: How to get the order id after the order confirmed?
« Reply #2 on: March 26, 2012, 13:59:40 pm »
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

  • 3rd party VirtueMart Developer
  • Beginner
  • *
  • Posts: 28
    • easyTECH
Re: How to get the order id after the order confirmed?
« Reply #3 on: March 26, 2012, 14:50:32 pm »
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

  • Jr. Member
  • **
  • Posts: 156
Re: [SOLVED] How to get the order id after the order confirmed?
« Reply #4 on: July 06, 2016, 08:05:09 am »
can you tell me how you did this?hoe you called vm paymebt plugin and how the first function?