• Resolved morckdk

    (@morckdk)


    Hello again,

    Im trying to take advantage of the Dynamic Notice object.

    However i cant get it to work with JS expressions.

    I’ve tried mulitple including the code from the documentation;

    {# if (typeof data.uni_cpo_width !=== 'undefined' && data.uni_cpo_width > 100) { print 'The width is too big!'; } #}

    When i go to the JavaScript console in chrome i see a syntax error related to the JS in the Dynamic Notice.

    Im not at all experienced in coding but pretty sure ive tried some solutions that should be working. On the other hand im not completely sure what the Dynamic Notice will allow.

    Is it possible to hide and show elements with JS in the Dynamic Notice?

    Will the Dynamic Notice run the script automatically or do i need to call the script with a event?

    Any kind of feedback is appreciated. Would like to make certain that its not some kind of bug before trying more. Been trying to make it work for two days now.

    Thank you!

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author moomooagency

    (@moomooagency)

    Hi,

    Yes, it is possible to hide smth with js. No, you do not need to run any event, the code executes automatically.

    You have to understand how js works and be able to fix it if you want to use js code. Otherwise just print out variables.

    Thread Starter morckdk

    (@morckdk)

    Okay thank you. So its not a bug, just that my code is unfinished.

    What do you mean: Otherwise just print out variables?

    Plugin Author moomooagency

    (@moomooagency)

    I meant use it like this {{{data.uni_cpo_width}}} and that’s all. It should not be broken at all.

    Thread Starter morckdk

    (@morckdk)

    Ahh yes i know.

    I was trying to dynamically hide and show the add to cart btn and the btn from the add-on.

    Just tried the example from the documentation to be sure that the code was right. But guess there is more to it than just copy paste and change up the variables.

    I would have used another plugin or snippet to deal with the add to cart btn but seems like the CPO builder changes the hook of the btn somehow. When i use a catalog plugin or a snippet to remove the btn it doesnt affect the add to cart btn on pages where the CPO builder is active.

    Plugin Author moomooagency

    (@moomooagency)

    “I was trying to dynamically hide and show the add to cart btn and the btn from the add-on.”
    How would you do that with Dynamic Notice?

    “When i use a catalog plugin or a snippet to remove the btn it doesnt affect the add to cart btn on pages where the CPO builder is active.”
    Probably because you really need ‘add to cart’ btn. In general, I am not sure what you mean precisely.

    Thread Starter morckdk

    (@morckdk)

    “How would you do that with Dynamic Notice?”
    I would show a Dynamic Notice containing the JS conditionally from a radio input. Maybe thats not even possible, dont know.

    “Probably because you really need ‘add to cart’ btn. In general, I am not sure what you mean precisely.”
    True you need a ‘add to cart’ btn if you need a ‘add to cart’ btn. In my case however sending the costumer a quote i thought would be more ideal.

    However i might do it in another way and find a quote plugin. Just wanted to make it all happen on the product page. This would make it less complicated and would probably result in more requests.

    What i was trying to say is that apparently the CPO builder changes the ‘add to cart’ btn since the catalog plugin will hide the btn from all other products than the ones where the CPO builder is activated.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Dynamic Notice JS’ is closed to new replies.