Ubercart Marketplace - Multiple Seller Support

Posts: 33
Joined: 03/05/2008

There has been many requests for marketplace type features. People have requested features such as multiple seller management. I had need for the same and have developed a working group of modules under the working title of Ubercart Marketplace.

Overview of the Five Current Ubercart Marketplace Modules:

  1. mp_products:
    • Adds "selling" tab to user accounts with certain permissions.
    • Adds a table of products created by seller.
    • Includes sample concept of edits to product node edit form appropriate for a marketplace seller. For example, it removes form elements sellers may find unnecessary and cryptic.
    • This module also sets up the "cost" price field to be used as the commission field and is calculated based on a set commission rate. These options are configurable under "Seller settings" in Ubercart configuration.
  2. mp_orders:
    • Adds "fulfill orders" tab to "selling" section of user accounts.
    • Adds a table of orders containing products created by seller. This module handles "dividing" up orders at checkout, so each seller only can fulfill and view the portion of a customer's order that contains the seller's products.
    • Handles seller order statuses, moving their "portion" of the order to complete when order is fulfilled.
    • Automatically completes orders when orders are nonshippable.
  3. mp_shipping:
    • Mimics functionality of uc_shipping, but allows sellers to only fulfill and ship the portion of a customer's order containing the seller's goods.
    • Adds in a packing slip feature that allows sellers to print a packing slip containing only the content of the specified package. This is for drop shipping support.
    • Adds a workflow-ng configuration that moves the whole customer order to completed when all sellers' order statuses for an order are complete.
    • This module currently only supports the "manual shipping" option (e.g. live quotes from ups and usps are not yet supported). However, this works well with the contributed order tracking module because sellers can select a carrier and tracking number for their packages that can then be tracked by the customer.
  4. mp_reports:
    • Adds reports to sellers' pages under their account. Seller reports included are: product sales, sales summary, and sales per year/month.
    • Seller reports only show the seller's products and sales and the commission they will be paid.
    • Seller reports only report sales that are from orders that the seller has completed. The seller will not get paid until they either ship the order, or the order is all nonshippable, in which case it will automatically be promoted to complete.
    • mp_reports adds two admin reports to the current uc_reports module. The first one is a seller order statuses report that lists the orders by seller that have not been completed so the store administrator can look out for slow sellers. The second lists the commission that the sellers should be paid. This is calculated from the "cost" price field mentioned above. This table is powerful in that it allows you to select the date range in which to show orders so you can pay sellers in whatever periods you wish. This report also supports exporting to a Paypal Mass Payments formatted txt file. Currently this is the envisioned method of seller payment.
  5. mp_notify:
    • This simple module allows sellers to be notified when they have an order.
    • Options for this module are configurable under "seller" tab of notification settings area in Ubercart configuration.

Concept:
Basically, this group of modules leverages current Ubercart core functionality, while limiting access so sellers can only deal with their orders and products. All seller functions are under a new "selling" tab of their user account page (user/x/selling). Seller order statuses have been created to allow management of payment--the idea is that only sellers' orders which are complete will show up in seller payment reports. This forces sellers to fulfill their orders if they want to be paid. Nonshippable orders are automatically promoted. The commission to be paid to the sellers is based on the preexisting "cost" field of the product node. This is the actual value a seller will be paid. The only method currently supported (aside from manual) to pay sellers is with the created Paypal Mass Payments file.

Usage Ideas:
Ubercart marketplace would work well with moderation modules (look on drupal.org), so sellers can not directly list products. A set of profile modules and a taxonomy setup may also be appropriate to allow sellers their own "about me" page and a view of all products by a certain seller. See how to setup roles/permissions under "Installation."

Wishlist:
Some of these features may be coming in the future. Feature requests are welcome, also.

  • "Glue" module for handling seller taxonomy and seller profiles. Think similar features to uc_manufacturers.
  • Better support for shipping fulfillment. Allow sellers to create their own accounts with shipping companies, so printing shipping labels (etc) is possible for each seller.
  • Quick menu for seller functions
  • Report graphs
  • Handle file downloads (feature for products) more intuitively due to lack of nonadmin support for product features - Added in BETA1!
  • Support for more seller payment methods, such as pay with check. Also allow sellers to choose method and/or select email address of their Paypal account. - Added in BETA2!

Installation:
See the README included in the attached .zip for additional details. Requires a small uc_shipping patch as well as a template file to be moved to the uc_orders template folder (included). To realize functionality, create a new role (and some users) and give this "seller" role the access permissions of the ubercart marketplace modules (view own reports, ship own products, etc.). Also give "seller" other permissions appropriate (such as edit own products, create products, etc. from Ubercart core).

IMPORTANT Notes:
It is important to keep in mind that this is a developer preview. Consider this BETA at best. Many Ubercart core module functions had to be ruthlessly overridden due to lack of fine-grained access control in Ubercart. I tried to alter (with hooks) what I could and the rest had to be overridden. Some of my database queries also got messy due to pulling information from many tables not set up for fine-grained seller access. If you can find a simpler way to do certain functions of Ubercart Marketplace, please help support it. I also have not gotten around to doing my own cleaning and full commenting of the code. Updates will be posted here when available. I tested these extensively, but there may still be plenty of bugs. I encourage all support, feature requests (although I am limited in time), and ideas. Also note, these modules may not satisfy everyone. I tried to make them suitable for a range of purposes, but they may not fit everyone's specific needs. Once this group of modules gets a little more underway, I will set up the appropriate projects and issue queues. Post with your thoughts.

Edit: To download, please check out the project page at drupal.org: http://drupal.org/project/ubercart_marketplace
Edit 2: Documentation: http://drupal.org/node/326102

Posts: 5378
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Don't have time to review this personally, but I will share a quick thought... unbelievable! Cool I'm highly impressed and wish you the best of luck on this project. Lots of folks have asked about just this sort of functionality, and it sounds like you've done quite a comprehensive job. I would encourage you to make a separate post that catalogs as much of the shortcomings in the core access control as possible so we can improve this in D6 and beyond. That would rock!

Posts: 1314
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

Absolutely amazing. I will review this in the coming week - since this sounds almost exactly how we're going to need our "Customer Products" setup. I'll be sure to give feedback and code contributions whenever I can Smiling

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 5378
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

On that note... I'd recommend making this a project on Drupal.org ASAP so folks can more effectively give you feedback. Laughing out loud A project the size will quickly become unwieldy in a single forum thread. You can also make a contrib page here that links directly to your project page on Drupal.org so folks can find the project easier.

Posts: 33
Joined: 03/05/2008

Thanks for the support guys! I will make this a Drupal.org project within a few days.

I will also, as Ryan suggested, make sure I document ideas regarding the next version of Ubercart. As I look back over my code, I will write down the various access permissions and hooks I'd like to see in the future.

Posts: 33
Joined: 03/05/2008

Ubercart Marketplace is now a project at drupal.org.

Please check it out there for the latest code and to report bug reports or feature requests:
http://drupal.org/project/ubercart_marketplace

Posts: 2
Joined: 08/03/2008

Hello,
Thank you very much for your module!
Tell me, please, how to disable "Seller commission". I have independent sellers on my site and I don't need this option.
Thank you.

Posts: 33
Joined: 03/05/2008

While there is no direct way to remove it, you can choose a configuration like the following to get the same result.

Turn on "Automatically calculate commission" at admin/store/settings/seller. Also, set the Default Commission Rate to 1. This will in effect make the amount the seller should be paid equal to the sell price. This will hide the seller commission field and fill it with an appropriate amount.

Posts: 15
Joined: 10/15/2008

I really do appreciate the work you guys doing.. its priceless ! both ubercart and the market place modules are one of its kind. sorry if i sound offensive but this is what has wasted my 48 hours. just because the proper documentation wasn't available.. infact this issue dont even need a very sophisticated .doc file..

Quote:

-Make necessary backups.
-Extract Ubercart Marketplace in your sites/all/modules folder in Drupal directory.
-Place packingslip.itpl in sites/all/modules/ubercart/uc_order/templates directory.
-Patch uc_shipping module using included (non contextual) patch or adding the following two lines manually:
~line 1225 (last line of uc_shipping_package_save()): module_invoke_all('package', 'save', $package->package_id);
~line 1235 (last line of uc_shipping_package_delete()): module_invoke_all('package', 'delete', $package_id);

points 1 and 2 are absolutely clear.. the line 1225 of uc_shipping module is

Quote:

if (count($types)) {
and is no way the 'last line of uc_shipping_package_save().. the last line of the particular function is at 1229.. which states '}'

same is the case with the uc_shipping_package_delete().. if you wouldve spent just a lil 2..3 minutes more on this wonderful module you developed.. there will not be much difficulty to noobs like me. I dont know where to insert the two lines so i downloaded cygwin to patch it.. but the patch file you provided isnt working and it says.. missing header for unified diff at line 1.

