Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Being able to hide products...


Guest

Recommended Posts

Posted

I would like to be able to hide products (or show a product when a user logs in) based on customer login. I found somthing close in the contribs but it requires a B2B Suite which I think is overkill for what I need. Has anyone done something like? Any suggestions?

 

Thanks!

Posted
I would like to be able to hide products (or show a product when a user logs in) based on customer login.  I found somthing close in the contribs but it requires a B2B Suite which I think is overkill for what I need.  Has anyone done something like?  Any suggestions?

 

Thanks!

 

Does anyone know of another shopping cart system that will let me hide or show certain products for particular users?

Posted

Well I am about to do this, what I am going to do is add this contribution http://www.oscommerce.com/community/contri...customer+groups then I am going to hard code some checks into the product info page and product listing page. What the checks will consist of are

 

if product_id = 'this product' (the product of what products you want to hide) && '! does not = product group' (the customer group you want to show the products to) then it will not show the product, but if there in that group it will show the product.

 

I wont be "hiding" products, I will just be "hiding" the add to cart button for certain products that are only for sale for business's. So if you going to hide certain products in categories then you will have more manual work. But if you put all the products in one category you will only show to a paticlular customer group, it will be easier, cuz you will only need your check on the categories.php. Also for safety sake add another check before checkout, just incase they added it to the cart accidently or whatever. I don't know if this made any sense but I will be doing and if your intrested I can post up what I did.

 

-Dennis

Posted
Well I am about to do this, what I am going to do is add this contribution http://www.oscommerce.com/community/contri...customer+groups then I am going to hard code some checks into the product info page and product listing page.  What the checks will consist of are

 

if product_id = 'this product' (the product of what products you want to hide) && '! does not = product group' (the customer group you want to show the products to) then it will not show the product, but if there in that group it will show the product. 

 

I wont be "hiding" products, I will just be "hiding" the add to cart button for certain products that are only for sale for business's.  So if you going to hide certain products in categories then you will have more manual work.  But if you put all the products in one category you will only show to a paticlular customer group, it will be easier, cuz you will only need your check on the categories.php.  Also for safety sake add another check before checkout, just incase they added it to the cart accidently or whatever.  I don't know if this made any sense but I will be doing and if your intrested I can post up what I did.

 

-Dennis

 

Well, I would like to see. It isn't exactly what I want to do but, it could be a good start. In my situation I run another business where we email the invoices to customers for IT Consulting services. I want to be able to put those invoices on the web site for customer to be able to pay with credit card. But, I think in my case I need to hide the whole product because I don't want other customers to see the invoices of other customers. Make sense? I know this is more of a B2B type application but, B2B apps are too much for what I want. But, I might be able to incorporate what you are doing to acomplish what I want to do. Thanks!

Posted

Well I changed my plan of attact. I am just going to setup another field in the database to assign specific groups to each product. Then I am going to assign each customer to a specific group. Im sure you can add as many groups as needed. Then you will just run a check, if customer group = product group show the correct product, if not dont.

Posted
Well I changed my plan of attact.  I am just going to setup another field in the database to assign specific groups to each product.  Then I am going to assign each customer to a specific group.  Im sure you can add as many groups as needed.  Then you will just run a check, if customer group = product group show the correct product, if not dont.

 

Are you still going to hide to the add cart piece? Or are you not hiding anything anymore?

Posted

Well let me tell you what specifically I am doing. I am setting up a clients beauty product store, (Anti-aging stuff). Some products can only be purchased by Salons. So upon verification of the account being for a salon, the account will be moved to a group, Salons. All other clients will be in the group Consumers. I will assign the Salon only products a group of "salons" and all other products will be in a default group "consumers". When you go to view products the add to cart button will be displayed for all products expect the salon products. You will need to login and your account will then need to be in the group "Salons" for the add to cart button to appear. Then I will run another check upon checkout to make sure that the user is in the group "salons" one more time.

 

