Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Data Model Questions /

Relating a page to itself


Reply


2 Posts   1061 Views

Avatar
MarcusDalgren

Community Member, 288 Posts

29 June 2009 at 9:48am

Hello.

Today I tried relating a page to itself and it kind of works. I have a situation where I'm creating a product catalog and the products can be related to eachother.

I set this up by letting the ProductPage both have a $many_many and a $belongs_many_many to itself. I ran this through the build and so far so good.

For editing I set up a ManyManyComplexTableField (see the attached file).

Now to my issues.
The first issue is that I want to get rid of the add product-button. I don't want the user to be able to add a page through this, just manage relationships between existing pages.

The second issue is that the relationship is not two sided in the way I had hoped. If I check the checkbox for Product 1 to be related to Product 2 and 3 then I want Product 1 to be checked on Product 2 and 3. This is not working right now.

Is there any way for me to write a custom getter method or something to show the relationships in a two sided fashion and is there any way to get rid of the add button?

Kindly, Marcus.

Avatar
Willr

Forum Moderator, 5513 Posts

29 June 2009 at 5:49pm

Number 1 is straight forward but #2 is a bit weird. #1 Just remove add an option in the permissions. For example below the user can only export or print (not delete or add)

$myTableListField->setPermissions(array(
'export',
'print'
));