VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: sandomatyas on September 24, 2021, 17:46:42 PM

Title: Get shipment table data for an order
Post by: sandomatyas on September 24, 2021, 17:46:42 PM
There is an order which I fetched via $ordersModel->getOrder( $virtuemart_order_id );
The object does not contain any data from #__virtuemart_shipment_plg_mypluginname table
How should I receive it with using VM's core methods instead of a direct SQL query?
Title: Re: Get shipment table data for an order
Post by: Milbo on October 04, 2021, 21:08:41 PM
call the trigger yourself

$returnValues = vDispatcher::trigger('plgVmOnShowOrderBEShipment',array(  $this->orderID,$this->orderbt->virtuemart_shipmentmethod_id, $this->orderdetails));

foreach ($returnValues as $returnValue) {
if ($returnValue !== null) {
echo $returnValue;
}
}


I may change this one against a directTrigger.
Title: Re: Get shipment table data for an order
Post by: sandomatyas on October 07, 2021, 06:30:45 AM
Thanks Milbo, but if I check plgVmOnShowOrderBEShipment in weight_countries.php it calls getOrderShipmentHtml() which returns a html table.
There is a code part:
$q = 'SELECT * FROM `' . $this->_tablename . '` '
. 'WHERE `virtuemart_order_id` = ' . $virtuemart_order_id;
$db->setQuery ($q);
$shipinfo = $db->loadObject ();

I'd like to access this $shipinfo object whithout mofifying the shipping plugin