I'm working on a site that needs to take custom payment and remit a part of it to one or more vendors that are determined by the products purchased (the vendors essentially create the products themselves in the shop). I have seen Ubercart Marketplace as a possibility for this, but it's rather old. However, it's the closest to what I need. Should I go with it or is there a better, more fully-integrated solution in Drupal (that uses Ubercart) that I should investigate?
This is outside Ubercart, but it's definitely possible with Drupal!
For this demonstration, I will use a point system. Let's say 100 points = $1.00.
Drupal 7 method:
- Create a content type, called Products.
- Install a Drupal module, called Entity Reference and add an Entity Reference field to the Products content type, select users. This will allow you to reference the product to vendors.
- Create another content type, called Points. Also add an Entity Reference field to it, and select type as users, to reference users. In addition, add a decimal field (amount).
- Install another Drupal module, called Rules
- Create a rule that would, after a certain time (30 days, etc...) from the sale date, create a Point node with that User referenced and add the commission earned.
- Create a rule, that would unpublish the Point node anytime the payment is withdrawn.
Another option is to use the Relation module. It's more work and still in early stages.
By creating a Point node for each commission, you're leaving all records of transactions. I would never overwrite the old commission value with new commission, i.e. $user->payment = $user->payment + 10. It will mess things up.
You can still use Ubercart with this, as it uses Drupal's entity/field structure. Simply skip #1 and use Ubercart's product content type.
I would recommend that you go with Ubercart Marketplace for Drupal 6.x, especially if you need vendors to create their own products and have their own set of permissions to edit products, publish products, ship to vendors and/or get sales reports. I've used Ubercart Marketplace with some of my own customizations and patching (especially in the payment and reports area) but overall it does the job and in my opinion it will take a lot more if you build this functionality from scratch or try to bundle several other modules.
If you need to automatically split the payment as you get orders then take a look at Amazon Flexible Payments which lets you splits payments and has a very flexible API to do whatever you need.