Try ERPNext Buy Support Partners Foundation

Item group depth of query and item routing fix

Hello Everyone,

I am setting up the webshop part of erpnext at the moment. I have 70 categories and 2000 products or so. As such I find the all-products page with the searchbar suboptimal, so I tried to just display the item-groups and their products instead. However, it seems like an item-group displays not only their direct descendants but all of them. This leads to a rather confusing layout in big parent categories. Optimally, I just want parent item-groups to display their direct child item-groups and “leaf” item-groups to display their items.

For that I modified the get_child_groups_for_list_in_html function in the controller in setup. Notably the filter for lft and rgt is just overwritten to become “parent_item_group = (’=’,”.

While this works I am sure someone had a good reason to do this with lft and rgt, so I wanna know if this change makes sense to you? Is there another better solution? Should the user be presented with a setting to select either option and how can this be coded? Should this be a feature or just my own customization?

On a similar matter, we got a fix for the item routing problem in this pull/merge:

It changes the item row template to make all relative links into root relative ones. Therefore, this template doesn’t work with relative links anymore which is not really visible from the user interface. Would it be better practice to change the route generation function “make_route()” in the controller to generate root relative links from the get go? This way they A. show up as such for the end user and B. can be changed without code editing should that be necessary for any reason. How can I officially propose this solution in code?

Please advise, I am really new to open source projects, contribution and coding best practices. So, I’d rather ask before diving in head first. Hope this is the right place to do so.