Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-141471

Using collectionObjectList in a Fragment does not take Collection variations into account



      Problem: when using a collection programatically in a fragment (adding a collectionSelector through the fragment configuration) you can't retrieve the collection's variations.

      The following fix LPS-128810 that enables Variations at Collection level when mapping a collection to a Collection Display Fragment, seems correct when using that OOTB Fragment. The problem comes when using it programatically (method collectionObjectList)


      1. Create a Segment called Change with an easy rule to be able to classify two type of users. Ej. URL contains "change" (we will be adding a parameter in the URL with ?change when we want the segment to work)
      2. Create a Basic Web Content with Content1 in the title and also in the content
      3. Create a Basic Web Content with Content2 in the title and also in the content
      4. Create a Manual Collection and configure it to show Basic Web Contents. The Anyone variation should list the Content1 and the Variation for the Segment "Change" should list the Content2
      5. Change the priority of the Change variation and put it first
      6. Create a Fragment with the following code attached to the ticket (see documentation here)
      7. Create a new Page. Drag and Drop the Fragment and configure it to use the Collection defined in step 4. Publish the page
      8. Visit the page: acknowledge that Content1 is listed in the fragment.
      9. Add ?change into the URL and reload the page (ej. http://localhost:8080/web/guest/home?change): acknowledge that Content1 is still listed in the fragment. (we should see Content2)

      We still see Content1 in the fragment, the variation is not being retreived

      The collection lists Content2 so retrieving the variation attached to the segment now that we belong to the segment

      You can try the same by using the Collection Display Fragment to check that with the OOTB fragment it works.

      1. In the same Page created Drag and Drop a Collection Display Fragment
      2. Configure it to use the same collection created on step 4
      3. Drag and drop a Heading Fragment and map it to use the Title of the Basic Web Content. Publish the page
      4. Visit the page: acknowledge that Content1 is listed in the fragment.
      5. Add ?change into the URL and reload the page (ej. http://localhost:8080/web/guest/home2?change): acknowledge that now the Collection Display Fragment does work and shows only Content2


        Issue Links



              diego.hu Diego Hu
              rafael.lluis Rafael Lluis
              Kiyoshi Lee Kiyoshi Lee
              Ruben Pulido Ruben Pulido
              0 Vote for this issue
              1 Start watching this issue


                51 weeks, 3 days ago


                  Version Package
         CE GA5
                  7.4.13 DXP U1