• Resolved Vivek Athalye

    (@vnathalye)


    Can I assume that for a given order id + vendor id combination there will be only one commission record created?
    Is there any scenario when there could be multiple commission records for given order id + vendor id combination?

    Note:
    I know that if the order contains items from multiple vendors, there will be multiple commission records for that order. But what I’m looking for is the order + vendor combination. Will there be one and only one commission record for this combination in any scenario?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @vnathalye, thanks for the query.

    Yes, WCMp creates commission per vendor for each order, the reason is one order can have products from separate vendors. Hence, admin can handle each vendor’s commission (i.e. mark the commission as paid/reversed) separately.

    Just to keep you posted, we display the same commission data in the vendor’s order section too.

    However, if you do want to show all the vendor’s commission together of that order, then how will you manage the commission payment / reverse option for a single vendor’s order?

    Thread Starter Vivek Athalye

    (@vnathalye)

    No. I don’t want to show all vendors’ commission together.

    My question is:
    Is there any scenario when there could be multiple commission records for given order id + vendor id combination?

    For simplicity lets assume that the order has all the items from single vendor. In this case is there any possibility that there could be multiple commission records?

    @vnathalye if you go through our codes then you can find that we stored vendor commissions into our custom table named wcmp_vendor_orders.
    Now as per your question its depends on how will you want to queries commission for given order id and vendor id. For above ex- “lets assume that the order has all the items from single vendor”.
    If you directly query from database for given order id and vendor id, then it will return equals numbers of rows, the numbers of order items presents in your order for a vendor.
    Anyways You simply can use our core function named get_wcmp_vendor_order_amount like get_wcmp_vendor_order_amount(array('order_id' => $order->get_id(), 'vendor_id' => $vendor->id)) that will returns array of commission_amount, shipping_amount, tax_amount, shipping_tax_amount and total.

    Please let me know if you have any queries regarding this.

    Thread Starter Vivek Athalye

    (@vnathalye)

    Hi @itzmekhokan, thanks for explaining this. I know that in wcmp_vendor_orders there will be N rows, one for each item in a given order.

    My question is more about Commission ID, that refers to the commission entry in wp_posts table (post type: dc_commission). Can I assume that there will be only one commission ID for the given order (assuming all items are from same vendor).

    @vnathalye yes there will be only one commission ID for the given order and vendor.

    Thread Starter Vivek Athalye

    (@vnathalye)

    Great. Thanks for confirming. ??
    I’ll write my code accordingly now.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘commission records creation’ is closed to new replies.