Closed ghost closed 7 years ago
That's true. I have moved the code into it's own partial in version 1.0.29. I'll leave it in a partial so users can customize it easily. The code is now beeing put
to the scripts placeholder.
Hmm I have a problem with the {% put %} placeholder.
If I don't put the script in the put placeholder, I get a "$ is not defined" javascript error. Seems logical as I don't include jQuery with snipcart cause I already include it myself just before the end of body tag (as recommanded). So, if the script is somewhere in the body, jquery is not defined.
But if I put your script between the {% put scripts %} tag, I have another error on product page load :
Ajax manager "onRecalculatePrice" can't be found"
Do you have any ideas why the onRecalculatePrice can't be found ? What should I check ?
Thanks
If your jQuery was included in your footer and not in your header the $ is not defined
error was expected. This should be fixed by using the scripts placeholder.
I wonder why the onRecalculatePrice
method cannot be found. I cannot reproduce this issue. How are you including the component? Did you put the {% compontent 'product' %}
on a cms page? What partials are you overwriting?
Does it help if you prepend __SELF__
to the $.request
line?
$.request('{{__SELF__}}::onRecalculatePrice', { //...
It's ok, I called the component in a partial (and I forgot partials can't handle ajax). By calling the component in a page instead, it works.
Hello,
I'm customizing the html of the different partials added by these plugin.
On the offline/snipcartshop/components/product/custom-fields.htm, I think your should add your inline JS in a {% put scripts %} tag.
See the october documentation about this .