I’ve spotted an issue with the Expresso Store discounts detail page:

i.e. /cp/addons_modules/show_module_cp?module=store&sc=discounts&sm=edit&id=1

If you have ‘lots of entries’ (we have 124,114) then the discounts page take forever to load as it attempts to populate the ‘Match Entries’ multi select field with every single entry in the CMS!

Any thoughts on how we can fix/hack this so it’s usable?


  • Can you key us down to the query that is wrecking that page? It's easy to do if you use New Relic or similar environment monitoring solutions. Probably doable with MySQL logs too. A few core MySQL hacks might do it, even though it won't be a great solution. – jrothafer May 14 '15 at 12:32
  • The debugging profiler will reveal your queries too I believe, you just need to edit admin.php to enable CP debugging... – Blatant May 14 '15 at 13:23
  • Looks like you're going to have to modile the expresso files of course, but I don't have a source so I'll have to guess, you may find the field in the fieldtypes in the module, once here you'll have to hack the SQL query that gets the entries, make it more restrictive (status,channelfilters)... – Blatant May 14 '15 at 13:29
  • Is this a CP page only issue, and not a public live-page issue? If so it'll definitely require core hacking; Expresso Store has a bunch of hooks but none of them are for CP pages it appears... if we can track this one down, it should result in a bug report / pull request. – jrothafer May 15 '15 at 12:59
  • @jchrono, looks like its the CP page, the problem appears to be the dropdown isn't coping with 100k+ entries in a dropdown thats duplicated... I would suggest the way to go is modify the field in the Expresso Module to be an autocomplete style of text box (would require adding an ajax method to search entries for matches_, or more cunningly find the code that populates the dropdown, develop a quicker 'loader' (use PHP and ee()->db) and cache the list... (times like these I wish I had a copy of Expresso so I could re-roll)... – Blatant May 18 '15 at 14:31

The simple 'hack' to resolve this if you don't plan on using entries as a filter for discounts is to modify line 96 in DiscountsController.php to read:

$data['product_options'] = NULL;

It means you can no longer apply discounts on a per entry basis but it's a fix for the very slow loading of the form if you don't require that ability! :)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.