Post by LDeeJay » Mon Jun 15, 2020 3:18 am

Lectori Salutem,

I've created a custom report (a copy of the product_purchased) and everything is working fine. It's showing up in the report drop down list, I can give access to it to other users and the report is reporting like it's supposed to... until..... I change something in the settings (under Extensions/Extensions/Reports). As soon as I hit the save button, the specific keys (report_product_purchased_myown) are removed from the oc_setting table and the report is disabled. No way I can enable it again, unless I recreate the keys (status & sort_order) manually in the oc_setting table. Can't be right.... right?

I've read about bugs of settings not being persistent but is this one of these cases? If so, what's the best way to resolve this? Or is there something else going on? Is there proper documentation on how to add custom reports because most of the official stuff refers to v2.

My workflow was as follows:
- Create the new files under controller, language, model & view
- Add the keys to oc_settings
- Give access & modify permissions under Users/Groups
- Activate the report under Extensions/Extensions/Reports

At first I didn't pay attention to the last step since I already entered it as 'activated' in step 2. But when I changed it, it wouldn't activate anymore and the keys were gone from oc_settings. What's the 'official' way of entering these keys? With an installation method? Can I read about that somewhere? In the past I was able to get by with the forum as documentation but with this reporting stuff I'm at a loss so apologies for any noob-questions.

Thanks for your time.

Leon

Tech details:
Opencart Version 3.0.3.2
Mods: Export/Import Tool (V3.22) for OpenCart, Remove Short Description, TMD Custom Tab , [underr] Order Invoice - Images
Layout/Theme: default
URL: newshop.bricks2spare.com (irrelevant)
Last edited by LDeeJay on Thu Jun 18, 2020 4:47 am, edited 2 times in total.

Newbie

Posts

Joined
Wed Nov 01, 2017 9:03 pm

Post by straightlight » Mon Jun 15, 2020 8:56 am

The right method would be to build an extension module that would pull each stores accordingly for each report settings. Then, to build an event whenever a specific action in the back-end must apply. This way, it would avoid on playing with user group permissions as to automatically update the arrays as you intend rather than playing with core files.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by letxobnav » Mon Jun 15, 2020 10:45 am

As soon as I hit the save button, the specific keys (report_product_purchased_myown) are removed from the oc_setting table and the report is disabled. No way I can enable it again, unless I recreate the keys (status & sort_order) manually in the oc_setting table. Can't be right.... right?
When using the official functions for manipulating settings, the particular old settings are first deleted and then the new are added.
So check if you are using the correct functions correctly.
OC uses the delete&add vs update scheme very often and in many cases it is a very dangerous method.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by LDeeJay » Thu Jun 18, 2020 4:46 am

Thanks all, that solved it.
I found a site that explains the procedure properly (albeit for modules, not reports) and took it from there. It appeared that my controller was missing the install-function (?!). And thus when activating, uninstalling and not installing. Weird because it's a copy of an existing report. Oh well... it's solved now.
Cheers,
Leon

Newbie

Posts

Joined
Wed Nov 01, 2017 9:03 pm
Who is online

Users browsing this forum: No registered users and 48 guests