Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 3
Wholesale/Retail Prices and Shipping Rates based on Customer Group
 
Ryan Showers
Jr. Member
 
Total Posts:  10
Joined:  2008-09-18
 

I wasn’t very happy with the way Magento handled prices based on groups, using the product->prices->add group method.  So I thought I would post this here for anyone looking to add retail/wholesale prices and shipping rates.

Here we go…

Create 2 websites.  Your default website will be “retail” and the wholesale website will be “wholesale”.  You’ll also need to create a store and a store view for each of these websites.

Make a new directory under your magento root called “wholesale” and copy ‘.htaccess’ and ‘index.php’ from your magento root directory to the new wholesale directory.

Edit wholesale/index.php
change

Mage::run();
to
Mage::run('wholesale');
change
$mageFilename 'app/Mage.php';
to
$mageFilename '../app/Mage.php';

Then change some configuration values…
System->configuration->catalog->prices->catalog price scope = global
System->customer configuration->account sharing options->share customer accounts->global

In the configuration area, select the wholesale website (not the store view) from the drop down, then click the ‘web’ link on the vertical menu.
BASE URL = http://YOURDOMAIN/wholesale/
BASE SKIN URL = {{unsecure_base_url}}../skin/
BASE MEDIA URL = {{unsecure_base_url}}../media/
BASE JS URL = {{unsecure_base_url}}../js/

You’ll want to do the same for the secure url settings.

At this point we’ve created a new path for magento to use - ‘/wholesale’.  We’ve configured Magento to use products, template, images, etc. all from your default store.

You can now edit your products, click the website tab, assign them to the wholesale website, uncheck ‘Default/Global’ for the price and enter a new price.

Now that you have 2 websites setup, you can configure the shipping methods for both under system->configuration->SELECT WEBSITE->shipping methods

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ryan Showers
Jr. Member
 
Total Posts:  10
Joined:  2008-09-18
 

The downsides to this method?  Shopping carts are not shared between websites.

The ideal situation for my needs is to allow a wholesaler to shop the retail website as a guest.  Once the wholesaler logs in, he/she is redirected to the wholesale store, which would update the cart with the website’s prices, and display the wholesale shipping options on checkout.

I wrote a little code, rough draft, that will redirect wholesale customers to the wholesale website when they login.  It also redirects any guest/non-wholesale customer back to the default website.

I placed this code in /app/design/frontend/MYTEMPLATE/MYDESIGN/template/page/html/head.phtml, after the license notice and before the title tag

<?php
    
/*
    This code assumes the following...
      # retail website id = 1
      # wholesale group id = 2
      # customer group and whoesale website have the same name (i.e. 'wholesale')
      # the wholesale website is installed in a subfolder called 'wholesale'
    */
    
$_isLoggedIn $this->helper('customer')->isLoggedIn();
    
$_websiteName strtolower(Mage::app()->getWebsite()->getName());
    
    if(
$_websiteName == 'wholesale'){
      
if($_isLoggedIn === true){
          $_myGroupId 
Mage::getSingleton('customer/session')->getCustomerGroupId();
          
          
//You could use this code to get the wholesale group name by id.
          /*$_collection = Mage::getModel('customer/group')->getCollection();
          foreach($_collection as $_group){
              $_g = $_group->toArray(array('customer_group_id', 'customer_group_code'));
              $_groups[$_g['customer_group_id']] = $_g['customer_group_code'];
          }
          $_myGroupName = strtolower($_groups[$_myGroupId]);
          */
          
if($_myGroupId != 2){
              
//retail customer is trying to view the wholesale website
              //redirect them back to the retail store.
              
$_parsedURL parse_url(Mage::getBaseUrl());
              
$_retailURL str_replace($_parsedURL['path']''$_SERVER['REQUEST_URI']);
              
$_retailURL Mage::app()->getStore(1)->getBaseUrl() . $_retailURL;
              
header("Location: $_retailURL");
              exit;
          
}
      }
      else{
          
//guest is trying to access the wholesale website
          //redirect them to the retail website login page.
          
$_retailURL str_replace('/wholesale'''$this->helper('customer')->getLoginUrl());
          
header("Location: $_retailURL");
          exit;
      
}
    }
    
    
//Wholesale customer just logged in
    //Redirect them to the wholesale website.
    
else{
      
if($_isLoggedIn === true){
          $_myGroupId 
Mage::getSingleton('customer/session')->getCustomerGroupId();
          if(
$_myGroupId == 2){
              $_wholesaleURL 
Mage::getBaseUrl().'wholesale';
              
header("Location: $_wholesaleURL");
              exit;
          
}
      }
    }
?>

If anyone knows a way to move a users’ cart from one website/store to another website/store, then this would be good enough for me.

Otherwise, wholesalers will have to login to the wholesale store and start shopping - or they will lose their entire cart once they login.

 
Magento Community Magento Community
Magento Community
Magento Community
 