Does that make a little more sense? So I won't be hiding products, but hidng the add to cart button for specific products. Im sure you can take it up a notch and hide the whole product.

Posted
Well let me tell you what specifically I am doing.  I am setting up a clients beauty product store, (Anti-aging stuff).  Some products can only be purchased by Salons.  So upon verification of the account being for a salon, the account will be moved to a group, Salons.  All other clients will be in the group Consumers.    I will assign the Salon only products a group of "salons" and all other products will be in a default group "consumers".  When you go to view products the add to cart button will be displayed for all products expect the salon products.  You will need to login and your account will then need to be in the group "Salons" for the add to cart button to appear.  Then I will run another check upon checkout to make sure that the user is in the group "salons" one more time.

 

Does that make a little more sense?  So I won't be hiding products, but hidng the add to cart button for specific products.  Im sure you can take it up a notch and hide the whole product.

 

Yeah, that sounds pretty good. I might be able to modify to hide an entire product eventually. Thanks for the info!

Posted
Well let me tell you what specifically I am doing.  I am setting up a clients beauty product store, (Anti-aging stuff).  Some products can only be purchased by Salons.  So upon verification of the account being for a salon, the account will be moved to a group, Salons.  All other clients will be in the group Consumers.    I will assign the Salon only products a group of "salons" and all other products will be in a default group "consumers".  When you go to view products the add to cart button will be displayed for all products expect the salon products.  You will need to login and your account will then need to be in the group "Salons" for the add to cart button to appear.  Then I will run another check upon checkout to make sure that the user is in the group "salons" one more time.

 

Does that make a little more sense?  So I won't be hiding products, but hidng the add to cart button for specific products.  Im sure you can take it up a notch and hide the whole product.

 

Oh, do you mind sharing what changes you make ?

Posted

Yea I will, this is going to be one of the last things I will do, so I will start on this in a few days. I will let you know what I did when I get everything working correctly.

Posted
Yea I will, this is going to be one of the last things I will do, so I will start on this in a few days.  I will let you know what I did when I get everything working correctly.

 

Great! Thanks for sharing. I really do appreciate it.

Posted

Ok got everything working they way I need it to work.

 

I am sorry but I dont have time to write exactly what I did as this was a lot of custom work. I can tell you the steps I took but I don't have time to write a tutorial. Sorry :(

 

 

Here is what I did:

Salon = Product to hide, Retail = All other products (default status)

 

Built a new table in the database called customer_groups.

Added two fields, Group Salon = 1, Group Retail = 2.

 

Then I added a new field to the products table.

Field called "groups_id" with a default of 2, for retail.

*So all products default to 2 when added.

 

Then added a new field to the customers table.

Field called groups_id with a default of 2, for retail.

*So all customers are automatically signed up for retail status.

 

-----Thats all database work-------

 

Now I added in code to display the dropdown box for the customer_group table fields on the add/edit products page (categories.php), salon - retail. I then linked that to the products table to display the correct group for that product. So upon update it changed the field in the products table to the correct one you need. To hide it, simply change it to Salon.

 

I did the same thing to the customers.php file. You will have to manually go in there and change there status to salon. So all customers are defaulted to Retail, they see all products except the ones with the status of Salon. Change there status to Salon, they see all products.

 

------Thats all admin work--------

 

What I did was hide the add to cart button for the products that were Salon status. First I added in the field "groups_id" to the product_info query. Then added in a query to get the information from the user. Here is the code I used.

 

