-
Notifications
You must be signed in to change notification settings - Fork 20
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
Hierarchical Product Features #4
Comments
That would be hard to do. I don't think I'm able to do that. Anyone interested in that can fork this project. Sorry. |
OK. Could you provide some documentation or a short summary of your code? I can try extending it. Thanks. |
The short summary is that the code overrides the default Feature controllers so that it allows multiple rows in the association DB table between products and features instead of just one, and also adds a new column in the features values table so it can handle ordering. |
I would really appreciate if you could guide me meanwhile I extend it. On Mon, May 11, 2015 at 11:21 PM Jérôme Danthinne [email protected]
|
What do you mean by "showing the relationship"? Visually? |
When defining product features we need to tell the parent value for child On Tue, May 12, 2015 at 4:19 PM Jérôme Danthinne [email protected]
|
What you're talking about looks more like categories than features to me… don't you think? |
No I just gave an example. Actually the product can be compatible with Sent from my Phone.
|
I have couple questions for you.
|
If I add new field parent_id_feature_value in feature_value table and want to reflect changes in back and front office what files do you think will change? |
|
Thanks. Actually I'm new to Prestashop development and Prestashop docs are pretty basic while what I need is kind of advanced thing. I can do the architectural thing but if you could help me in developing this functionality I'll be very grateful to you. I think its a small change and just have to add one field in database table and some logic in module. Please let me know we can both together can do this. Thanks in advance. |
Actually I'm new to Prestashop as well, and this module is the first one I've built. And I've done it for a client, so I've been paid for the time spent on this particular function. I'm sorry but I don't have the free time do that for you. If what you were asking was easy, I could, but believe me, it is not (for new PS developers). I think you should ask for help in the Prestashop forums, I've found many advices there. |
Sorry to bother you again. There is an issue with your module. I'm not sure if its your module or is it Prestashop. When I install your module and then uninstall and delete it, it leaves FeatureValue.php file behind under override/classes folder with following content that is causing syntax errors. All other overridden files are successfully deleted except this one. Do you have any idea why this file is not being deleted? 'feature_value', 'primary' => 'id_feature_value', 'multilang' => true, 'fields' => array( 'id_feature' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'position' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'custom' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'value' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 255), ), ); ``` } |
Unfortunately, I don't think the issue is related to the module, but to Prestashop itself, and its uninstall function. No module installs itself, PS manages that, but it seems that sometimes, the process fails… (i.e. http://forge.prestashop.com/browse/PSCSX-4910) |
OK thanks. I have another question. |
This function is called when a page need to display all the feature values, given a feature id and a language. I had to override this function so I can order alphabetical instead of by ID. |
Do you have any idea how to override Feature Add/Edit form so I can display my custom field as well. I am able to do the same thing for Feature Value but cannot find place to do for Feature. |
You have to override the renderForm() function in /controllers/admin/AdminFeaturesController.php, I think. |
Ya I did that but its not working. Any clues? |
What is not working exactly? Where can I see the code/fork? |
Attached is the code. Muhammad Jawaid Shamshad On Wed, May 27, 2015 at 5:21 PM, Jérôme Danthinne [email protected]
|
I think attachment didn't went through. Let me know your email I'll send it to you. |
I prefer not to handle that by emails. |
OK I fixed it. Actually had to call AdminController::renderForm() instead of parent::renderForm() in my override. But now there is new problem. My custom field for Feature is not saving in the database. Custom field for FeatureValue is working fine and saving in the database but not for Feature. What should I do so it also saves in the database. |
As I told you, I can hardly help you if you don't give me the link to your repository. |
OK, it saves parent feature value when adding a new feature. But if I edit a feature it doesn't update. |
Does it output an error message (with debug mode enabled) ? |
No it doesn't show any error. Yes that's what I'm trying to achieve. Current problem is that parent feature is saving when adding new feature. Do you get my point? If this is fixed then we are almost done with some
|
Does Prestashop say "Feature updated" or nothing? No fields are updated or only your new field? |
Yes it says feature updated and it does update the data but not my custom
|
Any clue? |
I've just had a look, and no, I don't understand directly why this isn't working. Perhaps you should have a look into the Category class/controllers, because it's already handling parent-children relationship in this one. |
Yep, have a look at https://github.com/PrestaShop/PrestaShop/blob/1.6/controllers/admin/AdminCategoriesController.php#L477, they're using a tree index (but not documented). |
My hierarchy problem is solved by adding a parent field for each feature and feature value since one feature/value can have only one parent. Current problem is when editing a feature it does not update the parent field that I have added while it does update other fields. Also, if I add a new feature it saves all the fields including the parent successfully. I'm not sure why it doesn't update when editing it. |
The tree they are using is I think for displaying it as tree structure. |
Can you modify the module to provide parent-child relationship between 2 or more features. Selecting any value in parent feature should filter out the values in child feature. Similarly, if there is any grand child under child feature selecting value of child should filter values in grand child. This will also require the define the parent-child relationship when adding product features in admin.
The text was updated successfully, but these errors were encountered: