Hi,
Okay so your configuration is: a vendor who display statistics for a pack he is managing.
In the "serialmarket/view.html.php" file in HikaSerial you have to replace
$or_filters = array();
if(!empty($own_packs)) {
$or_filters[] = 'serial.serial_pack_id IN ('.implode(',', $own_packs).')';
}
if(!empty($other_packs)) {
$or_filters[] = 'serial.serial_pack_id IN ('.implode(',', $other_packs).') AND hk_order.order_type = '.$db->Quote('subsale').' AND hk_order.order_vendor_id = '.(int)$target_vendor_id.'';
}
By
$or_filters = array();
$join_types = array();
if(!empty($own_packs)) {
$or_filters[] = 'serial.serial_pack_id IN ('.implode(',', $own_packs).') AND (hk_order.order_type = '.$db->Quote('sale').' OR hk_order.order_type IS NULL)';
$join_types[] = 'serial.serial_order_id = hk_order.order_id';
}
if(!empty($other_packs)) {
$or_filters[] = 'serial.serial_pack_id IN ('.implode(',', $other_packs).') AND hk_order.order_type = '.$db->Quote('subsale').' AND hk_order.order_vendor_id = '.(int)$target_vendor_id.'';
$join_types[] = 'serial.serial_order_id = hk_order.order_parent_id';
}
And then
' LEFT JOIN '.hikaserial::table('shop.order').' AS hk_order ON (serial.serial_order_id > 0 AND serial.serial_order_id = hk_order.order_parent_id) '.
By
' LEFT JOIN '.hikaserial::table('shop.order').' AS hk_order ON (serial.serial_order_id > 0 AND ('.implode(' OR ', $join_types).')) '.
So it will unsure that the link made with the orders are made with "user orders" when the pack is managed and with only "vendor orders" when the pack is not managed.
Because the link was only with the vendor orders ; by having several "vendor refund" in the database, it was affecting the count of the serials.
Regards,