-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GridField editing relations to products #2
Comments
Hi Sam, thanks for reporting this. Not entirely sure what the issue might be, which version of Silverstripe are you using exactly? Also, do you have a code snippet? |
Hi @samthejarvis, I've tested SwipeStripe with 3.1.2 and categories appear to be working for me on Product pages. Have not tried in GridField but this issue may be more closely related to GridField, at this point I'm not sure what the issue might be - could be a good idea to ask on IRC or the forums. Will close for now. |
Getting this same error when trying to manage a Product to Product relationship with GridField. Removing the searchable_fields from ProductCategory_Extension fixed it. |
Yeah we have had this problem as well, I've also had to remove the searchable fields. @frankmullenger can you reopen this one? |
Guess this needs a little more investigation 😄 |
+1 I'm getting this too It appears to be an issue with the It works if I change it to: public static $searchable_fields = array(
- 'Category' => array(
+ 'ProductCategories.Title' => array(
'field' => 'TextField',
'filter' => 'ProductCategory_SearchFilter',
'title' => 'Category'
)
); Edit: You can replicate this by setting up a |
A very nasty workaround in the mean-time is: mysite/_config.php $searchableFields = Config::inst()->get('Product', 'searchable_fields');
$searchableFields['ProductCategories.Title'] = $searchableFields['Category'];
unset($searchableFields['Category']);
Config::inst()->remove('Product', 'searchable_fields');
Config::inst()->update('Product', 'searchable_fields', $searchableFields);
unset($searchableFields); |
This "fix" actually causes another problem with the So if you want to use the This is something to do with the When I do this in my config, it all works as expected: $searchableFields = Config::inst()->get('Product', 'searchable_fields');
//$searchableFields['ProductCategories.Title'] = $searchableFields['Category'];
unset($searchableFields['Category']);
Config::inst()->remove('Product', 'searchable_fields');
Config::inst()->update('Product', 'searchable_fields', $searchableFields);
unset($searchableFields); |
We should also get #1 merged into the 2.1 branch, as well as change the public declarations within the DataExtension to private. |
"You can replicate this by setting up a many_many with a Product and some other DataObject and the automatic CMSFields that are generated cause the error" - I still couldn't replicate for some reason, does anyone have some boilerplate code for replicating this issue? |
class Material extends DataObject {
private static
$db = array(
'Title' => 'Varchar(255)',
),
$many_many = array(
'Products' => 'Product',
);
}
class ProductExtension extends DataExtension {
private static $belongs_many_many = array(
'Materials' => 'Material',
);
} This is the basic idea. If you go to the CMS to create a Material and then try to use the auto complete field on the grid for managing the Material -> Product relation it will error. |
I am getting same error here, sample code from @dhensby , SS 3.1.5. Is it able to fix? |
Latest SS3.1, apparent in fresh installs w/ latest categories module
Using a GridField to manage a relation between a Page and Product, getting:
Fatal error: Call to a member function stat() on a non-object in C:\wamp\www\framework\model\DataObject.php on line 3226
Removing the searchable_fields from ProductCategory_Extension fixed this as calling ->relObject('Category') on a Product returns null, can't figure out why.
Changing 'Category' in searchable_fields to 'ProductCategories' (the actual name of the belongs_many_many relation) throws the same error.
Any ideas?
The text was updated successfully, but these errors were encountered: