Skip to content

Commit

Permalink
Merge branch 'develop' into litetests
Browse files Browse the repository at this point in the history
  • Loading branch information
shashwatahalder01 committed Feb 28, 2024
2 parents c4de91e + b631a1a commit 91b92a8
Show file tree
Hide file tree
Showing 47 changed files with 718 additions and 9,946 deletions.
10 changes: 6 additions & 4 deletions assets/src/less/store-lists.less
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@
position: absolute;
top: 0;
left: 0;
z-index: 9;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.45);
Expand Down Expand Up @@ -335,6 +334,10 @@
.store-address {
margin: 0 0 5px 0;
line-height: 23px;

br {
display: none;
}
}
.store-phone {
margin: 0 0 5px 0;
Expand All @@ -347,7 +350,6 @@
.store-footer {
background: #fff;
position: relative;
z-index: 99;

a {
&:active,
Expand Down Expand Up @@ -389,7 +391,7 @@
.dokan-store-is-open-status {
background-color: #1dbf73;
}

.dokan-store-is-closed-status {
background-color: #999;
}
Expand Down Expand Up @@ -570,4 +572,4 @@
}
}
}
}
}
9 changes: 9 additions & 0 deletions assets/src/less/store.less
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,10 @@
i {
font-size: 25px;
text-shadow: 1px 1px 1px rgba(255,255,255, 0.55);

&.fa-square-x-twitter {
color: #000000;
}
}
}
}
Expand Down Expand Up @@ -1446,6 +1450,11 @@
i {
font-size: 25px;
text-shadow: 1px 1px 1px rgba(255,255,255, 0.55);
color: #0B8379;

&.fa-square-x-twitter {
color: #000000;
}
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions assets/vendors/font-awesome/css/font-awesome.min.css

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions assets/vendors/font-awesome/font-awesome.min.css

This file was deleted.

Binary file not shown.
3,717 changes: 0 additions & 3,717 deletions assets/vendors/font-awesome/webfonts/fa-brands-400.svg

This file was deleted.

Binary file modified assets/vendors/font-awesome/webfonts/fa-brands-400.ttf
Binary file not shown.
Binary file not shown.
Binary file modified assets/vendors/font-awesome/webfonts/fa-brands-400.woff2
Binary file not shown.
Binary file not shown.
801 changes: 0 additions & 801 deletions assets/vendors/font-awesome/webfonts/fa-regular-400.svg

This file was deleted.

Binary file modified assets/vendors/font-awesome/webfonts/fa-regular-400.ttf
Binary file not shown.
Binary file not shown.
Binary file modified assets/vendors/font-awesome/webfonts/fa-regular-400.woff2
Binary file not shown.
Binary file not shown.
5,034 changes: 0 additions & 5,034 deletions assets/vendors/font-awesome/webfonts/fa-solid-900.svg

This file was deleted.

Binary file modified assets/vendors/font-awesome/webfonts/fa-solid-900.ttf
Binary file not shown.
Binary file not shown.
Binary file modified assets/vendors/font-awesome/webfonts/fa-solid-900.woff2
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"WeDevs\\Dokan\\": "includes/"
},
"files": [
"includes/functions-rest-api.php"
"includes/functions-rest-api.php",
"includes/functions-dashboard-navigation.php"
]
},
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions includes/Admin/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -776,14 +776,17 @@ public function get_settings_fields() {
'label' => __( 'Site Key', 'dokan-lite' ),
'tooltip' => __( 'Insert Google reCAPTCHA v3 site key.', 'dokan-lite' ),
'social_field' => true,
'is_lite' => true,
],
'recaptcha_secret_key' => [
'name' => 'recaptcha_secret_key',
'label' => __( 'Secret Key', 'dokan-lite' ),
'type' => 'text',
'tooltip' => __( 'Insert Google reCAPTCHA v3 secret key.', 'dokan-lite' ),
'social_field' => true,
'is_lite' => true,
],
'is_lite' => true,
],
'contact_seller' => [
'name' => 'contact_seller',
Expand Down
2 changes: 1 addition & 1 deletion includes/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public function get_styles() {
'src' => DOKAN_PLUGIN_ASSEST . '/vendors/jquery-ui/jquery-ui-1.10.0.custom.css',
],
'dokan-fontawesome' => [
'src' => DOKAN_PLUGIN_ASSEST . '/vendors/font-awesome/font-awesome.min.css',
'src' => DOKAN_PLUGIN_ASSEST . '/vendors/font-awesome/css/font-awesome.min.css',
],
'dokan-modal' => [
'src' => DOKAN_PLUGIN_ASSEST . '/vendors/izimodal/iziModal.min.css',
Expand Down
18 changes: 17 additions & 1 deletion includes/Dashboard/Templates/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct() {
}

/**
* Get Seller Dhasboard Notice
* Get Seller Dashboard Notice
*
* @since 2.4
*
Expand All @@ -55,6 +55,10 @@ public function show_seller_dashboard_notice() {
* @return void
*/
public function get_big_counter_widgets() {
if ( ! apply_filters( 'dokan_dashboard_widget_applicable', true, 'reports' ) ) {
return;
}

if ( ! current_user_can( 'dokan_view_sales_overview' ) ) {
return;
}
Expand All @@ -81,6 +85,10 @@ public function get_big_counter_widgets() {
* @return void
*/
public function get_orders_widgets() {
if ( ! apply_filters( 'dokan_dashboard_widget_applicable', true, 'orders' ) ) {
return;
}

if ( ! current_user_can( 'dokan_view_order_report' ) ) {
return;
}
Expand Down Expand Up @@ -190,6 +198,10 @@ public function get_orders_widgets() {
* @return void
*/
public function get_products_widgets() {
if ( ! apply_filters( 'dokan_dashboard_widget_applicable', true, 'products' ) ) {
return;
}

if ( ! current_user_can( 'dokan_view_product_status_report' ) ) {
return;
}
Expand Down Expand Up @@ -232,6 +244,10 @@ public function get_products_widgets() {
* @return void
*/
public function get_sales_report_chart_widget() {
if ( ! apply_filters( 'dokan_dashboard_widget_applicable', true, 'reports' ) ) {
return;
}

if ( ! current_user_can( 'dokan_view_sales_report_chart' ) ) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion includes/Install/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private function schedule_cron_jobs() {

// check if we've defined the cron hook
$cron_schedule = as_next_scheduled_action( $hook ); // this method will return false if the hook is not scheduled
if ( ! $cron_schedule ) {
if ( $cron_schedule ) {
as_unschedule_all_actions( $hook );
}

Expand Down
27 changes: 27 additions & 0 deletions includes/Order/MiscHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ class MiscHooks {
public function __construct() {
//Wc remove child order from wc_order_product_lookup & trim child order from posts for analytics
add_action( 'wc-admin_import_orders', [ $this, 'delete_child_order_from_wc_order_product' ] );

// Exclude suborders in woocommerce analytics.
add_filter( 'woocommerce_analytics_orders_select_query', [ $this, 'trim_child_order_for_analytics_order' ] );
add_filter( 'woocommerce_analytics_update_order_stats_data', [ $this, 'trim_child_order_for_analytics_order_stats' ], 10, 2 );

// remove customer info from order export based on setting
add_filter( 'dokan_csv_export_headers', [ $this, 'hide_customer_info_from_vendor_order_export' ], 20, 1 );
Expand Down Expand Up @@ -190,4 +193,28 @@ public function modify_vendor_order_counts( $counts ) {

return $counts;
}

/**
* Exclude suborders and include dokan subscription product orders when generate woocommerce analytics data.
*
* @see https://github.com/getdokan/dokan-pro/issues/2735
*
* @param array $data
* @param \WC_Order $order
*
* @return array
*/
public function trim_child_order_for_analytics_order_stats( $data, $order ) {
if ( ! $order->get_parent_id() ||
(
dokan()->is_pro_exists()
&& dokan_pro()->module->is_active( 'product_subscription' )
&& \DokanPro\Modules\Subscription\Helper::is_vendor_subscription_order( $order )
)
) {
return $data;
}

return [];
}
}
6 changes: 6 additions & 0 deletions includes/Product/ProductCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ public function clear_seller_product_caches( $product ) {
* @return void
*/
public static function delete( $seller_id ) {
$proceed = apply_filters( 'dokan_product_cache_delete_all_data', true, $seller_id );

if ( ! $proceed ) {
return;
}

Cache::invalidate_group( 'product_data' );
Cache::invalidate_group( "seller_product_data_{$seller_id}" );
Cache::invalidate_group( "seller_product_stock_data_{$seller_id}" );
Expand Down
1 change: 1 addition & 0 deletions includes/Product/VendorStoreInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function admin_settings_for_vendor_info( $settings_fields, $dokan_setting
'default' => 'off',
'class' => 'show_vendor_info',
'sanitize_callback' => 'sanitize_text_field',
'is_lite' => true,
],
];

Expand Down
9 changes: 9 additions & 0 deletions includes/ReverseWithdrawal/Admin/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public function load_settings_fields( $fields ) {
'type' => 'switcher',
'default' => 'off',
'refresh_after_save' => true,
'is_lite' => true,
],
'payment_gateways' => [
'name' => 'payment_gateways',
Expand All @@ -56,6 +57,7 @@ public function load_settings_fields( $fields ) {
'type' => 'multicheck',
'options' => SettingsHelper::get_reverse_withrawal_payment_gateways(),
'default' => [ 'cod' => 'cod' ],
'is_lite' => true,
],
'billing_type' => [
'name' => 'billing_type',
Expand All @@ -64,6 +66,7 @@ public function load_settings_fields( $fields ) {
'type' => 'select',
'options' => SettingsHelper::get_billing_type_options(),
'default' => 'by_amount',
'is_lite' => true,
],
'reverse_balance_threshold' => [
'name' => 'reverse_balance_threshold',
Expand All @@ -78,6 +81,7 @@ public function load_settings_fields( $fields ) {
'equal' => 'by_amount',
],
],
'is_lite' => true,
],
'monthly_billing_day' => [
'name' => 'monthly_billing_day',
Expand All @@ -93,6 +97,7 @@ public function load_settings_fields( $fields ) {
'equal' => 'by_month',
],
],
'is_lite' => true,
],
'due_period' => [
'name' => 'due_period',
Expand All @@ -103,6 +108,7 @@ public function load_settings_fields( $fields ) {
'max' => 28,
'step' => 1,
'default' => '7',
'is_lite' => true,
],
'failed_actions' => [
'name' => 'failed_actions',
Expand All @@ -111,13 +117,15 @@ public function load_settings_fields( $fields ) {
'type' => 'multicheck',
'options' => SettingsHelper::get_failed_payment_actions(),
'default' => [ 'enable_catalog_mode' => 'enable_catalog_mode' ],
'is_lite' => true,
],
'display_notice' => [
'name' => 'display_notice',
'label' => esc_html__( 'Display Notice During Grace Period', 'dokan-lite' ),
'desc' => esc_html__( 'Display notice to pay reverse withdrawal balance during grace period under vendor dashboard.', 'dokan-lite' ),
'type' => 'switcher',
'default' => 'on',
'is_lite' => true,
],
];

Expand All @@ -129,6 +137,7 @@ public function load_settings_fields( $fields ) {
'desc' => esc_html__( 'Check this checkbox if you want to send an announcement during the grace period. Note that a maximum of one announcement will be sent during a single billing period.', 'dokan-lite' ),
'type' => 'switcher',
'default' => 'off',
'is_lite' => true,
];
}

Expand Down
2 changes: 1 addition & 1 deletion includes/ReverseWithdrawal/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct() {
add_action( 'woocommerce_order_status_changed', [ $this, 'process_order_status_changed' ], 10, 3 );

// vendor dashboard navigation url
add_filter( 'dokan_get_dashboard_nav', [ $this, 'add_reverse_withdrawal_nav' ], 10, 2 );
add_filter( 'dokan_get_dashboard_nav', [ $this, 'add_reverse_withdrawal_nav' ], 10 );
}

/**
Expand Down
33 changes: 24 additions & 9 deletions includes/Shortcodes/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,22 @@ public function render_shortcode( $atts ) {

ob_start();

if ( isset( $wp->query_vars['products'] ) ) {
/**
* Filter query var before rendering dokan vendor shortcode
*/
$query_vars = apply_filters( 'dokan_dashboard_shortcode_query_vars', $wp->query_vars );

if ( is_wp_error( $query_vars ) ) {
dokan_get_template_part(
'global/dokan-error', '', [
'deleted' => false,
'message' => $query_vars->get_error_message(),
]
);
return ob_get_clean();
}

if ( isset( $query_vars['products'] ) ) {
if ( ! current_user_can( 'dokan_view_product_menu' ) ) {
dokan_get_template_part( 'global/no-permission' );
} else {
Expand All @@ -42,7 +57,7 @@ public function render_shortcode( $atts ) {
return ob_get_clean();
}

if ( isset( $wp->query_vars['new-product'] ) ) {
if ( isset( $query_vars['new-product'] ) ) {
if ( ! current_user_can( 'dokan_add_product' ) ) {
dokan_get_template_part( 'global/no-permission' );
} else {
Expand All @@ -52,7 +67,7 @@ public function render_shortcode( $atts ) {
return ob_get_clean();
}

if ( isset( $wp->query_vars['orders'] ) ) {
if ( isset( $query_vars['orders'] ) ) {
if ( ! current_user_can( 'dokan_view_order_menu' ) ) {
dokan_get_template_part( 'global/no-permission' );
} else {
Expand All @@ -62,7 +77,7 @@ public function render_shortcode( $atts ) {
return ob_get_clean();
}

if ( isset( $wp->query_vars['withdraw'] ) ) {
if ( isset( $query_vars['withdraw'] ) ) {
if ( ! current_user_can( 'dokan_view_withdraw_menu' ) ) {
dokan_get_template_part( 'global/no-permission' );
} else {
Expand All @@ -72,7 +87,7 @@ public function render_shortcode( $atts ) {
return ob_get_clean();
}

if ( isset( $wp->query_vars['reverse-withdrawal'] ) ) {
if ( isset( $query_vars['reverse-withdrawal'] ) ) {
if ( ! current_user_can( 'dokan_view_withdraw_menu' ) ) {
dokan_get_template_part( 'global/no-permission' );
} else {
Expand All @@ -82,13 +97,13 @@ public function render_shortcode( $atts ) {
return ob_get_clean();
}

if ( isset( $wp->query_vars['settings'] ) ) {
if ( isset( $query_vars['settings'] ) ) {
dokan_get_template_part( 'settings/store' );

return ob_get_clean();
}

if ( isset( $wp->query_vars['page'] ) ) {
if ( isset( $query_vars['page'] ) ) {
if ( ! current_user_can( 'dokan_view_overview_menu' ) ) {
dokan_get_template_part( 'global/no-permission' );
} else {
Expand All @@ -97,13 +112,13 @@ public function render_shortcode( $atts ) {

return ob_get_clean();
}
if ( isset( $wp->query_vars['edit-account'] ) ) {
if ( isset( $query_vars['edit-account'] ) ) {
dokan_get_template_part( 'dashboard/edit-account' );

return ob_get_clean();
}

do_action( 'dokan_load_custom_template', $wp->query_vars );
do_action( 'dokan_load_custom_template', $query_vars );

return ob_get_clean();
}
Expand Down
Loading

0 comments on commit 91b92a8

Please sign in to comment.