please dont make web developers suicide on such minor issues.. ;(

Posts: 33
Joined: 03/05/2008

I apologize for your troubles. Unfortunately, I have not found time to write better documentation and Marketplace is still currently in BETA (although stable) state and therefore geared towards developers.

Depending on your editor, your line numbers may differ (that is why I wrote ~ approximate symbol by them).

At the very end of this function:

/**
* Save a package.
*/
function uc_shipping_package_save($package) {

place module_invoke_all('package', 'save', $package->package_id);

like so

    db_query("UPDATE {uc_packages} SET ". implode(',', $types) ." WHERE package_id = %d", $values);
  }
  module_invoke_all('package', 'save', $package->package_id);
}

Do similar for uc_shipping_package_delete() in uc_shipping.module

/**
* Delete a package.
*/
function uc_shipping_package_delete($package_id) {
  db_query("DELETE FROM {uc_packages} WHERE package_id = %d", $package_id);
  db_query("DELETE FROM {uc_packaged_products} WHERE package_id = %d", $package_id);
  drupal_set_message(t('Package @id has been deleted.', array('@id' => $package_id)));
  module_invoke_all('package', 'delete', $package_id);
}

Posts: 15
Joined: 10/15/2008

copy/paste this to readme file.. I was using zend studio which is pretty much the standard for php. Anyways I find open source projects like these provide far better support as compared to the one i pay $5000. as i said this is priceless ! Thanks once again.

Posts: 13
Joined: 10/11/2008

I didnt notice it before. But I tried to create the home page link as user/% so users would be directed to there own profile.
But insted i get sent to this random page with files and orders headers tabs. nothing else on the page except user profile.
Anyone else got anything like this.

Posts: 36
Joined: 07/16/2008
Getting busy with the Ubercode.

This is exactly what I am looking to do with an upcoming project. Thank you for your hard work. Should I decide to take it, expect some patches/bug fixes in the next coming month or two.

Thanks again,
Jordan

Posts: 33
Joined: 03/05/2008

Thanks Jordan. I am always looking for community input and modifications to improve Marketplace. I look forward to seeing what you accomplish.

Posts: 15
Joined: 10/15/2008

I tell you what.. this module makes ubercart exceptional.. love the developers of marketplace Eye-wink

Is there any work around so that sellers can change stock, threshold of their products?

edit.. i found this --> http://drupal.org/node/279611 and it was really helpful..

Posts: 33
Joined: 03/05/2008

Thank you for your compliments of Marketplace. I worked hard to bring such power to the already great Ubercart. The patch you found for Ubercart should help you out. Good luck.

Posts: 4
Joined: 10/29/2008

hey, first of all, thanks for making an excellent module. I am using it right now for a client. I was just wondering if you were planning on updating this for drupal 6 and also...on the Tazetta site. I'm trying to figure out how to grab the "my products" view for user profiles (I am also using bio, panles, adv prof kit) and if it's possible to include the image of the product as well?

Thanks again.

Posts: 33
Joined: 03/05/2008

If I remember, that is a simple view with an argument to check the uid of the user's profile from url. Being a view, you could add a product image and in fact that's not a bad idea.

Marketplace will be updated to D6. When? I am not sure when I will get time at the moment. I am open to assistance.

Posts: 36
Joined: 07/16/2008
Getting busy with the Ubercode.

So far my experience with marketplace has been great. I've installed it, configured it a little and setup the structure of most of my website. So far so good.

