Author Topic: Get shipment table data for an order  (Read 352 times)

sandomatyas

  • Jr. Member
  • **
  • Posts: 327
Get shipment table data for an order
« 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?

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10124
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Get shipment table data for an order
« Reply #1 on: October 04, 2021, 21:08:41 pm »
call the trigger yourself
Code: [Select]
$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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

sandomatyas

  • Jr. Member
  • **
  • Posts: 327
Re: Get shipment table data for an order
« Reply #2 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:
Code: [Select]
$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