If I am not wrong, actualy we only have an order number, the same for each seller.

It would be good for a marketplace if we could have an invoice number per seller. In fact in France, a law say that seller should add incremental invoice number on each invoice.

ie: one customer buy product from seller 1 and seller 2
Then, when order status change to completed, invoice number is incremented for seller 1 and seller 2 (not the others. In my country a law

I just hack mp_orders.module to add increment in a new column invoice_number into table mp_seller_order_statuses

It works but it's not realy clean... May be someone know a better way to do this.

Comments

baff’s picture

subscribe

Anonymous’s picture

Hello,
Could you tell us how to hack the mp_seller please ?

Thank you, merci :)

ledom’s picture

After adding facutre_id column into mp_seller_order_statuses table, edit mp_orders like that:

    case 'can_update':
    if ($arg1 == 'payment_received' || $arg1 == 'completed') {
         $products = $order->products;
         $flag = FALSE;
         foreach ($products as $product) {
           $uid = db_result(db_query('SELECT uid FROM {node} WHERE nid = %d', $product->nid));
                  //get invoice number for current seller
$nfacture = db_result(db_query('SELECT MAX(facture_id) FROM {mp_seller_order_statuses} WHERE uid = %d', $uid));
                       if (db_result(db_query('SELECT COUNT(*) FROM {mp_seller_order_statuses} WHERE uid = %d AND order_id = %d', $uid, $order->order_id)) == 0) {
             db_query('INSERT INTO {mp_seller_order_statuses} (uid,order_id,order_status,seller_paid_status,facture_id) VALUES (%d,%d,"complete","0",%d)', $uid, $order->order_id, $nfacture + 1);
             $flag = TRUE;
           }
           if ($flag && (db_result(db_query('SELECT shippable FROM {uc_products} WHERE nid = %d', $product->nid)) == 1)) {
             db_query('UPDATE {mp_seller_order_statuses} SET order_status = "not complete" WHERE order_id = %d AND uid = %d', $order->order_id, $uid);
           }
         }
       }
vlooivlerke’s picture

Could this be committed to dev?