I found a small issue on a server I installed it on which has PHP warnings enabled.

Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of module_invoke_all(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in /home/eocean/dev/htdocs/sites/all/modules/ubercart_marketplace/mp_products/mp_products.module on line 219

Here's line 219

<?php
       
// invoke hook_list_product()
       
module_invoke_all('list_product', &$node);
?>

I believe it should be changed to

<?php
       
// invoke hook_list_product()
       
module_invoke_all('list_product', $node);
?>

This removes the pass by reference. I grepped all of market place's and ubercart's code to see if anything uses this list_product hook, but nothing turned up. Reason I'm posting this here is because I'm unsure if there's an intensional reason for doing this that I'm un-aware of....if not, it's a quick fix to resolve the warning.

Look forward to digging harder into it next week as I start to theme my site.

Thanks again,
Jordan

Posts: 33
Joined: 03/05/2008

Thanks. I actually just committed such a fix a day ago to BETA5 (along with a few other minor fixes). The hook is a new one provided by Marketplace for a potential use by modules extending its functionality.

Posts: 1314
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

Turgrid,

Thought I'd let you know that rifftrax.com now uses Marketplace. When you create an account you are given an option to signup for "iriffs" which is our customer riffing feature. From there you can create products and so far it's working pretty well Smiling You can see the ones that people have created at www.rifftrax.com/iriffs

Also, I wanted to say that my "find" from a couple weeks ago was wrong. Right now the SQL queries are looking for all nodes of type 'product' when that doesn't allow for Product Classes. Classes is actually where Marketplace can shine, because it allows you to keep separate your official, main site-based releases from the customer products.

For instance our nodes for customer products are "iriff" node types as opposed to the usual Ubercart "product" node type. So if you can find a way in there to get the module working with products and product classes I think it'll be huge.

Feel free to check out the site, and sign up for iRiffs, and let me know what you think.

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 33
Joined: 03/05/2008

I noticed that Rifftrax was updated. Nice new look! I will sign up and check it out in more depth and share my feedback. I can't wait.

I believe I caught the error when I did the very recent update to BETA5 (which fixes a few of the other bugs floating around too). The query in discussion should check if the node type is in the array of product classes and not just product.

Thanks.

Posts: 36
Joined: 07/16/2008
Getting busy with the Ubercode.

I'm working on little patch to allow the sellers to each keep their own "Origin" shipping sources saved. It requires another database table unfortunately (essentially the same as uc_orders).

I'll polish it up and submit tomorrow hopefully once I get the bugs worked out.

This will allow for each user to keep a list of "product origins" each time they ship an item out and use a new address.

Posts: 9
Joined: 10/29/2008

Marketplace is amazing. Thank you so much for it!

As I less-than-impressively revealed in another thread, I'm having trouble getting it to work with Product Kits.

If I try creating a Product Kit, I get a "Commission must be greater than zero." error - unless I have a sitewide base price set, then I get a "Sell price must be greater than or equal to sitewide base price of $XXX".

Should it work, and I have it misconfigured?
or
Is it not yet compatible with Product Kits?

Thanks!

Posts: 1
Joined: 11/15/2008

danroth wrote:
Marketplace is amazing.

Thanks!

yes thanks its beautiful!

Posts: 36
Joined: 07/16/2008
Getting busy with the Ubercode.

I'm getting to the point where i need to deal with where the hell are my products going to ship from problem.

My marketplace project has Sellers & Manufacturers. Each Seller has it's own set of Manufacturers and I was doing this with a custom CCK type and node reference. Created a view for my node-reference, to only display the manufacturers for the current seller. Worked great, but doesn't help me with the where to ship from issue. My client requires I display where the product is shipping from and the shipping options directly on the product page....so I did some diggin' around.

Core-Ubercart uc_quote provides some hooks into a contrib module called uc_manufacturer to allow each product to ship directly from a particular manufacturer. Perfect!

Ubercart product page says this:

When delivering products to customers, the original location of the product must be known in order to accurately quote the shipping cost and set up a delivery. This form provides the default location for products, either individually or an entire manufacturer's line. If a product's individual pickup address is blank, Übercart looks for the manufacturer's. If that is also blank, it uses the store's default pickup address, which can be set here.

I ended up finding the http://drupal.org/project/uc_manufacturer project, which I had no idea existed.

Now the problem with uc_manufacturers is it doesn't use CCK node types for these manufacturers out of the box, although the developer of the module suggest for more advanced users, they might want to do this.

I've put most of my thought on what to do about this issue in this feature request for uc_manufacturers. I simply want to make both projects aware of each other.

http://www.ubercart.org/issue/7617/uc_manufacturers

I feel the integration of Marketplace with a slightly more robust implementation uc_manufacturers would make for a great implementation into Ubercart 3.x and would almost fully complete the multi-seller environment.

Discuss Laughing out loud

Posts: 36
Joined: 07/16/2008
Getting busy with the Ubercode.

I think one of the first steps to dealing with this issue is standardizing what "Shipping From" information is stored. uc_quote uses two tables, uc_quote_product_locations, uc_quote_manufacturer_locations...i'm going to create uc_quote_seller_locations and work from there.

ATTN: Ryan.

Did uc_manufacturers used to be in core? Seems like uc_quote is in love with it.

Posts: 5378
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

j0rd wrote:

ATTN: Ryan.

Did uc_manufacturers used to be in core? Seems like uc_quote is in love with it.

I'll redirect you to Lyle for the full answer, but the short answer is yes. Sticking out tongue

Posts: 36
Joined: 07/16/2008
Getting busy with the Ubercode.

Short answer is enough Laughing out loud Explains everything.