VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: Kuubs on April 28, 2017, 12:14:05 PM

Title: Get order details by order id
Post by: Kuubs on April 28, 2017, 12:14:05 PM
Is it possible to get all the orderdetails via an order id? With a virtuemart function?
Title: Re: Get order details by order id
Post by: GJC Web Design on April 28, 2017, 14:04:49 PM
orders model

/**
    * Load a single order, Attention, this function is not protected! Do the right manangment before, to be certain
     * we suggest to use getMyOrderDetails
    */
   public function getOrder($virtuemart_order_id){ 

there is also


public static function getOrderIdByOrderNumber($orderNumber){
Title: Re: Get order details by order id
Post by: Kuubs on April 28, 2017, 15:15:23 PM
Quote from: GJC Web Design on April 28, 2017, 14:04:49 PM
orders model

/**
    * Load a single order, Attention, this function is not protected! Do the right manangment before, to be certain
     * we suggest to use getMyOrderDetails
    */
   public function getOrder($virtuemart_order_id){ 

there is also


public static function getOrderIdByOrderNumber($orderNumber){

Thanks for this. And how can I use this in my list.php file in the orders template folder? VmFunctions?
Title: Re: Get order details by order id
Post by: GJC Web Design on April 29, 2017, 00:43:40 AM
as any VM function is called

defined('DS') or define('DS', DIRECTORY_SEPARATOR);
if (!class_exists( 'VmConfig' )) require(JPATH_ROOT .'/administrator/components/com_virtuemart/helpers/config.php');
if(!class_exists('VmModel'))require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'vmmodel.php');
            $order_model = VmModel::getModel('orders');
            $myorder = $order_model->getOrder($virtuemart_order_id);

you may not need all this -- depends what is initialised in your file
Title: Re: Get order details by order id
Post by: Kuubs on May 01, 2017, 10:41:58 AM
Quote from: GJC Web Design on April 29, 2017, 00:43:40 AM
as any VM function is called

defined('DS') or define('DS', DIRECTORY_SEPARATOR);
if (!class_exists( 'VmConfig' )) require(JPATH_ROOT .'/administrator/components/com_virtuemart/helpers/config.php');
if(!class_exists('VmModel'))require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'vmmodel.php');
            $order_model = VmModel::getModel('orders');
            $myorder = $order_model->getOrder($virtuemart_order_id);

you may not need all this -- depends what is initialised in your file

Thanks GJC Web Design. You've helped me a lot of times with Virtuemart now, now but also in the past. Cannot thank you enough for that!