Uploaded image for project: 'Magnolia Personalization'
  1. Magnolia Personalization
  2. MGNLPN-333

CookieFieldTransformer doesn't store values when multiple cookies are available

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.2.9, 1.3.2, 1.4.2
    • 1.3
    • Traits
    • None
    • Kromeriz 81
    • 3

      CookieFieldTransformer extends SwitchableTransformer but it doesn't operate like a real switchable transformer. When two or more cookies are available in the cookies trait, such as in the travel demo, the CookieFieldTransformer only stores the first cookie's value and ignores the second cookie's value.

      To reproduce in the travel demo:

      1. Select the "Which tour type are you?" component on the travel home page.
      2. Select the "Tour type is known" variant.
      3. Choose an audience for the variant. The variant already matches a cookie tourType=any. Add a second cookie weatherLocality=Basel. (see screenshot)
      4. Save the audience.
      5. In JCR Browser, open /travel/main/00/variants/variant-1/mgnl:ruleSet/voters.

      Result:

      • Expected: Both cookies are stored as voters and both voters have a value stored in a cookieValue property.
      • Actual: Only the first cookie tourType has a value. The second cookie weatherLocality has no value in JCR.

      If you change the transformer class of the cookies trait ruleField to a generic SwitchableTransformer, Magnolia stores both cookie values correctly but doesn't use the special property names cookieName and cookieValue.

      I set the priority to major since this issue prevents you from using more than one cookie in the same variant.

      Findings:
      After changes in MGNLUI-3715, we delete property holding value for not selected switchable field option. But when we use same name for "cookieValue" property for all switchable field options, this property is deleted from related form item if we select not last select field option.

        Acceptance criteria

              efochr Evzen Fochr
              ahietala Antti Hietala
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD