我设置了Virtuemart安装(V.3.4.2)。默认情况下,Virtuemart会列出用户在注册用户的用户帐户中所做的所有订单。这在com_virtuemart / views / orders / list.php中呈现
幸运的是,Virtuemart还列出了此列表中状态为“待定”和“已取消”的订单。
<?php
$k = 0;
foreach ($this->orderlist as $row) {
$editlink = JRoute::_('index.php?option=com_virtuemart&view=orders&layout=details&order_number=' . $row->order_number, FALSE);
?>
<tr class="<?php echo "row$k"; ?> orderslist">
<td class="orderslist">
<a class="spin" href="<?php echo $editlink; ?>" rel="nofollow" <?php echo $ajaxUpdate?> ><?php echo $row->order_number; ?></a>
<?php echo shopFunctionsF::getInvoiceDownloadButton($row) ?>
</td>
<td class="orderslist" style="text-align: center;">
<?php echo vmJsApi::date($row->created_on,'LC4',true); ?>
</td>
<!--td align="left">
<?php //echo vmJsApi::date($row->modified_on,'LC3',true); ?>
</td -->
<td class="orderslist">
<?php echo shopFunctionsF::getOrderStatusName($row->order_status); ?>
</td>
<td class="orderslist" style="text-align: center;">
<?php echo $this->currency->priceDisplay($row->order_total, $row->currency); ?>
</td>
</tr>
<?php
$k = 1 - $k;
}
?>
是否有任何优雅的方法来过滤掉不需要的订单状态,如“已取消或待处理”,以便用户只能查看某些订单状态,如已确认订单,已退款和已完成的订单?
非常感谢你提前!
您可以通过$ row-> order_status过滤来过滤列表。
更改:
$editlink = JRoute::_('index.php?option=com_virtuemart&view=orders&layout=details&order_number=' . $row->order_number, FALSE);
?>
至:
$editlink = JRoute::_('index.php?option=com_virtuemart&view=orders&layout=details&order_number=' . $row->order_number, FALSE);
if ($row->order_status == 'P' OR $row->order_status == 'X') {
// do nothing
} else { ?>
和:
<?php
$k = 1 - $k;
}
?>
至:
<?php
$k = 1 - $k;
}
}
?>
如果您需要过滤任何其他状态,您可以通过VirtueMart菜单 - >配置 - >订单状态找到相应的短代码,如P和X.