Skip to content

Commit

Permalink
Merge branch 'develop' into e2e-pw
Browse files Browse the repository at this point in the history
  • Loading branch information
shashwatahalder01 committed Jan 25, 2024
2 parents e5dbb41 + 8cf0566 commit 096a737
Show file tree
Hide file tree
Showing 21 changed files with 230 additions and 50 deletions.
2 changes: 1 addition & 1 deletion assets/src/js/dokan-daterangepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Set date range data.
let localeData = {
format : dokan_get_daterange_picker_format(),
...dokan_helper.locale
...dokan_helper.daterange_picker_local
};

// Date range picker handler.
Expand Down
1 change: 1 addition & 0 deletions assets/src/js/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
showCancelButton : true,
confirmButtonColor:'#28a745',
cancelButtonColor :'#dc3545',
...dokan_helper.sweetalert_local
};

const args = { ...defaults, ...options };
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"minimum-stability": "dev",
"require": {
"php": ">=7.4",
"appsero/client": "^v1.4.0",
"appsero/client": "^v2.0.1",
"jakeasmith/http_build_url": "^1"
},
"require-dev": {
Expand Down
46 changes: 23 additions & 23 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dokan.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ private function define( $name, $value ) {
public function declare_woocommerce_feature_compatibility() {
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, false );
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true );
}
}

Expand Down
7 changes: 7 additions & 0 deletions includes/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,13 @@ public function load_dokan_global_scripts() {
__( 'December', 'dokan-lite' ),
],
],
'sweetalert_local' => [
'cancelButtonText' => __( 'Cancel', 'dokan-lite' ),
'closeButtonText' => __( 'Close', 'dokan-lite' ),
'confirmButtonText' => __( 'OK', 'dokan-lite' ),
'denyButtonText' => __( 'No', 'dokan-lite' ),
'closeButtonAriaLabel' => __( 'Close this dialog', 'dokan-lite' ),
],
]
);

Expand Down
1 change: 1 addition & 0 deletions includes/CatalogMode/Dashboard/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function __construct() {
add_action( 'dokan_product_edit_after_options', [ $this, 'render_product_section' ], 99, 1 );
// save catalog mode section data
add_action( 'dokan_product_updated', [ $this, 'save_catalog_mode_data' ], 13 );
add_action( 'dokan_new_product_added', [ $this, 'save_catalog_mode_data' ], 13 );
}

