Welcome, Guest
Username: Password: Remember me

TOPIC: Show only selected records in FrontEnd Collection

Show only selected records in FrontEnd Collection 26 Jan 2012 01:50 #1089

  • iconvisual
  • iconvisual's Avatar
  • Offline
  • Senior Member
  • Keen Joomla! 1.7 Developer
  • Posts: 53
  • Thank you received: 5
  • Karma: 1
Is there a way to have a Front End Collection Layout that only displays selected records from the SQL Select..
i.e. Showing a list of Properties (houses) I only want to show the ones that belong to the currently logged in User (jos_user.id) = landlord_id ??

Am I asking the wrong question?

Thank you,

Edward
Keen Joomla! and PHP/MySQL developer. Excited about J-Cook.
Last Edit: 23 Feb 2012 04:34 by iconvisual. Reason: Need Further Information Please
The administrator has disabled public write access.

Re: Show only selected records in FrontEnd Collection 26 Jan 2012 11:06 #1094

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Let's write inside.

TODO :
view.html.php :
$model->addWhere("a.landlord_id = " . (int)$user->id);
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: iconvisual

Re: Show only selected records in FrontEnd Collection 26 Jan 2012 11:41 #1096

  • iconvisual
  • iconvisual's Avatar
  • Offline
  • Senior Member
  • Keen Joomla! 1.7 Developer
  • Posts: 53
  • Thank you received: 5
  • Karma: 1
Thank you Jocelyn. I appreciate your level of commitment and support.

Kind Regards,

Edward.
Keen Joomla! and PHP/MySQL developer. Excited about J-Cook.
The administrator has disabled public write access.

Re: Show only selected records in FrontEnd Collection 23 Feb 2012 01:25 #1437

  • iconvisual
  • iconvisual's Avatar
  • Offline
  • Senior Member
  • Keen Joomla! 1.7 Developer
  • Posts: 53
  • Thank you received: 5
  • Karma: 1
Hi Jocelyn,

Ok, finally got around to properly looking into this.. and I'm in view.html.php for com_easypropmgr, in views for properties, and I tried to insert:
$model->addWhere("a.landlord_id = " . (int)$user->id);

in function display_propertieslist($tpl = null) to no avail. Output still listed all properties.

I've looked, banged my head, sharpened my scissors, and am lost. Are you able to point out a little more specifically where I should add the WHERE clause?

Thank you kindly,

Edward.
Keen Joomla! and PHP/MySQL developer. Excited about J-Cook.
The administrator has disabled public write access.

Re: Show only selected records in FrontEnd Collection 23 Feb 2012 05:55 #1438

  • etc
  • etc's Avatar
  • Offline
  • Premium Member
  • Posts: 132
  • Thank you received: 19
  • Karma: 7
at my site works this:

in model folder
. $this->addWhere('`my_user` = ' . (int)$user->id)

and do not forget to check this:
$user =& JFactory::getUser();
The administrator has disabled public write access.
The following user(s) said Thank You: admin, iconvisual, BTB300, edwardcox
Time to create page: 0.066 seconds

Get Started