Jump to content

[bug] 4.6.7 - 'Use to identify purchases' Too many redirects


Go to solution Solved by Stuart Silvester,

Recommended Posts

4.6.7
All 3rd party apps/plugins disabled

Issue:

"Too many redirects" blank page when attempting to manage a purchase with a 'YesNo' field type that has the 'Used to identify purchases?' option set. (you're not supposed to be able to set this option for a 'YesNo' type)

Repro:

  1. Create a nexus custom field with Field Type of Text, and specify 'Used to identify purchases?'
  2. Assign the field to a package, and generate a purchase with said package in it.
  3. Go to Manage Purchases, confirm the purchase can be managed.
  4. Change the field type to 'YesNo' (or some other type that doesn't use the 'Used to identify Purchases' toggle)
  5. Attempt to manage the purchase.  This should result in a URL that apparently contains the csrf key appended to it, and a "ERR_TOO_MANY_REDIRECTS" browser error.

"No code" fix:

  1. Change the custom field back to 'Text'
  2. De-select 'Used to identify Purchases'
  3. Save
  4. Change the type back to 'YesNo'
  5. Save

I confirmed changing the setting for 'Used to identify Purchases' fixes this, but I figure if I ran into this organically, someone else might as well too and would come to support for help with it.  Frankly I had no idea why I was suddenly unable to manage some purchases for a good while.  lol

Here's what some poking around the $values revealed when saving the form:

Text -> Utip enabled:

  • "cf_sticky":true

Text -> Utip disabled:

  • "cf_sticky":false

YesNo -> Utip disabled:

  • "cf_sticky":false

YesNo -> Utip enabled:

  • "cf_sticky":1

It would seem the cf_sticky state is still being saved, but it is formatted incorrectly because the toggle isn't actually displayed on the form.

We don't actually want any YesNo field to be sticky though, since its not really useful info, so I'd suggest doing something like this in \IPS\nexus\Package\CustomField::formatFormValues()

        if ($values['cf_sticky'] === 1){
            $values['cf_sticky'] = FALSE;
        }

Tested via plugin, it fixes the problem.

GIF by Giphy QA

[/Fringe case] lol

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...