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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

ManyManyComplexTableField Without Edit/Delete/Add Options


Go to End


4 Posts   2993 Views

Avatar
Ryoken

Community Member, 18 Posts

16 October 2009 at 8:54am

Edited: 11/01/2013 11:15am

I'm working with the e-commerce module, and one of the tasks I am trying to complete is allowing a Bundle of individual products to be sold as one unit.
Where I'm getting stuck at is selecting the individual products to be in the bundle. My idea was to simply use a ManyManyComplexTableField to allow the selection of the products, and this for the most part works fine. The problem is I really don't want a user to be able to Edit the individual product from the bundle, or worse yet, delete the product rather than un-checking the box.

Is there some way I can remove the View, Edit, Delete, and add buttons and functions from the field, while still allowing the user to check the box to select the ones they want ? I would be most thankful for any assistance.

Avatar
kleampa

Community Member, 4 Posts

17 December 2009 at 12:29am

Edited: 11/01/2013 11:15am

you can try:

$actionTablefield->setReadOnly('true');

Avatar
Spambanjo

Community Member, 24 Posts

11 January 2013 at 4:46am

Edited: 11/01/2013 11:15am

$actionTablefield->setReadOnly('true'); did not work for me in Silverstripe 2.4.7.

While it got rid of the "add / edit / delete" buttons, the relationships were not saved after submission.

Avatar
swaiba

Forum Moderator, 1899 Posts

11 January 2013 at 11:21am

You could remove the default created one - or modify the existed created one (I don't know the ecommerce code well - maybe if you post existing code it would help).

something like this...

$ctf = new ManyManyComplexTableField ($this,'MyObject','Floor',null,null,<some where clause>);
$ctf->setPermissions(array('edit','show'));
$fields->addFieldToTab("Root.MyObject", $ctf);