Oxid ListType and extending oxuser

HI everyone,
I have a query regarding how oxid list type works?
I want to divide userlist in 2 different list for that I have added an extra boolean field in the oxuser Table. with that i decide if user is normal shop user or a bussiness client? now issue is that i have created a controller at back end but I don’t know that how i can set my querry to check for blUser=1 inorder to get work with getItemList!

Hi,

as I understand you have already set up an backend (admin) list controller that should display only users in top list that have blUser=1?

If yes you can just extend _prepareWhereQuery function like:

protected function _prepareWhereQuery($aWhere, $sqlFull)
{
	$sQ = parent::_prepareWhereQuery($aWhere, $sqlFull);

	$sTable = getViewName('oxuser');
	$sQ .= " and {$sTable}.blUser = '1' ";

	return $sQ;
}

Kind Regards,
Benny

Thank you @Benny . Yes I have already created controller and blUser field in my user table. Now Issue is that I want to extend user class model for business user and assign some functionality to those user eg. like they can add their product and after verification it gets uploaded to article table. but I am using the only oxuser table for that. It will be great if you can suggest me something to differentiate thos user from normal user likewise a constructor which donot modify the blUser value in table.

And Thanks again for your suggestion to override _prepareWhereQuery.

That extension is only for the admin list view.

On frontend youcan easily access the new field on the user object: $user->oxuser__bluser->value

Is that what you need?

@Benny
For the adminlist view thats perfect i think. But I mean like I want to differentiate both type of user so that i can define some methods in model to work with only those user whose blUser val is ‘1’. So my logic is that I assign a method which checks the blUser and returns true. But how to define the constructor that can override the parent constructor without changing the blUser value in table.

Why changing the constructor? You can simply check in your function which type of user it is?

I want it because if I want to define some operation on business user i dont want to check with if condition like if blUser=1

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.