Skip to main content

[Virtuemart] Customize Order List - adding extra column

In this post, I am going explain on how to add an extra column in Virtuemart Administrator Order List page. (Note that, in this example, I'm going to add a new address_1 column).


Getting Started.

In /administrator/components/com_virtuemart/html/order.order_list.php

locate this section, around line 27. Then add "address_1" into the line, as below.

//$list .= "first_name, last_name FROM #__{vm}_orders, #__{vm}_order_user_info WHERE ";
// This is the modified line.
$list .= "first_name, last_name, address_1 FROM #__{vm}_orders, #__{vm}_order_user_info WHERE ";


After that, locate this section, as usual and note that "Address_1" is already the added column.
$columns = Array(  "#" => "width=\"20\"", 
     "<input type=\"checkbox\" name=\"toggle\" value=\"\" 
onclick=\"checkAll(".$checklimit.")\" />" => "width=\"20\"",
     $VM_LANG->_('PHPSHOP_ORDER_LIST_ID') => '',
     $VM_LANG->_('PHPSHOP_ORDER_PRINT_NAME') => '',
     // This is you "address_1" column header,
     'Address_1' => '',
     $VM_LANG->_('PHPSHOP_ORDER_LIST_PRINT_LABEL') => '',
     $VM_LANG->_('PHPSHOP_ORDER_LIST_TRACK') => '',
     $VM_LANG->_('PHPSHOP_ORDER_LIST_VOID_LABEL') => '',
     $VM_LANG->_('PHPSHOP_CHECK_OUT_THANK_YOU_PRINT_VIEW') => '',
     $VM_LANG->_('PHPSHOP_ORDER_LIST_CDATE') => '',
     $VM_LANG->_('PHPSHOP_ORDER_LIST_MDATE') => '',
     $VM_LANG->_('PHPSHOP_ORDER_LIST_STATUS') => '',
     $VM_LANG->_('PHPSHOP_UPDATE') => '',
     $VM_LANG->_('PHPSHOP_ORDER_LIST_TOTAL') => '',
     $VM_LANG->_('E_REMOVE') => "width=\"5%\""
    );
$listObj->writeTableHeader( $columns );

As you can see, those are the column headers for the table, and the last line is the function to print out all the column headers.

Then, you will need to locate this section of code, and add $db->f('address_1'); as below:
$tmp_cell = $db->f('first_name').' '.$db->f('last_name');
 if( $perm->check('admin') && defined('_VM_IS_BACKEND')) {
  $url = $_SERVER['PHP_SELF']."?page=admin.user_form&amp;user_id=". $db->f("user_id");
  $tmp_cell = '<a href="'.$sess->url( $url ).'">'.$tmp_cell.'</a>';
 }
 
 $listObj->addCell( $tmp_cell );

 // This will print "address_1" column, which is placed afer the "Name" column
 $tmp_cell = $db->f('address_1');
 $listObj->addCell( $tmp_cell );

Note: The ordering of the the print cell function (i.e. the $listObj->addCell( $tmp_cell ); ) is important, as you wouldn't want to jumble up the different fields.

Comments

Popular posts from this blog

Learn phpfox

PHPFox  is a social network script, it is an internet application and when you install it, it is a website. The  phpfox  script comes in 3 packages, each with a different set of modules. it has two products: 1. Nebula (upto phpfox 3.8) 2. Neutron (Newer) You can check the demo on :  http://www.phpfox.com =================================================== To clear cache in phpfox follow the following steps, admincp >> Tools >> Maintenance >> Cache Manager >> Click on Clear All button =================================================== To work facebook app on local Following settings need to done in facebook app   1) go => setting => Advance 2) see "OAuth Settings" area and set "Valid OAuth redirect URIs" =  http:// projectdomain /index.php?do=/user/login/, http:// projectdomain .com/index.php?do=/user/register/, http:// projectdomain .com, http:// projectdomain .com/index.php 3) en...

Interview PHP

>> Why do you want to work at our company? Sir, It is a great privilege for anyone to work in a reputed company like yours. When I read about your company I found that my skills are matching your requirements.  Where I can showcase my technical skills to contribute to the company growth. >> What are your strengths? I am very much hard working and optimistic. Hard Working: Work with dedication and determination. Optimistic: work with positive attitude. I am a team player. I am also very hardworking, and will do what it takes to get the job done. >> What are your weaknesses? Gets nervous when talk to strangers I am a bit lazy about which I am not interested I tend to trust people too easily. I am working on it. >> Why should I hire you? With reference to my work experience, I satisfy all the requirement for this job. I am sincere with my work and would never let you down in anyway. I promise you will never regret for the decision to a...

How to Make Your Own PHP Captcha Generator

In this article we will create file based simple yet successful captcha generator. 3 Major Anti-spamming techniques used? Mathematical Operation like Random number + Random Number = -> The user must specify the answer Random word -> User must type the word Random question -> Obvious one which the user should answer correctly [ex: Are you human?] How Captcha works? The captcha generator generates an IMAGE with the question and then put up a session variable storing the value. User input though an input box. Using php POST, we compare the session variable data with the user input and tell whether its a bot or human. Its coding time The Code First let's write the php script which generates the captcha image. We use the simple header-content change technique, from which we can easily bring up an image from a given text. captcha.php PHP Code: array("Num" => "Num"), 1 => array("Are y...