以下代码显示了订购产品的单个重量:
$weightsql = 'select op.products_name, op.products_quantity , p.products_weight from ' . TABLE_ORDERS_PRODUCTS . ' op left join ' . TABLE_PRODUCTS . ' p on op.products_id = p.products_id where op.products_id = '.$pro['products_id'];
$weightq = tep_db_query( $weightsql );
while ($weight = tep_db_fetch_array( $weightq )){
if($category_parent_id != 0)$list_items[] = $weight['products_weight'].' ';
}
这显示了订购的每个产品的重量。我坚持的不是显示单独的重量,而是显示总重量。例如,如果产品订购了 3 次,重量为 7 公斤,此时代码显示:
Product 7.00 7.00 7.00
我如何让它显示总重量,21公斤?