Orders get duplicated in earnings

This topic contains 16 reply and 4 voices, and was last updated by Jani 9 years, 9 months ago
Viewing 15 Posts - 1 through 15 (of 16 total)
Author Posts
November 27, 2014 at 2:42 am 31265
Jani I have a serious issue: some orders are counted twice in Dokan earnings, causing sellers to see too higher earnings than what they have actually sold. For example, I have a user who has sold 11 products, each 5 €. Seller Percentage is set to 80%, so seller's balance should be 44 €. But the system shows 60 € as seller's balance! When going in admin panel to Dokan > Earning Reports > All Logs ei get this list with same order id in multiple rows. #8688 Anna (muokkaa) 5,00 € 4,00 € 1,00 € wc-processing #8680 Anna (muokkaa) 5,00 € 4,00 € 1,00 € wc-processing #8680 Anna (muokkaa) 5,00 € 4,00 € 1,00 € wc-processing (8680 is doubled - there are also other duplicates) What could be causing this and how can I fix this?
November 27, 2014 at 11:33 am 31281
Nayem Nayem

Hello Joonas,

I tested your issue but for me everything is working fine. I checked the earning reports when a customer purchased couple of or single product from a single seller and with the 80% seller percentage.But i did not find any duplicate earning reports or commission problem.

Did you test it any other way?. If yes, then please tell me the testing procedure to reproduce this issue.

Thank you 🙂

November 27, 2014 at 2:14 pm 31287
Joonas Joonas

When I go to database and see the table wp_dokan_orders, I can see same order_id – seller_id combination in multiple rows. So the seller earns from same order multiple times, but I get the money only once.

Shouldn’t be a constraint that the same order_id – seller_id combination may exist only once?


id  order_id seller_id order_total net_amount order_status
120 8786     43        5.00        4.00       wc-processing
119 8781     49        5.00        4.00       wc-pending
118 8781     49        5.00        4.00       wc-pending
117 8781     49        5.00        4.00       wc-pending
116 8778     49        5.00        4.00       wc-processing
115 8688     49        5.00        4.00       wc-completed
114 8680     49        5.00        4.00       wc-completed
113 8663     49        5.00        4.00       wc-cancelled
112 8663     49        5.00        4.00       wc-cancelled
November 27, 2014 at 2:37 pm 31290
Nayem Nayem

Hello Joonas,

I have already tested database too. For me its running fine. Can you please update your plugin to the latest version Dokan(v1.3). Please check after updating your plugin and let me know.

Thank you 🙂

November 27, 2014 at 2:49 pm 31293
Joonas Joonas

I’d like to have it confirmed that in database table dokan_orders, by design if there should or shouldn’t be multiple rows that contain the same order_id seller_id combination. Can you check this from the dev team?

November 27, 2014 at 3:08 pm 31294
Nayem Nayem

Hello Joonas,

I will discuss about your issue with our developer team. Please allow me some time. I will be back to you with the right solution.

Thank you 🙂

November 27, 2014 at 3:18 pm 31295
Joonas Joonas

Thank you Nayem!

November 27, 2014 at 4:14 pm 31297
Nayem Nayem

Hello Jonas,

I have discussed with our developer team. Please check for plugin conflict. Make disable all of your plugins except Dokan. Kindly check and let me know. I am here to help you.

Thank you 🙂

November 29, 2014 at 8:41 pm 31389
Joonas Joonas

I don’t see how this could be plugin conflict, but I disabled other plugins anyway, no help.

Could I just get a clear answer (yes or no): is there an error in the database data when there are multiple rows with same order-id, seller-id combination, in the table dokan-orders?

November 29, 2014 at 8:49 pm 31390
Joonas Joonas

Now I deleted all the duplicate rows in database, and now earning reports are correct.

The question is, what could be causing these duplicate rows, and do the keep coming up in future?

November 29, 2014 at 10:38 pm 31393
Joonas Joonas

Actually, shouldn’t order_id – seller_id combination be the primary key of dokan_orders?

November 30, 2014 at 12:48 am 31399
Joonas Joonas

In the file /includes/wc-functions.php I see that row 1140 has changed in v1.2, from


do_action( 'dokan_checkout_update_order_meta', $order_id );

to


do_action( 'dokan_checkout_update_order_meta', $order_id, $seller_id );

Can you confirm if this fixes the error?

November 30, 2014 at 3:12 pm 31425
Nayem Nayem

Hello Joonas,

You asked for a clear answer(yes or no). Dokan has no error in the database. We tested it many times here but everything working fine.

You also mentioned this code do_action( 'dokan_checkout_update_order_meta', $order_id, $seller_id );.
This code is not related with database. It is just a hook. it will not fix any error. I have discussed with our developer team. Any third party plugin may be the reason of this. I think you can go for a fresh installation of Dokan without installing any other plugin.

Please check and let me know. Thank you 🙂

December 8, 2014 at 2:20 am 31974
Joonas Joonas

A follow-up on this. I added a unique constraint in my MySQL database for dokan_orders:

ALTER TABLE dokan_orders
ADD CONSTRAINT order_seller UNIQUE (order_id,seller_id)

This fixed my problem, since multiple rows with same order_id and seller_id are no longer allowed. I think Dokan should, in it’s own code, either add this kind of constraint to dokan_orders or use seller_id – order_id combination as primary key.

January 13, 2015 at 11:43 pm 34079
Pablo Pablo

Hi,

I’m having the same issue!

I will try your way joonas…

Could you guide me through?

thanks

January 14, 2015 at 1:44 am 34084
Joonas Joonas

Ok,

You will need to have an access to your database, and then run following SQL-query (how this is exactly done, depends on your database):

ALTER TABLE dokan_orders
ADD CONSTRAINT order_seller UNIQUE (order_id,seller_id)

Viewing 15 Posts - 1 through 15 (of 16 total)