ric355 Posted March 29, 2023 Share Posted March 29, 2023 (edited) I need to make what initially felt like a small tweak to the back office in order to extend the Attribute table with an additional field, and add a bit of processing, but having spent a couple of days digging around I'm a bit confused about how to do it and would like some help. Here is the problem I am looking to solve: I have a few products all of which use the same set of attributes. These attributes are used to generate combinations, and with the standard 1.7.x prestashop the price impact of the combinations are added at the product level. So for a simple example, lets say I have 2 products A and B. Both products have combinations of A + X + Y and B + X + Y (where X and Y are attributes with a selection of typically 3 or more items). So the base products A and B are different, but they share the same optional choices. Some of my products will have many more combinations than this. In this scenario the price impact has to be applied to both products, and in some situations the combinations quickly become unmanageable; especially if the price of an optional feature needs to be changed. Rather than do this, I would like to add a price impact field to each attribute value row. And then change the pricing calculations so that any price improvements are added from this data if it exists. This should mean I can change the price of an option once and have it affect all combinations that use it. I will allow the product combinations to override if specified or take precedence if the price on the attribute is zero. Hope that makes sense. Where I've got to: - Found the attribute class in Attribute.php and successfully extended it to add in a price impact field. - Updated the database table to match But what I'm stuck on is: - I can't seem to find where the form is for the attribute entry so I can add a field to it. It seems like all the guides I've found for adding a field to the back office don't match the way this form works. I can't find any hooks to use and it's notable that the debug toolbar disappears when going to the attributes section, leading me to believe it is implemented differently to most other stuff. I saw a comment to this effect somewhere on my journey when googling that suggested if the smarty debug toolbar disappears it suggests that function is not implemented in smarty. - I don't yet know where the price impact calculations are made on the product page but I haven't actually looked for those yet. In case there is a way to do what I want in Prestashop 8.0, I can't upgrade to that at this point so it will need to be a solution on 1.7. If anyone can provide some guidance on how to do this I'd be grateful. I've been digging around for a couple of days and just can't seem to find the relevant templates. Edited March 29, 2023 by ric355 (see edit history) Link to comment Share on other sites More sharing options...
ric355 Posted March 31, 2023 Author Share Posted March 31, 2023 The attribute form is hard coded in controllers/Admin/AdminAttributesGroupsController.php 1 Link to comment Share on other sites More sharing options...
ric355 Posted March 31, 2023 Author Share Posted March 31, 2023 Just now, ric355 said: The attribute form is hard coded in controllers/Admin/AdminAttributesGroupsController.php Just what I needed; many thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now