LemonStand Forum: Conditional Menu inclusion based on Customer Group - LemonStand Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Conditional Menu inclusion based on Customer Group

#1 User is offline   redidesi 

  • LemonRegular
  • PipPipPip
  • Group: Members
  • Posts: 32
  • Joined: 01-March 10

Posted 07 March 2010 - 08:23 PM

Hi,

Just wondering if it is possible to somehow exclude a page from the menu based on the condition of a)Being logged in and b) being a part of the 'wholesale' customer group?

It would be very cool if that option was available when editing the page under the security tab. So if you select the 'customers only' radio button you get an option to select from a multi list the customer groups it applies to. Perhaps that is a feature request!?

In the mean time, would there be a way to maybe write a partial using the api?

thanks.

p.s. just an afterthought, it would also be great to be able to have this same level of access selection at a product page level. This would mean that you could make products visible/invisible to certain customer groups. And further as a part of future development it would be good at the product page level to have the option of whether or not a product is available to enabled countries. thanks

This post has been edited by redidesi: 07 March 2010 - 09:38 PM

0

#2 User is offline   Aleksey 

  • Co-Founder
  • Group: +Administrators
  • Posts: 4,066
  • Joined: 31-October 09

Posted 07 March 2010 - 10:38 PM

Hi, redidesi!

Thank you for the ideas. I found them very strong and right. The navigation menu generating and page security settings should be definitely combined and we will make it soon. Regarding the checking a page visibility against a customer group - we will consider this feature as well.

Quote

In the mean time, would there be a way to maybe write a partial using the api?


We will implement the requested features before the release, so you don't need to develop any custom methods for displaying your navigation menus.

Quote

p.s. just an afterthought, it would also be great to be able to have this same level of access selection at a product page level. This would mean that you could make products visible/invisible to certain customer groups. And further as a part of future development it would be good at the product page level to have the option of whether or not a product is available to enabled countries.


I added these ideas to the wish-list. Thank you!

#3 User is offline   redidesi 

  • LemonRegular
  • PipPipPip
  • Group: Members
  • Posts: 32
  • Joined: 01-March 10

Posted 07 March 2010 - 10:50 PM

Thanks Aleksey for getting back to me so quick, and also for appreciating my ideas!

We are in the middle of developing a (soon to be live) site with LemonStand (which is a great app! thanks!), so without sounding pushy when will the release be with that functionality? It may not come soon enough for me I fear.

I'm looking at trying to get the group_calculated value to use in a conditional statement to show a parent menu and then also in the template to allow page render or redirect.

Thanks again.
0

#4 User is offline   Aleksey 

  • Co-Founder
  • Group: +Administrators
  • Posts: 4,066
  • Joined: 31-October 09

Posted 07 March 2010 - 11:54 PM

Hi, redidesi!

Quote

When will the release be with that functionality?


I cannot answer to this question, unfortunately. We have an important and complicated task waiting in our plan and we will begin working on the navigation task only when we finish more important things. So yes, let's I help you with a custom partial.

The $customer (http://lemonstandapp..._shop_customer/) field of the Controller object ($this->customer) has the $group field, which represents a customer group. If a customer is logged in, the $this->customer field is not null and you can read the customer group API code (it is better to rely on API codes than on group names, and you need to assign API codes to your customer groups). So you can write something like this:

if ($this->customer && $this->customer->group->code == 'wholesale')
{
   // A customer is logged in and it belongs to the Wholesale group
}


You can use similar code in the navigation partial in order to check pages which you want to hide or show, and on the pages in order to redirect a visitor away from a page he should not see. For example, you can use the following code in the Pre Action Code field of the Edit Page form, in order to check whether a customer is logged in and it belongs to the wholesale group. Otherwise it will be redirected to the home page:

if (!$this->customer || $this->customer->group->code != 'wholesale')
{
   Phpr::$response->redirect('/'); // redirect to the home page
}



The redirect method of the Phpr_Response (it is not documented yet) class stops the script execution, so you do not need to call the die() function after redirecting.

Let me know in case of other questions!

#5 User is offline   redidesi 

  • LemonRegular
  • PipPipPip
  • Group: Members
  • Posts: 32
  • Joined: 01-March 10

Posted 08 March 2010 - 12:02 AM

Hi Aleksey,

Thanks so much again for getting back to me - I'll put that to the test and let you know how it goes.

thanks again, much appreciated.
0

#6 User is offline   Aleksey 

  • Co-Founder
  • Group: +Administrators
  • Posts: 4,066
  • Joined: 31-October 09

Posted 28 March 2010 - 11:22 PM

Hi, redidesi!

Now LemonStand takes into account page security settings. If you set "Customers only" security mode for some page, the automatic navigation menu API functions will not display this page for guest customers.

The customer group check feature is not implemented yet.

Aleksey

#7 User is offline   redidesi 

  • LemonRegular
  • PipPipPip
  • Group: Members
  • Posts: 32
  • Joined: 01-March 10

Posted 27 May 2010 - 09:22 PM

Hi Aleksey,

Just wondering if there is a way to not display a PRODUCT based on it being only available to wholesale clients?
I thought there might have been a way in the pricing area where I have been adding a tier for wholesale user prices but not!

thanks in advance.

Paul
0

#8 User is offline   Aleksey 

  • Co-Founder
  • Group: +Administrators
  • Posts: 4,066
  • Joined: 31-October 09

Posted 27 May 2010 - 09:43 PM

Hi, Paul!

This feature is in our to-do list. It is not very far from its top :-)

Thank you

Aleksey

#9 User is offline   redidesi 

  • LemonRegular
  • PipPipPip
  • Group: Members
  • Posts: 32
  • Joined: 01-March 10

Posted 01 June 2010 - 06:46 PM

Thanks, that's great news.
I am kind of needing to do it urgently!
Would there be a work around you can think of?

cheers,

Paul
0

#10 User is offline   Aleksey 

  • Co-Founder
  • Group: +Administrators
  • Posts: 4,066
  • Joined: 31-October 09

Posted 01 June 2010 - 06:50 PM

Paul, we will implement it in a few days. Within a week for sure. :-)

Aleksey

#11 User is offline   Aleksey 

  • Co-Founder
  • Group: +Administrators
  • Posts: 4,066
  • Joined: 31-October 09

Posted 02 June 2010 - 02:18 AM

Hi, Paul!

Surprise! The product visibility filter feature is implemented and published. Please look at the screenshot.

If you use the custom product group feature on your website, you need to update the shop:custom_group partial (or whatever partial you use for displaying a custom product group contents). The old code is

$group->products_list;


The new code should be:

$group->list_products()


Thank you

Aleksey

#12 User is offline   redidesi 

  • LemonRegular
  • PipPipPip
  • Group: Members
  • Posts: 32
  • Joined: 01-March 10

Posted 02 June 2010 - 02:20 AM

IT'S OFFICIAL - YOU ARE AWESOME!!!!

I'll give it a try and let you know how it goes. Thanks so much.

Paul.
0

#13 User is offline   Aleksey 

  • Co-Founder
  • Group: +Administrators
  • Posts: 4,066
  • Joined: 31-October 09

Posted 02 June 2010 - 10:29 PM

Hi, Paul!

Thank you! I just published another feature you asked about. On the Create/Edit Page form in the Administration Area you now can go to the Visibility tab and specify customer groups the page should be visible for. It works in the same way as the product filtering feature.

Aleksey

Share this topic:


Page 1 of 1

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users