MultivendorX Pro
-
AuthorPosts
-
-
July 13, 2023 at 8:04 AM #194328ChrisParticipant
Hi support,
I was using the code provided previously via a support thread to set the default date range for orders, as shown below:
Hi,
For order table override dc-woocommerce-multi-vendor/templates/vendor-dashboard/vendor-orders.php template by copying it to yourtheme/MultiVendorX/vendor-dashboard/vendor-orders.php
then change line no 37 instant of below code
<input type=”date” name=”mvx_start_date_order” class=”pickdate gap1 mvx_start_date_order form-control” placeholder=”<?php esc_attr_e(‘from’, ‘multivendorx’); ?>” value=”<?php echo isset($_POST[‘mvx_start_date_order’]) ? wc_clean($_POST[‘mvx_start_date_order’]) : date( ‘Y-m-d’, strtotime(‘-90 days’)); ?>” />However, recently, as you can see from this screenshot, https://prnt.sc/aD3Kb6uD8E5L , the orders are not showing the orders as per the date range set.
-
July 13, 2023 at 8:05 AM #194329ChrisParticipant
I have to click the show button to make all the other orders appearing, as in this screenshot, https://prnt.sc/WdzM77_zzRwI
Could you please have a check on this? Thanks
-
July 13, 2023 at 8:05 AM #194330ChrisParticipant
The thread that I was referring to is
https://multivendorx.com/support-forum/topic/how-to-change-default-date-range-in-orders-payment-history-in-vendor-dashboard/ -
July 13, 2023 at 6:40 PM #194358Sangita Support SquadKeymaster
@Chris Our team is checking the issue. Kindly provide them some time.
-
July 14, 2023 at 2:05 PM #194407Sangita Support SquadKeymaster
Hello @Chris
You need to override the vendor-orders.php template with this https://drive.google.com/file/d/1zQiId4NPuZHfE9ZW17EWJitYGnl1-_cv/view?usp=sharing
You need to follow the below path to override the template yourtheme/MultiVendorX/vendor-dashboard/vendor-orders.php
Also add the below code in the functions.php file of your current active theme –add_filter('mvx_datatable_get_vendor_all_orders', 'default_load_order_table', 10, 3); function default_load_order_table($all_orders, $requestData, $method) { if ($method['submit_data'] != 1) { $start_date = date( 'Y-m-d', strtotime('-90 days')); $end_date = date( 'Y-m-d'); $vendor = get_current_vendor(); $args = array( 'author' => $vendor->id, 'post_status' => 'any', 'date_query' => array( array( 'after' => $start_date, 'before' => $end_date, 'inclusive' => true, ), ) ); $all_orders = mvx_get_orders($args); return $all_orders; } else { return $all_orders; } }
Copy -
July 19, 2023 at 9:08 AM #194508ChrisParticipant
Hi, the code snippet has following errors.
Snippet automatically deactivated due to an error on line 3:
Syntax error, unexpected identifier ” “. -
July 19, 2023 at 9:34 AM #194511Sangita Support SquadKeymaster
Sorry for the inconvenience. Kindly add the below code in the functions.php file of your current active theme –
add_filter('mvx_datatable_get_vendor_all_orders', 'default_load_order_table', 10, 3); function default_load_order_table($all_orders, $requestData, $method) { if ($method['submit_data'] != 1) { $start_date = date( 'Y-m-d', strtotime('-90 days')); $end_date = date( 'Y-m-d'); $vendor = get_current_vendor(); $args = array( 'author' => $vendor->id, 'post_status' => 'any', 'date_query' => array( array( 'after' => $start_date, 'before' => $end_date, 'inclusive' => true, ), ) ); $all_orders = mvx_get_orders($args); return $all_orders; } else { return $all_orders; } }
Copy -
July 19, 2023 at 9:42 AM #194512ChrisParticipantThis reply has been marked as private.
-
July 19, 2023 at 10:20 AM #194516Sangita Support SquadKeymaster
@Chris kindly add the below code and check –
add_filter('mvx_datatable_get_vendor_all_orders', 'default_load_order_table_new', 10, 3); function default_load_order_table_new($all_orders, $requestData, $method) { if ($method['submit_data'] != 1) { $start_date = date( 'Y-m-d', strtotime('-90 days')); $end_date = date( 'Y-m-d'); $vendor = get_current_vendor(); $args = array( 'author' => $vendor->id, 'post_status' => 'any', 'date_query' => array( array( 'after' => $start_date, 'before' => $end_date, 'inclusive' => true, ), ) ); $all_orders = mvx_get_orders($args); return $all_orders; } else { return $all_orders; } }
Copy -
July 19, 2023 at 10:38 AM #194517ChrisParticipant
Alright, tested & its working now. Thanks
-
July 19, 2023 at 10:39 AM #194518Sangita Support SquadKeymaster
You are welcome.
-
July 19, 2023 at 10:41 AM #194519ChrisParticipant
Not sure if the history table is working or not as I don’t have much data available for it yet. If it’s not working also, can I have a fix for the history table too? Else, that’s all for this part. Thanks
-
July 19, 2023 at 12:40 PM #194522Sangita Support SquadKeymaster
The code and template modification we have provided is for the vendor orders page.
Now if you need modification for the history tab too then please let us know we will help you accordingly. -
July 19, 2023 at 1:13 PM #194525ChrisParticipant
Yes, I need it also for the history tab. Please help me accordingly. Thank you
-
July 19, 2023 at 4:05 PM #194529Sangita Support SquadKeymaster
For history table override dc-woocommerce-multi-vendor/templates/vendor-dashboard/vendor-transactions.php template by copying it to yourtheme/MultiVendorX/vendor-dashboard/vendor-transactions.php
then change line no 31 instant of below code<input type="date" id="mvx_from_date" class="form-control" name="from_date" class="pickdate gap1" placeholder="From" value ="<?php echo date( 'Y-m-d', strtotime('-90 days')); ?>"/>
Copy -
July 25, 2023 at 5:00 AM #194645ChrisParticipant
Okay thanks
-
July 25, 2023 at 9:12 AM #194651Sangita Support SquadKeymaster
You are welcome.
-
-
AuthorPosts
The topic ‘Default Date Range In Orders Not Working Recently’ is closed to new replies.