I write a custom script which loads orders.
I started like this
$this->_db = JFactory::getDBO();
$query = $this->_db->getQuery(true);
$query->select('virtuemart_order_id')
->from('#__virtuemart_orders')
->where('created_on > NOW() - INTERVAL 60 DAY');
$this->_db->setQuery($query);
$items = $this->_db->loadObjectList();
foreach($items as $item) {
$order = $ordersModel->getOrder( $item->virtuemart_order_id );
}
there is an $order['details']['BT']->virtuemart_paymentmethod_id and the same for shipping but could you please help me how should I get the name of the payment/shipment method as text?
$shipmentModel= VmModel::getModel('shipmentmethod');
$shipmentmethod = $shipmentModel->getShipment($order['details']['BT']->virtuemart_shipmentmethod_id);
$shipmentName = $shipmentmethod->shipment_name;
$paymentModel= VmModel::getModel('paymentmethod');
$paymentmethod = $paymentModel->getPayment($order['details']['BT']->virtuemart_paymentmethod_id);
$paymentName = $paymentmethod->payment_name;
or
$db = JFactory::getDBO();
$db->setQuery("SELECT payment_name FROM #__virtuemart_paymentmethods_de_de WHERE virtuemart_paymentmethod_id=".$order['details']['BT']->virtuemart_paymentmethod_id);
$db->query();
$paymentName = $db->loadResult();
$db = JFactory::getDBO();
$db->setQuery("SELECT shipment_name FROM #__virtuemart_shipmentmethods_de_de WHERE virtuemart_shipmentmethod_id=".$order['details']['BT']->virtuemart_shipmentmethod_id);
$db->query();
$shipmentName = $db->loadResult();
thanks