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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Displaying/Editing Many-to-Many Extra Fields


Go to End
Reply


14 Posts   7328 Views

Avatar
Tonyair

Community Member, 81 Posts

29 September 2010 at 5:01am

Edited: 29/09/2010 5:04am

Hello, guys.

When I'm executing that function i'm getting +2 in the Count field
for example i'm getting Product->items[0]->Count = 1
echo $count returns 2, but after $Product->add($add,array('Count' => $count)); I'm getting 3 in Basket_Products table, but

$Product->add($add,array('Count' => '2')); works well

What's wrong?

$Product = $basket->Products('ProductID = '.$add);
if(count($Product) > 0){
   $count = $Product->items[0]->Count;
   $count++;
   echo $count;
   $Product->add($add,array('Count' => $count));
} else {
   $Products = $basket->Products();
   $Products->add($add,array('Count' => '1'));
}

Avatar
johnofjack

Community Member, 22 Posts

17 December 2011 at 3:24am

Edited: 17/12/2011 3:24am

The CRUD interface would be really useful. If I knew how to write one myself, I would. :-/

Avatar
swaiba

Forum Moderator, 1805 Posts

17 December 2011 at 3:56am

Being as this thread dates back to 2009 and SS3 is coming out with DataLists and DataGrids to replace alot of the standard tech it might be more appropriate to raise this ASAP on teh dev list rather than in the forums.

Avatar
BenWu

Community Member, 91 Posts

20 October 2012 at 9:48pm

for SS2.4, you can use the itemsetfield module http://www.silverstripe.org/ItemSetField/

for SS3.0, I am looking for the same thing.

Avatar
swaiba

Forum Moderator, 1805 Posts

21 June 2013 at 2:55am

Edited: 21/06/2013 3:05am

SS3...

https://github.com/smindel/silverstripe-gridfieldeditablemanymanyextracolumns

or...

"Editing data contained in many_many_extraFields is supported - just treat it as you would any other field."

https://github.com/ajshort/silverstripe-gridfieldextensions/blob/master/docs/en/index.md

Avatar
El Mich

Community Member, 8 Posts

21 June 2013 at 9:54pm

Great stuff Swaiba, I had been lusting for this since a long time! Thanks

Go to Top