Creating Wholesale Solution with Magento Commerce

osCommerce to Magento migrationMy first approach for this post was to explain my first impressions from Magento Commerce, but I decided to explain how I managed to create a Retail/Wholesale solution required for a current project.

The requirement (so far, because it’s an ongoing project):

The client want to have a shop where regular customers to be able to see products with their retail price, while Wholesale partners to see the prices with ? discount. The extra condition: retail and wholesale prices hasn’t mathematical dependency. So, a product could be $100 for retail and $50 for whole sale and another one could be $60 retail and $50 wholesale. And of course retail users should not be able to see wholesale prices at all.

Basically, I will explain what I did step-by-step, but in order to understand what I mean, you should be familiar with the basics of Magento.

1. Creating two magento websites, stores and views
(Magento meaning of website of course) It’s done from from System->Manage Stores. The result is:
Website | Store | View

Both sites using the same category/product tree

2. Setting the price scope
in System->Configuration->Catalog->Catalog->Price set drop-down to Website. Now you could enter prices per store/website and they could be totally different.

3. Get some plugins
Get following plugins from Magento Connect and install them from admin: System->Magento Connect->Magento Connect Manager:
Netzarbeiter_LoginCatalog – User need to login in order to see the store (it will be used for Wholesale site)
Netzarbeiter_CustomerActivation – User need to be approved from site admins in order to be able to login to the site. (again it will be used for wholesale site)

Both plugins need to be activated for wholesale only. Because they are activated when they are installed, you need to disable them for Default/Retail website and to leave enabled to Wholesale. You should know that distinction between sites in System->Configuration is done from top left corner of the config window.

First plugin is enabled/disabled from: System > Configuration > Catalog > Login only catalog
Second one: System > Configuration > Customer > Customer Activation.

4. Setting separate url for Wholesale
Now wholesales need to have separate urls, so regular users will access, while wholesale will access I found this solution in the Magento Forum: Thread.

So, following the instructions I created directory wholesale/ and copied .htaccess and index.php files from the root directory. Modifications in the index.php are the same as in the Forum:
Mage::run(); become Mage::run(‘wholesale’);
$mageFilename = ‘app/Mage.php’; become $mageFilename = ‘../app/Mage.php’;

5. Change the wholesale paths from the admin
From System->Configuration (select Wholesale website)->General->Web and change the paths by adding wholesale/ (it’s also mentioned in the forum thread).

6. Adding products to both websites
When adding products, you should mark them visible for both sites. This is done from Product page->Websites tab.

That’s it! Now on users will see full catalog, they can login without Admin approval and prices will be retail, while on only users registered as wholesale and activated from admin will be able to see catalog with wholesale prices.

What’s left…

And this was the easiest part … the rest is to import about 2000 products from the current osCommerce store, and to add another 4000 from the client’s ERP system. After this on regular basis to update prices and quantities from ERP system. 🙂

Hopefully this will help someone.

