Virtuemart E-commerce Report Status Enhancement | 2008-02-04

Technology Blog » Web Development

This week I helped to enhancement its virtuemart backend to have the report filter by the order status. Also I did a modification that will pop up a alert when the order status or notify customer by e-mail has been changed. Here is the code that I wrote......


Virtuemart Report Status Enhancement

Open the php file


around lin22, under

$interval = mosGetParam( $_REQUEST, "interval", "byMonth" );

add this

$order_status = mosGetParam( $_REQUEST, "order_status", "orderAll" );// Set initial

around line 174, under

$end_date = mktime(23,59,59,date("n")+1,0,date("Y")); $interval = "byMonth";

add this

$order_status = "orderAll"; // Default value

around line203, under

$query_between_line = "WHERE cdate BETWEEN '" . $start_date . "' AND '" . $end_date . "' ";

add this

The Following Code is written by Andy Ng <[email protected]>
Please do not removed the above credits/copyrights
/* start of report status */
 switch ($order_status) {
    case 'orderAll':
     $query_date_line .= '';//do nothing
   case 'orderPending':
     $query_between_line .= "AND #__{vm}_orders.order_status='P' "; // Limit status
   case 'orderConfirmed':
     $query_between_line .= "AND #__{vm}_orders.order_status='C' "; // Limit status
   case 'orderCancelled':
     $query_between_line .= "AND #__{vm}_orders.order_status='X' "; // Limit status
   case 'orderRefunded':
     $query_between_line .= "AND #__{vm}_orders.order_status='R' "; // Limit status
   case 'orderShipped':
     $query_between_line .= "AND #__{vm}_orders.order_status='S' "; // Limit status
     $query_between_line .= '';

/* end of report status */

around line, under

<td><?php echo $VM_LANG->_PHPSHOP_RB_INTERVAL_TITLE; ?></td>

          <td><input type="radio" id="byMonth" name="interval" value="byMonth" <?php if($interval=="byMonth") echo "checked='checked'" ?> />
          <label for="byMonth"><?php echo $VM_LANG->_PHPSHOP_RB_INTERVAL_MONTHLY_TITLE ?></label>    
          <input type="radio" name="interval" id="byWeek" value="byWeek" <?php if($interval=="byWeek") echo "checked='checked'" ?> />
          <label for="byWeek"><?php echo $VM_LANG->_PHPSHOP_RB_INTERVAL_WEEKLY_TITLE; ?></label>    
          <input type="radio" name="interval" id="byDay" value="byDay" <?php if($interval=="byDay") echo "checked='checked'" ?> />
          <label for="byDay"><?php echo $VM_LANG->_PHPSHOP_RB_INTERVAL_DAILY_TITLE; ?></label></td>

add this table row

         <tr><?php // Report status enhancement ?>
          <td><input type="radio" id="orderAll" name="order_status" value="orderAll" <?php if($order_status=="orderAll") echo "checked='checked'" ?> />
            <label for="orderAll">All</label>
            <input type="radio" id="orderPending" name="order_status" value="orderPending" <?php if($order_status=="orderPending") echo "checked='checked'" ?> />
            <label for="orderPending">Pending</label>
            <input type="radio" id="orderConfirmed" name="order_status" value="orderConfirmed" <?php if($order_status=="orderConfirmed") echo "checked='checked'" ?> />
<label for="orderConfirmed">Confirmed</label>
<input type="radio" id="orderCanceleld" name="order_status" value="orderCanceleld" <?php if($order_status=="orderCanceleld") echo "checked='checked'" ?> />
<label for="orderCancelled">Cancelled</label>
<input type="radio" id="orderRefunded" name="order_status" value="orderRefunded" <?php if($order_status=="orderRefunded") echo "checked='checked'" ?> />
<label for="orderRefunded">Refunded</label>
<input type="radio" id="orderShipped" name="order_status" value="orderShipped" <?php if($order_status=="orderShipped") echo "checked='checked'" ?> />
<label for="orderShipped">Shipped</label></td>

Now, you will see the exactly result shown in the screenshot below.