/**
Expand Down
83 changes: 78 additions & 5 deletions includes/Dashboard/Templates/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,62 @@ public function get_orders_widgets() {
],
];

$nonce = wp_create_nonce( 'seller-order-filter-nonce' );
$order_url = dokan_get_navigation_url( 'orders' );
$completed_url = add_query_arg(
[
'order_status' => 'wc-completed',
'seller_order_filter_nonce' => $nonce,
],
$order_url
);
$pending_url = add_query_arg(
[
'order_status' => 'wc-pending',
'seller_order_filter_nonce' => $nonce,
],
$order_url
);
$processing_url = add_query_arg(
[
'order_status' => 'wc-processing',
'seller_order_filter_nonce' => $nonce,
],
$order_url
);
$cancelled_url = add_query_arg(
[
'order_status' => 'wc-cancelled',
'seller_order_filter_nonce' => $nonce,
],
$order_url
);
$refunded_url = add_query_arg(
[
'order_status' => 'wc-refunded',
'seller_order_filter_nonce' => $nonce,
],
$order_url
);
$on_hold_url = add_query_arg(
[
'order_status' => 'wc-on-hold',
'seller_order_filter_nonce' => $nonce,
],
$order_url
);

dokan_get_template_part(
'dashboard/orders-widget', '', [
'order_data' => $order_data,
'orders_count' => $this->orders_count,
'orders_url' => dokan_get_navigation_url( 'orders' ),
'order_data' => $order_data,
'orders_count' => $this->orders_count,
'orders_url' => $order_url,
'completed_url' => $completed_url,
'pending_url' => $pending_url,
'processing_url' => $processing_url,
'cancelled_url' => $cancelled_url,
'refunded_url' => $refunded_url,
'on_hold_url' => $on_hold_url,
]
);
}
Expand All @@ -142,11 +193,33 @@ public function get_products_widgets() {
if ( ! current_user_can( 'dokan_view_product_status_report' ) ) {
return;
}

$nonce = wp_create_nonce( 'product_listing_filter' );
$product_url = dokan_get_navigation_url( 'products' );
$online_url = add_query_arg(
[
'post_status' => 'publish',
'_product_listing_filter_nonce' => $nonce,
], $product_url
);
$draft_url = add_query_arg(
[
'post_status' => 'draft',
'_product_listing_filter_nonce' => $nonce,
], $product_url
);
$pending_url = add_query_arg(
[
'post_status' => 'pending',
'_product_listing_filter_nonce' => $nonce,
], $product_url
);
dokan_get_template_part(
'dashboard/products-widget', '', [
'post_counts' => $this->get_post_counts(),
'products_url' => dokan_get_navigation_url( 'products' ),
'products_url' => $product_url,
'online_url' => $online_url,
'draft_url' => $draft_url,
'pending_url' => $pending_url,
]
);
}
Expand Down
2 changes: 2 additions & 0 deletions includes/Frontend/MyAccount/BecomeAVendor.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ public function load_customer_to_vendor_update_template() {
return;
}

wp_enqueue_script( 'dokan-vendor-registration' );

$data = [
'user_id' => $user_id,
'first_name' => get_user_meta( $user_id, 'first_name', true ),
Expand Down
2 changes: 2 additions & 0 deletions includes/Order/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ public function __construct() {

// create sub-orders
add_action( 'woocommerce_checkout_update_order_meta', [ $this, 'split_vendor_orders' ] );
add_action( 'woocommerce_store_api_checkout_update_order_meta', [ $this, 'split_vendor_orders' ] );

// order table synced for WooCommerce update order meta
add_action( 'woocommerce_checkout_update_order_meta', 'dokan_sync_insert_order', 20 );
add_action( 'woocommerce_store_api_checkout_update_order_meta', 'dokan_sync_insert_order', 20 );

// order table synced for dokan update order meta
add_action( 'dokan_checkout_update_order_meta', 'dokan_sync_insert_order' );
Expand Down
8 changes: 7 additions & 1 deletion includes/Order/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,13 @@ function ( $item ) {
* @return void
*/
public function maybe_split_orders( $parent_order_id, $force_create = false ) {
$parent_order = $this->get( $parent_order_id );
if ( is_a( $parent_order_id, 'WC_Order' ) ) {
$parent_order = $parent_order_id;
$parent_order_id = $parent_order->get_id();
} else {
$parent_order = $this->get( $parent_order_id );
}

if ( ! $parent_order ) {
//dokan_log( sprintf( 'Invalid Order ID #%d found. Skipping from here.', $parent_order_id ) );
return;
Expand Down
8 changes: 7 additions & 1 deletion includes/Order/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,13 @@ function dokan_delete_sync_duplicate_order( $order_id, $seller_id ) {
function dokan_sync_insert_order( $order_id ) {
global $wpdb;

$order = wc_get_order( $order_id );
if ( is_a( $order_id, 'WC_Order' ) ) {
$order = $order_id;
$order_id = $order->get_id();
} else {
$order = wc_get_order( $order_id );
}

if ( ! $order || $order instanceof WC_Subscription ) {
return;
}
Expand Down
3 changes: 3 additions & 0 deletions includes/Shipping/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public function split_shipping_packages( $packages ) {
$packages = [];

foreach ( $cart_content as $key => $item ) {
if ( $item['data']->is_virtual() ) {
continue;
}
$post_author = get_post_field( 'post_author', $item['data']->get_id() );

$seller_pack[ $post_author ][ $key ] = $item;
Expand Down
2 changes: 1 addition & 1 deletion includes/Vendor/SetupWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ public function dokan_setup_store_save() {
}

update_user_meta( $this->store_id, 'dokan_profile_settings', $dokan_settings );

do_action( 'dokan_store_profile_saved', $this->store_id, $dokan_settings );
do_action( 'dokan_seller_wizard_store_field_save', $this );

wp_safe_redirect( esc_url_raw( $this->get_next_step_link() ) );
Expand Down
Loading

0 comments on commit 096a737

Please sign in to comment.