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. Cheekius Geekus

    Hey there Nik,
    Got a solution for this one?

    I have a problem, but I’m not sure if it is a big one or SIMPLE.

    Originally I created two stores (retail & wholesale) that use the same product inventory (but have different prices) – per this thread.

    The default goes to the retail store and goes to the wholesale store. Everything works perfectly.

    Now my bosses want the retail store to get “turned off” and only the wholesale store to be “open”. This would be easy if I had made the wholesale store the and made the retail store but how do I do it so that the home page links go to /wholesale/ instead of ???

    Thanks in advance!


  2. Nik Chankov Post author

    I think this is very easy. I am not sure how it will be treated within admin, but if you go to Sytem->Store managemenr (it’s raw translation because I am using bulgarian version) you can see your 2 stores.

    Click on the wholesale website link (first column) and you will see a check box “set as default”. In addition you could change the order to 0 and set the order of the end customer to 1.

    This will solve your problem I think. I don’t know if this will set the wholesale store as default in the admin too.

    Of course you should change the default paths for the wholesale within configuration.

    Hope that helps 🙂

  3. Jhansi

    If a whole sale buyer login’s in he should see whole sale prices in the price list column

  4. marco-polo

    Hi everybody,
    i have a fresh install 1.401 and the index.php seems to have changed
    default last 4 lines look like this:
    $mageRunCode = isset($_SERVER[‘MAGE_RUN_CODE’]) ? $_SERVER[‘MAGE_RUN_CODE’] : ”;
    $mageRunType = isset($_SERVER[‘MAGE_RUN_TYPE’]) ? $_SERVER[‘MAGE_RUN_TYPE’] : ‘store’;

    Mage::run($mageRunCode, $mageRunType);

    how should i amend here now?
    will have some tries


  5. Nik Chankov Post author

    @Prasoon you rulz! If you have an Enterprice Edition, the developers from Magento should do this for free in exchange for 11k per year.


  6. Amy Pfaffman

    I was so excited to read these instructions:

    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.

    Problem is once I set price scope to website, I still can’t set diff prices for diff stores/websites. I’ve tried changing scope of price attribute, but the drop-down menu is grayed out.

    Also tried changing store views per product, but my other store views don’t show in drop-down menu. Argh!

    What am I missing?

  7. clockman

    i installed those two extensions using the magento connect but i can not see them in the configuration areas you are refering. do i need to do sth more?
    i am using magento

  8. clockman

    hm… i see…
    not even the /wholesale i can do cause of the changes in index.php folder

  9. clockman

    any one that can help with that?
    or any idea of a solution for that in magendo 1.4?

  10. Ortzinator

    Thanks for the guide, it was really helpful. However the plugins don’t do exactly what I’d like them to. For the login plugin, it would be nice if you could specify which areas can be viewed publicly. Right now it seems anonymous users aren’t restricted until they view a category or product. Also the activation plugin isn’t very friendly to the users. After you register it just redirects you to the homepage, with no explanation that you need to wait for activation by an admin.

  11. justin

    Such an awesome article, thank you! However I am stuck.. can’t seem to get it to load, i followed above steps exactly but get the following error message on

    Parse error: syntax error, unexpected ‘.’ in /home/happycow/public_html/wholesale/index.php on line 45

    Anyone know what i have done wrong?

  12. cheekygeek

    Not to be a smart-ass or anything, but have you tried opening up your wholesale/index.php and taking a look at line 45 with a text editor?

  13. sinosk

    too troublesome to have 2 would be better if you can acchieve both retail and wholesale buyer can see their own prices on the same product page.i see zen-cart has the solution.

  14. Ziad

    This is great, this is just what I need. Is it possible to force wholesale customers in the wholesale site to buy in bulk quantities only. So say you want to force wholesale customers to be able to buy in 10s only, i.e. 10, 20, 30 etc.

    How would you do this?

  15. LagunaClassified

    @Ziad, i’m not good in magento and what i will say is just based on experiment.

    Try to add Tier Price in Catalog->Product->Prices.

  16. Che

    I have different approach here and any comment is appreciated.

    I set the user group as wholesale. Then on the product price, i add tier price for wholesale. (Ex. wholesale $50 for 1pc). That’s it, when the wholesaller login, the prices will be different with the retailer.

    Do you think there will be any problem soon?

  17. Pingback: Wöchentliche Linktipps | User Agent - Websites, Online-Marketing, Berlin

  18. Vicky

    If you want to have a retail and a different wholesale price, do you have to enter the product twice, with different prices and in different stores?

  19. Vicky

    Can you give a longer answer please?!

    I have two websites, two stores and two store views.

    I have set the price scope to website.

    But I can’t see how you then enter two different prices without creating separate product records.

  20. Geoff Jackson

    Just about to take on an ecommerce client that wants to show products without prices but then wholesale customers can log in to the system and then see the prices.

    After reading this article, it sounds like this is a pretty good match to what I will be needing to do…

    Will save this for reference and will be sure to stop by again if encounter any issues along the way – heh.

  21. Sam

    Hi guys can any one advise 3 weeks ago on a clients site tier pricing was displaying fine and then just disappeared from the product listing but you can see when you go into the product details.

  22. Leandro Lourenzo

    Thank you for the tutorial!
    I have 2 question I hope someone can help me to understand…
    1 – it is necessary to have customer groups? by using this tutorial?
    2 – Is there a way that i can have the front end to be retail, and on the top right corner an special login for wholesalers? that after login they will see the wholesale price?
    3 – Is there any other way to do this? im using magento

    thank you very much!

  23. Nik Chankov Post author

    Hi Leonadro,

    I left Magento for good long time ago, and I am really happy this way. Sorry, bu my experience was with Magento 1.2, and I don’t have idea what are the changes in the new versions.

  24. darinbutler

    hi there, great info here thanks and i might have missed this but can anyone steer me int he right direction as i need to have a members only registration to then access the storefront with sales by product or by timeframe using community edition. i have seen the two on magento site and although good seem to have limitations. any advice greatly appreciated.

  25. Pingback: The 54 Most Useful Magento Articles of All Time « Custom Magento Development – Collins Harper

  26. Faisal

    really very good post
    for latest magento under index.php you can add following lines
    $mageRunCode = ‘wholesale’;
    $mageRunType = ‘website’;

    new code will look like
    $mageRunType = isset($_SERVER[‘MAGE_RUN_TYPE’]) ? $_SERVER[‘MAGE_RUN_TYPE’] : ‘store’;

    $mageRunCode = ‘wholesale’;
    $mageRunType = ‘website’;

    Mage::run($mageRunCode, $mageRunType);

    further for path do change MAGENTO_ROOT variable

  27. Alex

    With so many extensions available now – cart2quote, individual customer pricing, etc – it is quite simple thing to achieve with Magento

  28. Stephan

    “I left Magento for good long time ago, and I am really happy this way”

    Nik, have you found another shopping cart that you like better?

  29. Nik Chankov Post author

    Yes, there are 2:
    1. Prestashop – very nice written code and possibility to extend the core classes without touching the original ones, hooks and good encapsulating of the modules. This is my first recommendation for all of my clients (not always accepted :))

    2. Opencart – the code is not so mature as in PrestaShop and extening the core mean writing the code in XML files (vqmod), but it’s simple enough, so every php developer could easily extend and modify it. Don’t like the vqmod way of changing the core, but so far it’s working.

  30. vicky

    Hello there,
    I had follow the above steps to create the retailer and wholesale links separately. The normal site(retailer is working fine) but for the wholesale it is showing me “404 error: Page not found.”. Could you please let me know where and what i am missing. In my index.php file The changes are as follows::
    $mageFilename = ‘../app/Mage.php’;
    $mageRunCode = ‘wholesale’;
    $mageRunType = ‘website’;
    Mage::run($mageRunCode, $mageRunType);

    I am using Magento ver. Please reply me soon.

  31. Claudio


    Instead of
    $mageRunCode = ‘wholesale’;
    $mageRunType = ‘website’;


    $mageRunCode = “wholesale”;
    $mageRunType = “website”;

  32. Ray

    Dude can you please upload any video for making wholesale/retails store? it will help us a lot…..waiting for your reply.

  33. Leste59

    Is een goedkope Magento webshop hetzelfde als een voordelige Magento webshop? Goedkoop wordt al snel geassocieerd met slecht, niet goed of niet volledig. Terwijl je bij voordelig zou verwachten dat het een prima shop.magento webshop

  34. Pingback: The 54 Most Useful Magento Articles of All Time | @nexcess

  35. Mahesh Sangam

    Hello All, IM very new to Magento & my boss want me to develop two sites one for Retail and one for Wholesale, Please if you guys help me or give me url to learn set-up two views step by step solution… im very much thankful and im looking forward to please some sure help me…

Comments are closed.