0 Replies Latest reply on Apr 17, 2013 4:00 AM by nelsonr100

    How can I get all the values of a String array profile property using javascript?

    nelsonr100

      I am trying to build functionality into our site that records all products added to the basket against a user's profile.

       

      I have so far been able to store the product codes against the profile as a property using Ajax:

       

             var dataString = ":formid=addProduct&:formstart=/apps/thread/templates/page_product/jcr:content/par/produc t/formstart&:redirect=/content/thread/en/user/cart.html&productId=151515:profile="+profile ;

       

                           $.ajax({ 

                  type: "POST", 

                  url: "/content/women/evening/dresses/l-k-bennett-davinadress.html", 

                  data: dataString, 

                  success: function(data) { 

                  }

       

              });

       

      In this example I have hardcoded a product ID of 151515.

      In order to save the property as a multi string field you simply replace &productId=151515 with &productId=151515&productId=131313&productId=141414 or as many extra values as you want to build into that string. This stores a productId property against a user profile.

       

      The issue comes from calling that data back. Using var value = CQ_Analytics.ProfileDataMgr.getProperty("productId") I can get the first value of this array (or the single value if only one is stored).

       

      However there does not seem to be a way to get any of the other stored values in the array using getProperty. Does anyone know how I can achieve this?