News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Order list in ADMIN vm2.6.2 simple enhancement

Started by AH, May 21, 2014, 12:58:58 PM

Previous topic - Next topic

AH

When viewing the order list it is useful to have a few additional pieces of information in the list view relating to the order

This speeds up aspects of shop admin as the order does not need to be opened and viewed to see phone and zip etc.

Suggestion - in   administrator\components\com_virtuemart\models\orders.php:-

Can you possibly add some additonal fields to the query, that can then be used in a template override??

I have included a sample of the use for such an adjustment in the image attached.


      $select = " o.*, CONCAT_WS(' ',u.first_name,u.middle_name,u.last_name) AS order_name "
            .',u.email as order_email,pm.payment_name AS payment_method,u.phone_1 AS phone, u.zip AS zip, u.city AS city';



/**
* Select the products to list on the product list page
* @param $uid integer Optional user ID to get the orders of a single user
* @param $_ignorePagination boolean If true, ignore the Joomla pagination (for embedded use, default false)
*/
public function getOrdersList($uid = 0, $noLimit = false)
{
// vmdebug('getOrdersList');
$this->_noLimit = $noLimit;
$select = " o.*, CONCAT_WS(' ',u.first_name,u.middle_name,u.last_name) AS order_name "
.',u.email as order_email,pm.payment_name AS payment_method ';
$from = $this->getOrdersListQuery();
/* $_filter = array();
if ($uid > 0) {
$_filter[] = ('u.virtuemart_user_id = ' . (int)$uid);
}*/

$where = array();
if(!class_exists('Permissions')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'permissions.php');
if(!Permissions::getInstance()->check('storeadmin')){
$myuser =JFactory::getUser();
$where[]= ' u.virtuemart_user_id = ' . (int)$myuser->id.' AND o.virtuemart_vendor_id = "1" ';
} else {
if(empty($uid)){
$where[]= ' o.virtuemart_vendor_id = "1" ';
} else {
$where[]= ' u.virtuemart_user_id = ' . (int)$uid.' AND o.virtuemart_vendor_id = "1" ';
}
}

if ($search = JRequest::getString('search', false)){

$search = '"%' . $this->_db->getEscaped( $search, true ) . '%"' ;
$search = str_replace(' ','%',$search);

$searchFields = array();
$searchFields[] = 'u.first_name';
$searchFields[] = 'u.middle_name';
$searchFields[] = 'u.last_name';
$searchFields[] = 'o.order_number';
$searchFields[] = 'u.company';
$searchFields[] = 'u.email';
$searchFields[] = 'u.phone_1';
$searchFields[] = 'u.address_1';
$searchFields[] = 'u.zip';
$where[] = implode (' LIKE '.$search.' OR ', $searchFields) . ' LIKE '.$search.' ';
//$where[] = ' ( u.first_name LIKE '.$search.' OR u.middle_name LIKE '.$search.' OR u.last_name LIKE '.$search.' OR `order_number` LIKE '.$search.')';
}

$order_status_code = JRequest::getString('order_status_code', false);
if ($order_status_code and $order_status_code!=-1){
$where[] = ' o.order_status = "'.$order_status_code.'" ';
}

if (count ($where) > 0) {
$whereString = ' WHERE (' . implode (' AND ', $where) . ') ';
}
else {
$whereString = '';
}

if ( JRequest::getCmd('view') == 'orders') {
$ordering = $this->_getOrdering();
} else {
$ordering = ' order by o.modified_on DESC';
}

$this->_data = $this->exeSortSearchListQuery(0,$select,$from,$whereString,'',$ordering);


return $this->_data ;
}







[attachment cleanup by admin]
Regards
A

Joomla 4.4.5
php 8.1