Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Two membership levels, retail & wholesale


golding

Recommended Posts

:idea: I'd like to see a method that allows wholesalers, or resellers to log into a store and get different prices/quantities etc than normal buyers from the general public. This would mean the signing up process would have to flag members as either retail, or wholesale members. Those who sign up as wholesale members would see minimum quantiies on the site, as well as lower rates. This would prevent regular customers from getting wholesale prices because of the minimum quantities. :)

Link to comment
Share on other sites

I actually just finished a small hack for this exact thing (offering wholesale accounts/pricing). I did it in 1 step (divided into a lot of smaller steps). Just so you know, it's not as complicated as it looks.

 

STEP 1:

 

1. I took a copy of the specials table and renamed that copy to "wholesales" and then populated that new table with wholesale prices.

 

2. I added a field to the "customers" table called "customers_wholesaler" TINYINT(1), which is basically a Yes/No flag. If a customer record has that field set to "1", then they are a wholesaler, otherwise they are not.

 

3. I added code to the admin panel to allow me to edit an account and click on a checkbox to make it into a wholesale account.

 

4. I added code to "includes/application_top.php" to perform a query on the "customers" table, to get the "customers_wholesaler" field value where "customers_id=$customer_id", and assign that 1 or 0 to $isWholesaler so I have a quick flag to use in the rest of the hack.

 

4. I modified the following files, which all have code that deals with pricing:

 

- advanced_search_result.php (my search results have a price column)

 

- default.php (displays a price column in category listings)

 

- includes/classes/shopping_cart.php (the most important part - determines the actual price once the product is added to the cart)

 

- product_info.php (the product details page - the price is displayed in the upper-right corner on this page, on my store)

 

... and I changed all of them to check for the wholesale pricing. The most complex change I had to make was the IF() statement in some queries that checked for specials pricing. For instance, here's an original, complex query from default.php that I've broken down into separate lines:

 

---------------------------------

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price ";

 

$listing_sql .= "from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id ";

 

$listing_sql .= "where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . $HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . $languages_id . "' and p2c.categories_id = '" . $current_category_id . "'";

---------------------------------

 

What a mess. It took me a bit, but here was my alternative query for wholesaler accounts:

 

---------------------------------

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, ";

 

$listing_sql .= "IF(w.status, w.wholesales_new_products_price, IF(s.status, s.specials_new_products_price, NULL)) as specials_new_products_price, IF(w.status, w.wholesales_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price)) as final_price ";

 

$listing_sql .= "from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join wholesale w on p.products_id = w.products_id ";

 

$listing_sql .= "where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . $HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . $languages_id . "' and p2c.categories_id = '" . $current_category_id . "'";

---------------------------------

 

Don't go and copy-and-paste this over the original query without understanding what you're doing - otherwise everyone might get wholesale prices! If you need help, let me know.

 

5. Something I haven't done yet, but I should do - I should make a copy of the "Specials" tool in the admin panel, and use it to create a new tool to manage the wholesales table.

 

- Jonathan

Download osCommerce Order Editor v1.2 Here:

http://www.oscommerce.com/community/contributions,1435

Link to comment
Share on other sites

Hey Jonathan may you be interrested to make some change to this mod to work with the customer_status :roll:

As you can see i have wrote a mod to manage some customer_status like

Allow or not Cash on delivery, Allow or not Credit....

But it was originally also made for managing reseller price, member price & discount price.

You can manage as many status as you want like reseller level1, level2, discount 5% or 10% depending of kind of customer.

With your mod, we can add in wholesaler table other price list or discount depending the customer_status instead of only one reseller flag as you use

It means for me to add in customers_status management a discount_price flag with value= 0 to 1 for each customers_status.

(if value : 0 = 100% discount, 0.9 = 10% discount, 1 = 0% discount means usual price)

Then price query look like

1/ check if exist a resell price

if discount_price=0 & exist price in wholesaler table price list for this product & customer_status=x ( exist_wholesaler_price = 0 else exist_wholesaler_price=1)

2/ final price is calculated

price = (usual price* discount_price*exist_wholesaler_price) + (exist_wholesaler_price* wholeseller_price for customer_status=x)

 

i hope i'm not too confused...

do you want to work for making this ????

Link to comment
Share on other sites

I updated customer_status to v0.5 to manage discount_price in customers_status table

 

Screenshot list of status with discount value

http://www.itgsm.com/dload-osc/customers_s...th_discount.jpg

 

Screenshot insert / edit discount_value

http://www.itgsm.com/dload-osc/customers_s...th_discount.jpg

 

 

the file is here

http://www.itgsm.com/dload-osc/customers_s...status_v0.5.zip

 

Now will be more hard to change all price

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...