Skip to content

Commit

Permalink
Merge branch 'enhancement/add-paged-key-support-in-query' into feat/y…
Browse files Browse the repository at this point in the history
…ithmultivendor-to-dokan
  • Loading branch information
Aunshon committed Sep 25, 2023
2 parents 3cab81f + dc2fa06 commit 5f7375e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
11 changes: 10 additions & 1 deletion includes/Abstracts/OrderMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ abstract public function create_sub_order_if_needed( $seller_id, $seller_product
*/
abstract public function reset_sub_orders_if_needed();

/**
* Get seller by order/order id
*
* @since DOKAN_MIG_SINCE
*
* @return void
*/
abstract public function get_seller_by_order( $order_id );

/**
* Returns true if the order has sub orders.
*
Expand Down Expand Up @@ -243,7 +252,7 @@ public function sync_dokan_order_table( $dokan_order_data, $sub_order_id, $selle
* @return void
*/
public function process_migration() {
$vendors = dokan_get_sellers_by( $this->order_id );
$vendors = $this->get_seller_by_order( $this->order_id );

$this->reset_sub_orders_if_needed();

Expand Down
13 changes: 12 additions & 1 deletion includes/Integrations/Wcfm/OrderMigrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ public function split_parent_order_shipping( $applied_shipping_method, $order_id
}

$applied_shipping_method = reset( $parent_order->get_shipping_methods() );
$vendors = dokan_get_sellers_by( $parent_order->get_id() );
$vendors = $this->get_seller_by_order( $parent_order->get_id() );

// Here we are dividing the shipping and shipping-tax amount of parent order into the vendors suborders.
$shipping_tax_amount = [
Expand Down Expand Up @@ -482,4 +482,15 @@ public function split_parent_order_shipping( $applied_shipping_method, $order_id

return $item;
}

/**
* Returns all sellers of an order.
*
* @param int $order_id
*
* @return array
*/
public function get_seller_by_order( $order_id ) {
return dokan_get_sellers_by( $order_id );
}
}

0 comments on commit 5f7375e

Please sign in to comment.