Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Multiple JOOMLA USER types and GRID 19 Dec 2016 16:31 #14857

  • jamaza
  • jamaza's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 8
  • Thank you received: 0
I have a table called JOBS, and a XRef table called xExpertstoJobs, this XRef has two Joomla User type fields

On a JOBS collection view, I want to pull in the names from BOTH of these fields, however they are not rendering with the correct name and I can only pull in one

In the table view the fields are called expert_id and referrer_id

In the FIELD view at the side to drag them in they are called

user
user

Please Log in or Create an account to join the conversation.

Multiple JOOMLA USER types and GRID 20 Dec 2016 14:48 #14858

  • liubov
  • liubov's Avatar
  • Offline
  • Elite Member
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 279
  • Thank you received: 36
Hi Jamaza,

I am not sur your Table design is correct in order to use Xref but if i anderstand what you want to do, you should have 3 Tables involved.
- JOBS: (id, title, ...)
- EXPERTS: (id, title, FK [ JUser, ... ]
- xExpertstoJobs (job_id, expert_id, ...)

So with this N:m Pivot Table :
- A Job can needs One or Many Experts Features,
- An Expert can cover One or Many Jobs.

Then, in the Jobs View Layout, you could drag :
- job_title
- - Xref [ExpertstoJobs (on Job)]
- - - Expert_title
- - - FK [Juser]
- - - - Name
- - - - UserName
- - - - etc, etc,

And, in the Experts View Layout, you could drag :
- expert_title,
- FK [Juser]
- - Name
- - UserName
- Xref [ExpertstoJobs (on expert)]
- - FK [job]
- - - job_title

Hoping that can help you ...
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

Last edit: by liubov.

Multiple JOOMLA USER types and GRID 16 Jan 2017 23:02 #14948

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
I had a look on your database design

Context I understood :
The 2 FK references to users are located in the EXPERTSTOJOBS table. N:1 relation
You want to list the users from the Jobs table.

Since ORM, this is incredibely simple to achieve.
This should work to grab the datas.
$this->orm(array(
	'relation' => array(

		'xexpertstojobs' => array(
			'select' => array(

				'expert_id.username',
				'expert_id.name',
				
				'referrer_id.username',
				'referrer_id.name',
			)
		)
	)
));
Then dump the loaded datas, and you will see the list of users behind the N:1 relation.

Need more explanation ?

EDIT : You need to download again because I fixed something on the ORM engine that was required for this operation.
Coding is now a piece of cake
The following user(s) said Thank You: MorganL

Please Log in or Create an account to join the conversation.

Last edit: by admin.
  • Page:
  • 1
Time to create page: 0.084 seconds

Real time saver and great Component Builder tool ! I have been developing with J-Cook Pro Component Builder for several months now and can say with all honesty that this product/service is second to none. The product is feature rich and is being improved and added to all the time. Do yourself a favor if you need to build a Joomla! Component then you can do no wrong in trying the product. You will save on time and effort while being able to deliver your project on time. J-Cook pro does the hard work for you you then have the freedom to fully customise the end result for your own needs. 

One word: Awesome.
Edwardcox (JED)
         

Get Started