<?php
   $salon_query = tep_db_query("select customers_id, customers_group from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
   $salon = tep_db_fetch_array($salon_query);

   if ($product_info['groups_id'] == '1') {
 if ($salon['customers_group'] == '1') {
?>

<--If product status = 1 (Salon) Add to cart button display for logged in customers with a salon status (1)  -->

<?php
 } else {

?>

<--If product status = 1 (Salon), Text that reads "Salon Purchase Only" for customers with status of 2 (Retail) and guests.-->

<?php
 }
} else {
?>

<--Product is not Salon status so display add to cart button to all users.-->

<?php
}
?>

 

That will be added to all pages that had the add to cart button, or buy now button. If you want to hide the whole product, just move that code into the array of your products being displayed.

 

Sorry I can't explain any better as this is a custom job and will require some knowledge of php and databasing. I just don't have the time as I am very busy with my clients.

 

-Dennis

Posted
Ok got everything working they way I need it to work.

 

I am sorry but I dont have time to write exactly what I did as this was a lot of custom work.  I can tell you the steps I took but I don't have time to write a tutorial.  Sorry :(

Here is what I did: 

Salon = Product to hide,  Retail = All other products (default status)

 

Built a new table in the database called customer_groups.

Added two fields,  Group Salon = 1, Group Retail = 2.

 

Then I added a new field to the products table.

Field called "groups_id" with a default of 2, for retail.

*So all products default to 2 when added.

 

Then added a new field to the customers table.

Field called groups_id with a default of 2, for retail.

*So all customers are automatically signed up for retail status.

 

-----Thats all database work-------

 

Now I added in code to display the dropdown box for the customer_group table fields on the add/edit products page (categories.php), salon - retail.  I then linked that to the products table to display the correct group for that product.  So upon update it changed the field in the products table to the correct one you need.  To hide it, simply change it to Salon.

 

I did the same thing to the customers.php file.  You will have to manually go in there and change there status to salon.  So all customers are defaulted to Retail, they see all products except the ones with the status of Salon.  Change there status to Salon, they see all products.

 

------Thats all admin work--------

 

What I did was hide the add to cart button for the products that were Salon status.  First I added in the field "groups_id" to the product_info query.  Then added in a query to get the information from the user.  Here is the code I used.

 

<?php
? ?$salon_query = tep_db_query("select customers_id, customers_group from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
? ?$salon = tep_db_fetch_array($salon_query);

? ?if ($product_info['groups_id'] == '1') {
?if ($salon['customers_group'] == '1') {
?>

<--If product status = 1 (Salon) Add to cart button display for logged in customers with a salon status (1) ?-->

<?php
?} else {

?>

<--If product status = 1 (Salon), Text that reads "Salon Purchase Only" for customers with status of 2 (Retail) and guests.-->

<?php
?}
} else {
?>

<--Product is not Salon status so display add to cart button to all users.-->

<?php
}
?>

 

That will be added to all pages that had the add to cart button, or buy now button.  If you want to hide the whole product, just move that code into the array of your products being displayed.

 

Sorry I can't explain any better as this is a custom job and will require some knowledge of php and databasing.  I just don't have the time as I am very busy with my clients.

 

-Dennis

 

Thanks for the info!!!! I will go over it and see what I can do!

Posted

I needed to do this myself recently. In my situation, I have a group of products that in which each product is meant for a particular customer. What I did was add the customers ID to the products table. Then in products_info.php, I compare that value with that of the logged in customer. If they match, I show the product.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Posted
I needed to do this myself recently. In my situation, I have a group of products that in which each product is meant for a particular customer. What I did was add the customers ID to the products table.  Then in products_info.php, I compare that value with that of the logged in customer.  If they match, I show the product.

 

Jack

 

 

Yea i needed a "group" of people. I also changed the create account information page to have a check mark for if they were a salon, with there company name and license number. Then if that checkmark was checked, the store owner gets sent an email to verify there license status. Then there account is put into a que for verification, with retail status rights. I also changed the statistics box on the main admin page to show salon customers pending, total salon customers, total retail customers, and tot customers in general. So when they get the email or login to admin, they can see if any accounts are pending. Then I added a new column in the customers.php page to show what status there were in. Retail, Salon, or Pending Verification, with pending verification shown in red so it will be easy for them to find. Then all they have to do is edit there account and change there status to Salon and everything gets updated :).

  • 2 weeks later...

Archived

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

×
×
  • Create New...