Krishna Verma
Krishna Verma

Reputation: 814

Broadleaf commerce display some product to logged in users only

I am developing an e-commerce application using broad-leaf commerce. My requirement is I have to add an product from login panel and display that product to only logged in users. Here few product products will be visible to all users (guest too) and few will be visible to only logged in users. is there any way to do this?

Upvotes: 1

Views: 210

Answers (2)

Krishna Verma
Krishna Verma

Reputation: 814

Thanx soulfly1983 fou your try,but I found another alternative to do this without any customization. here is the full procedure..

  1. Add a new category from admin panel.

  2. Add a new page from admin panel (under content tab) and note the URL should be the same of category and page.

3 In the page click on rule tab.

4 Check the yes button in "Restrict to certain customers?"

  1. Click +rule button and the select "match all" and select customer registered is equal to false

  2. So this page will be visible to only guest users.

  3. In the HTML body section of the rule (in general tab) write a message "you need to log in to view this stuff"

  4. When user will log in successfully the user will not be able to the page , because we applied a rule that only logged out users can see the page so this time user will see the category and products added to that category.

am I doing right? any regarding this suggestion?

Upvotes: 2

soulfly1983
soulfly1983

Reputation: 177

You can either extend the Product entity and add a field that will indicate whether that product will be visible to all users, or alternatively you could simply add an attribute for each product via the admin interface. Either way you will need to modify the UI logic so that it will take this additional field (or attribute) into consideration.

Upvotes: 1

Related Questions