Hi UncleCheese,
First of all I'd like to thank you for your effort to develop this module.
I used your module and I think is fantastic.
Now I have a little problem and I need a little help.
I have created a Product object:
class Product extends DataObject
{
static $db = array (
"Name" => "Text",
"Description" => "HTMLText",
);
static $has_one = array (
"Thumbnail" => "Image",
);
static $belongs_many_many = array (
'ProductHolderPage' => 'ProductHolderPage'
);
public function getCMSFields_forPopup()
{
$fields = new FieldSet();
$fields->push( new TextField('Name', 'Product name'));
$fields->push( new ImageField(
"Thumbnail",
"Upload product image",
null,
null,
null,
"assets/Products/"
));
$fields->push( new SimpleHTMLEditorField('Description','Product description', array ()));
return $fields;
}
}
and a ProductHolderPage
class ProductHolderPage extends Page
{
static $db = array (
);
static $has_one = array (
);
static $has_many = array (
);
static $many_many = array (
'Products' => 'Product'
);
static $icon = "themes/mpc/images/treeicons/productholder";
static $can_be_root = false;
static $allowed_children = "none";
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeFieldFromTab("Root.Content.Main","Content");
# Products TAB
$manager = new ManyManyDataObjectManager(
$this,
'Products',
'Product',
array('Name' => 'Product name'),
'getCMSFields_forPopup'
);
$manager->setAddTitle('Product');
$fields->addFieldToTab("Root.Content.Products", $manager);
return $fields;
}
}
Now I need to sort the Products in each ProductHolderPage not to sort the Products list.
If I add the SortableDataObject::add_sortable_class('Product'); in the mysite/_config.php I can generally sort the Product's list but this is not useful in my case.
I need to add sortOrder to the ProductHolderPage_Products table and to manage somehow in CMS.
Is this possible?