Filter user on ads and research parameter

8 years 2 months ago - 8 years 2 months ago #277439 by fabioweb90
Filter user on ads and research parameter was created by fabioweb90
Hi everyone,
first of all, my setup: Joomla + CB + CBsubs + ADSmanager (all of them at the lastest version).

I realized a page that shows a list of ads with an advanced search that supports multiple conditions (e.g. size between max/min, category and subcategory of products, etc.).
This page works absolutely great, as you can see in stoneonthemarket.zagomattia.it/en/ads (DEV SSL cert, don't worry)

Well, now after applying the filter the system show a reduced list of ads, let's call this list "RESULT_ADS_LIST".
The point is: how can I show a list of users that "has an ads in the RESULT_ADS_LIST"?

Normally I would perform a query like:
forall conditions fields (c)
	forall users (u)
		if exists an ad (a) then must hold:
			exists a field (a.f) such that "a.f contains/isEqual/whatever to c"
In SQL in easy to perform the query given the search condition.

Now my questions:
1. Is possible to do it via CB advanced filter? The field requires a valid "sql where" condition where I can use the users' fields. Following this like I was thinking something about "where u.id IN (SELECT ads.username that match my query)". In this case how I can extract the search parameters/fields?

2. If is not possible to perform the query via CB advanced filter, do you have any suggestion? Should I go directly for a pure PHP solution?

Please Log in to join the conversation.

8 years 2 months ago #277446 by krileon
Replied by krileon on topic Filter user on ads and research parameter
The Advanced Filter directly adds your SQL to the userlist query. So for your usage you'd need to do a subquery that checks if the users id is within your criteria. I can't really help you beyond that as you're asking about a database table that doesn't belong to CB, but below is an example that maybe able to help.

( ( SELECT COUNT(*) FROM `#__cbsubs_subscriptions` AS sub WHERE sub.`user_id` = u.`id` AND sub.`status` = 'A' ) >= 1 )

The above for example will only show a userlist of users with an active subscription in CBSubs.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.195 seconds

Facebook Twitter LinkedIn