98 thoughts on “Creating Wholesale Solution with Magento Commerce

  1. M

    Have had a brief look through, and just wanted to say this looks great. Good work on the walkthrough.

    This has been very helpful thanks.

    Out of interest, it looks like you can only have one group of wholesale users and they all receive the one discounted price is that right? If you wanted to grant different wholesalers different discounts based on their volume purchases or relationship, I assume you would have to create yet another website and update all 6000 products with a third set of prices!? Is that right? Lots of work 🙁

  2. Nik Chankov Post author

    M, you should not need to create new shops. There are gropus and groped promotions, so once a wholesale is registered you can attach a group to him which could receive extra discount to some price increases.

  3. Melissa

    I see your work Nik! very nice! but out of the interest, it looks like you can only have one group of wholesale dresses users and they all receive the one discounted price is that right? If you wanted to grant different wholesalers.

  4. Nik Chankov Post author

    Melissa, with Magento it’s possible to create “wholesale discount group +5%” and another “wholesale discount group +7%” and to attach each group to different wholesale users, so this should not be a problem.

    Also, whole sale users are distinct by shop, so wholesalers should be registered in the wholesale shop.

  5. Ashok

    Thank you for sharing this, its very useful

    I have facing a problem please help.
    I have created a wholesale module as mentioned above, but when i am running the wholesale site its shows me following error: “There was no Home CMS page configured or found.”

    Please help.

  6. Nik Chankov Post author

    Yes I had the same headache 🙂 This is because the CMS pages are associated to the Retail (default) shop.

    Go to admin->CMS->manage pages and you will see that now there is ability to assoc. a pages to a shop. Once you select them for both sites it should work.

  7. Ashok

    Thank you Nik, its helpful my problem has been solved.

    Thanks again for your great work.

  8. Leigh

    Hey Nik – great tutorial. One question though, my new /wholesale/ site doesn’t seem to be loading the package or theme that governs both the retail and wholesale. How can I set up the wholesale to use the same package and theme as my retail site?

    Thanks in advance!

  9. Steve

    Thanks for the post, Nik.

    Posting this, as it may be helpful for others. I’d created my product catalog before deciding to use multiple stores to handle dealer and distributor pricing. So, I had to create two additional stores. Luckily my catalog only contained about 40 products.

    Since I’d created the products before creating the additional stores, I had to revisit each product independently and modify their website scope, under the “Websites” sections.

    So if you’d created your catalog THEN your separate stores, you’ll need to set each product to exist in your stores. I’m sure you could do this with some SQL much more quickly, but I only had 40, so I did them manually.

  10. Paul Hutton

    Hi Nik,

    I was wondering if you had come across a requirement to hide all prices from a site until a user had logged in. Do you how how this might be done with Magento?


  11. Nik Chankov Post author

    Hi Paul,

    I doesn’t have such requirement in my project. Basically on the dealer’s store no one can see anything until he logged in.

    I think it will be really easy to add a check in your template in magento/app/design/frontend/default/default/template/catalog/product/price.html. It will hide all prices.

  12. Liam

    Great post. Just wondering a more simple work around perhaps for most people is just to setup tierred pricing which starts at qty “1” and applies to only a certain customer group such as “wholesale”

    That way only whole sale customers will get this price when logged in and you don’t need to create multiple stores.

    The downside to this is that tierred prices aren’t viewable until the actual product page so if you have a site where wholesale customers need to browse they might get confused about price.

    But for us where we place wholesale orders by phone this is fine.


  13. Cheekygeek

    Thank you for this post. It is EXACTLY what I am trying to do.
    I am leaving step 3 (Netzarbeiter plugins) until last so I can be sure I have everything but the log-in requirement working first. (Hope that is OK).

    I believe I’ve followed all of your other instructions properly, but I’m confused regarding the URLs for products between the two stores. Even though I’m using the same products for the wholesale and retail stores (only the prices are different) what should the URLs look like?

    My retail store is
    so a product should be
    However, if I’m in the wholesale store, shouldn’t the URL look like: ?

    My problem is that is doesn’t.
    If I go to
    and click on a category, I go to retail view)
    What have I missed?

    Thanks for any insights!

  14. Nik Chankov Post author

    I think you missed 4. – Setting separate url for Wholesale.

    Basically you need to go to
    System->Configuration, then you need to select the wholesale shop (from the drop-down list in the top-left corner). Then go to Configuration->Web tab from the left and change the urls.

    This will set urls to your wholesale shop, while the retail one will keep the original path.

  15. Cheekygeek

    Thank you so much for replying.
    I did do step 4 and you can see how my settings looks with this screencapture:
    Is everything correct?
    I’m also wondering if my .htaccess in the wholesale directory is correct.
    Specifically the rewritebase. Should this still point to the ROOT magento directory or should it now be set to “/wholesale/”? (I have also tried “/wholesale” but I get no joy with any combination that I have tried.)

    I may also be confused with the CMS part of this, as I have a page defined that should load with “/wholesale/” but it isn’t coming up.

  16. pling

    HI NIK,

    I notice can set the minimum amount separately for retail and wholesale inside system/configuration/sales this should be able to solve my problem 🙂

  17. Cheekygeek

    My last post has my solution. I recommend saving Nik’s Step 3 until the END of the process, after you know you just have the two stores running properly.

    You must modify two lines of the index.php in your wholesale folder (Nik’s Step 4). I found that my problem was solved when I changed the line of index.php that says:
    (NOT simply
    as the thread Nik points to advises.)

    If you have defined a different home page for the Wholesale store’s home page in your Magento CMS, you should see IT when everything is working. In my case, changing the line above did the trick. However, my new wholesale home page loaded without CSS styling. This was due to my installation of Fooman Speedster. A multistore installation of Fooman Speedster requires an additional step: creating a symlink from wholesale/lib to ../lib. (This is pointed out on the Fooman Speedster installation page.

    I always refresh my cache (which should be OFF during development). Some people completely dump their /var folder to make sure it is clear and not providing you some false page views.

    Hope this helps!

  18. Cheekygeek

    I should also mention that in System > Configuration > General > Web (under the Default Configuration scope) I have “Add Store Code to Urls” set to “No”. (Not sure if that really matters, but thought I’d mention it.)

  19. HySer

    Cheeky, I tried setting my wholesale index.php file to Mage::run(’wholesale’,’website’); and I just get a 404 not found…

  20. Cheekygeek

    Check the names on your stores (Admin > System > Manage Stores). Here’s mine:

    Website Name > Store Name > Store View Name
    Retail > retail > default
    Wholesale > wholesale > wholesale

    I’m not sure what the ‘wholesale’ parameter in the Mage::run statement is pointing to (directory name or store name or store view name) but try it with lining up your Website & Store/Store View names to match mine and see what happens.

  21. HySer

    Got it working, thanks! One last question – Anyone know how to specify that the Wholesale store shows “Available on XXXX date” for each product, and does not process credit cards etc., but rather just emails the order to me?

  22. Cheekygeek

    404 errors are mostly a problem with either not having pages defined in your CMS or not pointing at those page properly. Here’s a look at the pages in my CMS (close to default, but created a 2nd home page for my wholesale store):


    Now here is where I’m pointing the Default Web URL under the default scope of the Admin > Config > Web

    Now compare that to where I have the Default Web URL pointing under the wholesale scope:

    Hope that helps. (I’m still a relative newbie at this and just learning, so if someone more advanced notices any problems in the advise I’m giving, please feel free to pitch in!

  23. pling

    Thanks Cheekygeek for the solution, I solve it by changed to Mage::run(’wholesale’,’website’); at wholesale/index.php

    And I set the Default “Web Server Rewrites” to YES and wholesale “Web Server Rewrites” to NO

    I also remove ../ from Base Link URL

  24. Cheekygeek

    Good to hear your problems are solved. Onward and upward!

    One note about the Netzarbeiter plugins in Nik’s Step 3 above (I saved this step until LAST to make sure everything else was working properly).

    Some people are surprised to find that the login page is not required on the wholesale HOME page, but only when a category link is clicked. If you want the login required for your wholesale home page, you can log into the CMS > Manage Pages and add code to your wholesale home page that displays products. Once you do this, a log-in will also be required for your home page. An example of this code is shown below.

    {{block type=”catalog/product_list” category_id=”13″

    You can obtain the category_id number for your categories by going to Admin > Catalog > Manage Categores. Click once on a category in the lefthand side (category tree view) of the page and the Category ID will show up in the heading on the right side of the page.

    See: for a screenshot of this.

  25. Arian

    Thank you so much for the solution.
    I follow all the instructions and setup wholesale and retail sites, but sometimes “wholesale users” linked to “” not to “”!!!
    Thanks for any suggestion!

  26. cheekygeek

    The web URLs are configured under Admin > System > Configuration > General > Web
    Check your URLs for each website scope (Default, Retail, & Wholesale). The only other thing I can think of is that an old URL got cached somewhere, so clear your cache. (Some people will dump their whole var/cache directory to make sure it is really empty.) Hope that helps.

  27. Vivienne

    This is really a good thread. I think this will solve my problem! One more question:

    Are two shops Retail and Wholesale based on one stock or two? What I would like to know is if you can work with one stock for both shops?

    And again Nik, I am very happy with your sollution, as I can see from others in this thread it is working. This means that now we can really start with Magento!!!

  28. cheekygeek

    Yes, if you read Nik’s original post you will see they both work from the same catalog. However, after implementing this solution you can price them differently (between the wholesale and retail) and you can also selectively disable products or even categories from one store (or the other), if you need to. It all depends upon which store’s scope you are in when configuring.

  29. Cheekygeek

    I’m not sure if you will have to. But I’m using the Netzarbeiter_LoginCatalog & Netzarbeiter_CustomerActivation extensions for my wholesale store. If I turn server rewrites for the wholesale store back ON and try to go to my wholesale home page (which displays product, so requires login)… I do not get properly directed to the login page
    ( ). Instead I get a 404 page. Turn server rewrites off for the wholesale store and I get correctly routed to the register or login page.

  30. Duncan

    Hi – could anyone tell me if it is possible to have the retail/wholesale solution – but have multi-language plugins as well? For example I want to have a main landing with links to Europe and United States. The European side will have wholesale and B2C, and so will the US serviced by different warehouses. The European site will need have a few languages like German, Spanish etc. I want to be able to pull reports from teh combined sales from all the sites – Id appreciate any advice. I would also want to have 1 set of products I work off so I do not need to create products for each region. I just want 1 “product pool”. I know the commercial version of Magento can do this but I really cannot afford their fees. Thanks in advance!

  31. Nik Chankov Post author

    I think what you asking is possible. Basically when you do retail shops you are using the default global prices, so you can do German retail, Spanish retail, Polish retail etc. and they all will use the only one Global price. (if there is different currency (like UK you can set a currency to that specific shop)

    The other part is the Wholesale, I think for wholesale you can effort to be only in English? This way it’s really possible.

  32. Duncan

    Hey – I can’t seem to get this to work – Im a bit of a newbie at this – I just in my home page added the code but I dtill get no login. Im not sure what you mean about the “add code to your wholesale home page that displays products”. For some reason when I go to my wholesale page the top menu is actually missing. Besides taht do I need some code to display some other products? Im just using a blank page at the moment plus your code. Thanks in advance!

  33. Nik Chankov Post author

    I believe that retailer should be under Magento, but it could be possible to be this way too.

    Did you set the homepage to be accessible to the retailer too? Go to Mages management and set the home page to be home to both shops.

  34. cheekygeek

    Yes, please read all of the comments above yours. Your set up differs from Niks original instructions IF your retail store is not in domain root folder, but you can probably still do it that way.

    In both of our examples, default = retail and the new subfolder = wholesale. In any event, I would check these things:

    1) That under admin > CMS > pages you have a home page defined for the site that is getting you a 404 error. (I just made a copy of the default home page and made it say something different so I would recognize when it was working).

    2) Check that you have defined the proper URLs for the two stores under Admin > System > Configuration > Web

    3> Check my URL rewrite setting for the 2nd store (in my case “wholesale”) above.

    Pay close attention to what configuration scope your settings are in. Hope this helps.

Comments are closed.