Hi there. I have a Joomla 3.10.4 and Virtuemart 3.8.8. Inside orderdone.php I would like to get order's product ids.
What was inside orderdone.php
$db = JFactory::getDBO();
$query = "SELECT * FROM #__virtuemart_orders ORDER BY virtuemart_order_id DESC LIMIT 0, 1";
$db->setQuery($query);
$res_obj = $db->LoadObject();
What I did is this:
$productquery = "SELECT virtuemart_product_id FROM #__virtuemart_order_items WHERE virtuemart_order_id='".$res_obj->virtuemart_order_id."'";
$db->setQuery($productquery);
$res_obj2 = $db->LoadObject();
print_r($res_obj2);
So If i run query of what I did in phpMyAdmin with my latest order id, then query works (if I have 2 items in order I see the 2 items). In my php code, inside the print_r, I get only 1 product from the order and not all.
Any ideas?
Thank you in advance
In orderdone.php is only
echo $this->html;
from every payment plugin.
I think your construct can't function anytime.
So I don't have ideas too.
Maybe go to payment plugin and hack this.
pm4698, your query is not safe, because you get last oder and this order can be form another user, if someone finish the order at same date time
Perhaps you can get orderdetails using
$cart = VirtueMartCart::getCart();
var_dump($cart->orderDetails);
I think you should see the current order from last cart
Thank you all for your input. When trying to print_r($this) i don't get any details regarding order items, just the order. Also tried:
$cart = VirtueMartCart::getCart();
var_dump($cart->orderDetails);
but I get error message that couldn't find the function. Any ideas?
QuoteAny ideas?
I think, I already wrote it to you:
The value for $this is generated by the payment plugin, look at its code and create your own.