gbear
Jr. Member
 
Total Posts:  19
Joined:  2008-08-08
 

Thanks for posting your code, a great solution.  I was looking for a similar solution, but have a wholesale & retail store and wanted to make the wholesale store require a login to access it.  Because I have 2 distinct stores & 2 sets of customers - could remove the check for the customer group.  Had to allow a bypass to the wholesale login screen.  I guess the only potential issue is on every page of the site - whether retail or wholesale at least the first part of this check is being run.

<?php
    $_isLoggedIn 
$this->helper('customer')->isLoggedIn();
    
$_websiteName strtolower(Mage::app()->getWebsite()->getName());
    
    
//check if accessing the wholesale website && pass through if accessing the wholesale login page.
    
if($_websiteName == 'wholesale website' && $_SERVER['REQUEST_URI'!= '/store/wholesale/customer/account/login/' {
        
//if not logged in, send to the wholesale login page.
        
if(!$_isLoggedIn){
                $_wsURL 
$this->helper('customer')->getLoginUrl();
                  
header("Location: $_wsURL");
                  exit;
        
}
    }
?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
bennm
Jr. Member
 
Total Posts:  5
Joined:  2009-01-20
 

Hi, I have a similar query but not quite the same.

I wish to have 5 price breaks on each product for trade users but when a visitor is retail or just browsing to hide the last two.

I think two stores would be overkill for the solution i am looking to achieve.

Any help would be much appreciated. grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
Stress Head
Member
 
Total Posts:  32
Joined:  2008-08-28
 

This is exactly what I need, and I sort of have it working, apart from the pricing?

Where do I change this “uncheck ‘Default/Global’ for the price and enter a new price. “ I can’t seem to find that anywhere.

 
Magento Community Magento Community
Magento Community
Magento Community
 
bmartus
Sr. Member
 
Total Posts:  128
Joined:  2008-05-22
Greenville, TX
 

@Ryan Showers—We’re trying to essentially do the same thing .. if you get anywhere, let me know. ( http://www.magentocommerce.com/boards/viewthread/26329/ )

I’ve been trying to move the cart from one site to another when they switch between sites, but what ends up happening is the destination site’s session creates a new empty cart and wipes out the newly-reassigned cart.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Weezers Gifts
Member
 
Total Posts:  71
Joined:  2008-11-08
PA
 
Stress Head - 29 January 2009 11:41 PM

This is exactly what I need, and I sort of have it working, apart from the pricing?

Where do I change this “uncheck ‘Default/Global’ for the price and enter a new price. “ I can’t seem to find that anywhere.

Yes I as well would like to know.  I have around 3700 products that I need to change prices on to reflect wholesale prices and really don’t want to have to do this manually :(.

Since I have so many items and all are in different price ranges is there a way to enter a percentage for marking up my costs by say 25% for all items at once?

Thank you for this post and any help you might be able to share concerning the pricing.

 
Magento Community Magento Community
Magento Community
Magento Community
 
codex73
Jr. Member
 
Total Posts:  6
Joined:  2009-03-06
 

I have a similar situation. We will host 100+ stores which will all serve from the same global products (products group).

Pricing will be all equal across all sites so I don’t have that problem. Cart’s need no relation.

Is it all necessary to create a physical folder for each site or this is just because of the pricing differences?

SAME PRODUCT DATABASE ==> MULTIPLE SITES

See my other post: http://www.magentocommerce.com/boards/viewthread/34616/

 
Magento Community Magento Community
Magento Community
Magento Community
 
Nexus Rex
Sr. Member
 
Avatar
Total Posts:  139
Joined:  2008-07-10
Utah, USA
 
Weezers Gifts - 11 February 2009 01:26 PM

Stress Head - 29 January 2009 11:41 PM
This is exactly what I need, and I sort of have it working, apart from the pricing?

Where do I change this “uncheck ‘Default/Global’ for the price and enter a new price. “ I can’t seem to find that anywhere.

Yes I as well would like to know.  I have around 3700 products that I need to change prices on to reflect wholesale prices and really don’t want to have to do this manually :(.

Since I have so many items and all are in different price ranges is there a way to enter a percentage for marking up my costs by say 25% for all items at once?

Thank you for this post and any help you might be able to share concerning the pricing.

Weezers,

I have written a blog post that walks you through a simple solution that should work for what you describe via Customer Groups and Catalog Price Rules:

How to Setup Simple Customer Specific Discount Pricing in Magento Commerce

keywords: custom, customer, dealer, magento, online, price, pricing, promotion, catalog, rule, store, wholesale

 
Magento Community Magento Community
Magento Community
Magento Community
 
l781
Sr. Member
 
Total Posts:  109
Joined:  2008-11-09
 

Hi,
for example - i have:
- one item with cost set to 100$, but regular price is - 200$,
- second item have cost set to 10$ ard regular price - 12$.

I want to allow for Wholesale users make price rule based on COST value (not regular price value), for example - for wholesale users +10% from cost:
- first items price would: 100$+10%=110%;
- second items price would: 10$+10%=11%;

any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Nexus Rex
Sr. Member
 
Avatar
Total Posts:  139
Joined:  2008-07-10
Utah, USA
 

l781,

Currently Catalog Price Rules can only be modified based on the Regular Price. I will put in a feature request to allow for them to index off the Cost. That could be a powerful addition.

 
Magento Community Magento Community
Magento Community
Magento Community
 
MamaOm
Jr. Member
 
Total Posts:  3
Joined:  2009-05-05
 

Hi I am basically trying to do the same. Create an online store where wholesalers can register and get wholesale prices and make wholesale orders. I found more tips here http://nik.chankov.net/2009/04/17/creating-wholesale-solution-with-magento-commerce/
but I am not able to find some files mentioned, and I cant seem to disable the custumer registration plugin… Any advise is sooooo welcomed. I am a rooky at this.
THANKS

 
Magento Community Magento Community
Magento Community
Magento Community
 
Nexus Rex
Sr. Member
 
Avatar
Total Posts:  139
Joined:  2008-07-10
Utah, USA
 

MamaOm,

What files specifically are you not able to find?

 
Magento Community Magento Community
Magento Community
Magento Community
 
cheekygeek
Jr. Member
 
Total Posts:  30
Joined:  2009-04-14
 

First of all, thanks so much for sharing this info. I get this far in following the instructions and find that when I try to go to my site.com/wholesale/
I get a 404 error. Everything else still works fine.
Attached is a screenshot of my Base URLs section. Please tell me if something looks incorrect.

This is as far along as I am in the instructions (Magento version 1.3.2.3):

Ryan Showers - 10 November 2008 12:38 AM

I wasn’t very happy with the way Magento handled prices based on groups, using the product->prices->add group method.  So I thought I would post this here for anyone looking to add retail/wholesale prices and shipping rates.

Here we go…

Create 2 websites.  Your default website will be “retail” and the wholesale website will be “wholesale”.  You’ll also need to create a store and a store view for each of these websites.

Make a new directory under your magento root called “wholesale” and copy ‘.htaccess’ and ‘index.php’ from your magento root directory to the new wholesale directory.

Edit wholesale/index.php
change

Mage::run();
to
Mage::run('wholesale');
change
$mageFilename 'app/Mage.php';
to
$mageFilename '../app/Mage.php';

Then change some configuration values…
System->configuration->catalog->prices->catalog price scope = global
System->customer configuration->account sharing options->share customer accounts->global

In the configuration area, select the wholesale website (not the store view) from the drop down, then click the ‘web’ link on the vertical menu.
BASE URL = http://YOURDOMAIN/wholesale/
BASE SKIN URL = {{unsecure_base_url}}../skin/
BASE MEDIA URL = {{unsecure_base_url}}../media/
BASE JS URL = {{unsecure_base_url}}../js/

You’ll want to do the same for the secure url settings.

At this point we’ve created a new path for magento to use - ‘/wholesale’.  We’ve configured Magento to use products, template, images, etc. all from your default store.

I should also mention that I am using Fooman Speedster and so had to make the necessary changes in my root .htaccess file. It is that (modified) .htaccess file that I copied to the “wholesale” directory. Perhaps that is my problem? (I don’t understand .htaccess directives well enough to diagnose, but I have attached the file as htaccess.txt.

Thanks for any help!

Image Attachments
wholesale404.png
File Attachments
htaccess.txt  (File Size: 5KB - Downloads: 648)
 
Magento Community Magento Community
Magento Community
Magento Community
 
cheekygeek
Jr. Member
 
Total Posts:  30
Joined:  2009-04-14
 

Fixed my 404 problem. As it turns out, in the CMS I only had the Home Page turned on for the Retail Store view. When I changed it to “All Store Views” it worked (not immediately) but (within 15 minutes) after my next cron job ran. Posting this here in case it is of any help to anyone else!

 
Magento Community Magento Community
Magento Community
Magento Community
 
M$ Guru
Jr. Member
 
Avatar
Total Posts:  14
Joined:  2009-10-06
Nor Cal
 

If you do plan on going this route, with a wholesale store, which I would suggest. I’d like to make a suggestion that could possibly save you months of frustration. You’ll see people all over these forums talking of .htaccess files, and php.ini files. I tried all of them. Finally today, I installed a default ini from my cpanel, and most all of my issues have been resolved. It was so easy… I’m kicking myself for not doing it sooner. This was after my wholesale store crashed, while the retailed stayed up and unaffected. Go figure, they use the same files, the same database, and only one crashed. And this with exactly the same php.ini and htaccess files, in both wholesale and retail. Just thought I’d put it out there. Good luck folks.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 3