Customer Portal

Get Involved. Join the Conversation.

Topic

    Dong Wang
    How to set the product id and category id dynamically in...
    Topic posted December 5, 2018 by Dong WangRed Ribbon: 250+ Points 
    26 Views, 2 Comments
    Title:
    How to set the product id and category id dynamically in Syndicated Conditional Chat
    Summary:
    How to set the product id and category id dynamically in Syndicated ConditionalChat
    Content:

    Dear,

    Currently we'll embed the  Syndicated ConditionalChat widget in customer's own website. Also we want to pass the product id and category id by the user selection on the page.

    Pasted my scripts and the screenshots. The problem is that the product id and category id cannot be passed according to my input, they are always the default value when the page is initiated.

    So can we pass the product id and category id dynamically? If it does, how to achieve it?

    Thanks a lot in advance.

    Ryder

     

    Version:
    18
    Image:
    Code Snippet:

    Comment

     

    • JustRhianna

      It should come in as an integer you have input type = text you can try changing that. Also is the product and category you are choosing visible for the end user pages? Have you tried setting the value directly in the javascript to see if you get the desired results

      • Dong Wang

        Hi Rhianna,

         

        If I set the value directly, I can get the desired result. The tricky is that the value is loaded when  page opening.

        I've tried add another javascript, see as below,

        <script type="text/javascript">
         
            function addProduct(type, args, instance){          
                  var data = args[0];
          console.log('data111:'+data);
                     if(data){
        data.p = 8;
        /*
        data.c = 29;
        */
        }
        }
        RightNow.Client.Event.evt_beforeDataRequest.subscribe(addProduct);
        </script>

        But it doesn't work. Please help.

         

        Thanks,

        Ryder