Re: [nmsinc] Problem with List Options in CMS

7 posts by 1 authors in: Forums > CMS Builder
Last Post: December 20, 2011   (RSS)

By Jason - December 9, 2011

Hi,

Try using this query for agent (example)

SELECT num, fullname
FROM `<?php echo $TABLE_PREFIX ?>accounts`
WHERE assigned_company = '<?php echo $ESCAPED_FILTER_VALUE;?>' AND user_type = 'agent'


Then under "Advanced Filter" select the name of the company field for this section.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Jason - December 9, 2011

Hi,

Could you post the exact query you used for the assigned_adjuster field.

Also note that the variable assigned_company needs to be the name of the field in the accounts table, not in the section your in.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Jason - December 12, 2011

Hi,

I think problem is that the query in the second post was using the field "assigned_company", instead of "company_type".

Try this:

SELECT num, fullname
FROM `<?php echo $TABLE_PREFIX ?>accounts`
WHERE company_type = '<?php echo $ESCAPED_FILTER_VALUE;?>' AND user_type = 'dispatcher'


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Jason - December 16, 2011

Hi,

I think the problem is that your if statement will never reach the "else" block. Since 'isAdmin' must be either true or false, only the first or second block will ever be executed.

What you need is to change the elseif portion of the code. For example, if you had a field called isIndependent and you wanted execute the second block if the current user isn't an admin, but was an independent, you could try this:

<?php if ($CURRENT_USER['isAdmin']):?>
SELECT num, fullname
FROM `<?php echo $TABLE_PREFIX ?>accounts`
WHERE "member_company" = '<?php echo $ESCAPED_FILTER_VALUE ?>num' AND user_type = 'Adjuster'

<?php elseif ($CURRENT_USER['isIndpendent']):?>
SELECT num, fullname
FROM `<?php echo $TABLE_PREFIX ?>accounts`
WHERE <?php echo $CURRENT_USER['member_company_accounts'] ?> = `<?php echo $ESCAPED_FILTER_VALUE ?>member_company_accounts` AND user_type = 'Adjuster'

<?php else: ?>
SELECT num, fullname
FROM `<?php echo $TABLE_PREFIX ?>accounts`
WHERE user_type = 'Adjuster'

<?php endif ?>


The "else" block would then be executed if the current user wasn't an admin or an independent.

Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Jason - December 19, 2011

Hi,

So for some reason, no records are being returned by our query. Are you sure all the values match up? For example, does user_type store the value "Adjuster" or "adjuster".

Let me know.
Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Jason - December 20, 2011

Hi,

When you're using one field to affect the values populated in another field, those values are retrieved dynamically through a jquery call. The problem here is that for some reason, the query in your second field is not returning any values.

If you could fill out a [url http://www.interactivetools.com/support]2nd Level Support Request[/url], I'll take a quick look and let you know if I see the problem.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/