We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18373 ☆ A M B ☆
    • 3,141 Posts
    Mark Hamstra Reply #1, 13 years ago
    CookieList can be installed through the Package Manager and also from http://modx.com/extras/package/cookielist

    CookieList is a generic addon that can be used for keeping wishlists, user favorites and other similar content. It allows you to define the value that needs to be saved which means it is not restricted to Resources, but may also be used to provide wishlist functionality for custom components. As the name indicates, it stores data in a Cookie.

    Documentation can be found at http://rtfm.modx.com/display/ADDON/CookieList
      Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

      Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
      • 38177
      • 2 Posts
      What kind of placeholder contains a comma-separated list of resources id, when calling getCookieList?
      P.S. I'm not very experienced user
        • 33976 ☆ A M B ☆
        • 571 Posts
        Hi NuShiKo,

        As far as i remember, getCookieList does not set any placeholder but directly returns the list. So just use the snippet where you need it.

        [[myCustomSnippet?
            &ids=`[[!getCookieList]]`
            &other=`param`
        ]]
        


        Hope that might help smiley
          • 38177
          • 2 Posts
          [[!getCookieList]]
          always return an empty string sad although on the pages where I call
          [[!addToCookieList]]
          link changes from "Add to your CookieList" to "Remove from your CookieList"... what am I doing wrong?(
            • 12028
            • 152 Posts
            @Mark

            Thanks for your Cookielist!

            But when using friendly urls the cookie path are always the url of the resource:
            Url: http://domain.tld/resource-alias/resource-alias
            Cookie path: /resource-alias/resource-alias/

            When the friendly url are disabled the path are always:
            /

            And therefore it's imposible to get the values from the cookie there are set when using friendly urls...

            I had tried to set the path directly in the Cookielist plugin, from
            setcookie($cookie."[cl_check]", 1, 0, '', false, false);

            to
            setcookie($cookie."[cl_check]", 1, 0, '/', false, false);

            and from:
            setcookie($cookieName, $value, $duration, '', false, false);

            to
            setcookie($cookieName, $value, $duration, '/', false, false);


            But it's still the same...

            Or I'm missing something fundamental here?
              - A small step for mankind, so why not take two...

              Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
              • 39905
              • 1 Posts
              Hi

              How do you get cookielist to work with getResources?
              I've tried with [[!getResources? &resources=`[[!getCookieList]]` &tpl=`wishlist`]]
              Chunk "wislist" <h2>[[+pagetitle]]</h2>

              But it doesn't work?

              Thanks in advance,
              Claus
                • 12028
                • 152 Posts
                To answer my own question:
                It appeared to be that Revolution - in my setup - did not got the session_cookie_path from the MODX_BASE_URL in system settings.

                Added a / and flushed the cache, and it works

                @Claus:
                Snippet call:
                [[!getResources? &tpl=`chk-wishlist` &resources=`[[!getCookieList]]`]]

                Chunk:
                <h2>[[+pagetitle]]</h2>



                (By the way: It's good to see other danes here)!
                  - A small step for mankind, so why not take two...

                  Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
                  • 40147
                  • 3 Posts
                  @Henrik
                  Could you please clarify the steps you took? I still seem to be having the same problem. I've seen your pull on github and updated my own file; but no changes seems to occur. Clearing the cache (Site > Clear Cache) has no effecet.

                  Am I missing something?

                  Thanks
                    • 12028
                    • 152 Posts
                    @bmuniz:

                    1. Install CookieList
                    2. In system settings, change session_cookie_path from empty to /
                    3. Edit the plugin CookieList:
                    setcookie($cookie."[cl_check]", 1, 0, '', false, false);

                    to
                    setcookie($cookie."[cl_check]", 1, 0, '/', false, false);

                    and from:
                    setcookie($cookieName, $value, $duration, '', false, false);

                    to
                    setcookie($cookieName, $value, $duration, '/', false, false); 

                    In my templates, where the "Add to basket" link are:
                    [[!addToCookieList? 
                      &addText=`Add to basket` 
                      &removeText=`Remove from basket` 
                      &value=`[[*id]]`
                    ]]

                    On the page where I have the list of items in the basket:
                    [[!getResources? 
                      &tpl=`chk-tpl-basket` 
                      &resources=`[[!getCookieList]]`
                      &includeTVs=`1`
                      &tvPrefix=``
                    ]]

                    And in chunk "chk-tpl-basket":
                    <div class="item">
                      <h3>[[+pagetitle]]</h3>
                      <p>[[+introtext]]</p>
                      etc. etc...
                    </div>


                    5. Clear cache - maybe with your FTP client to remove all files from core/cache
                      - A small step for mankind, so why not take two...

                      Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
                      • 17723
                      • 221 Posts
                      Hello Mark,
                      This is grate add on!

                      Is it possible to prevent page from loading when adding or removing from wishlist?
                      On my website I have a preaty heavy flash elements, and I would like to prevent from reloading when clicked "add to wishlist"

                      Regards,
                      Luke
                        Lucas from AroundCyprus.net