• Priority: High
  • Status: Waiting on customer
  • Theme: Alysum
  • Assigned To: Fred
  • Private: No
  • Open Date: 04.03.20, 13:48
  • Opened by: Pianeta Affari

Ticket #16951 - Areapacks module on AMP

Before installing your template we had a module for areapack calculation. On Desktop version the module works fine, i put the code suggested by the module on product.tpl of the template

{hook h='displayAreaBlock' mod='areapacks' product=$product}

On AMP of course the module doesn’t show up, so i put the same code on product.tpl of the AMP template but the module doesn’t work well.

I assume that is beacuse the Areapacks module need to load his js file in order to work. How can i achieve this?

You can see the module on this product



Fred 04 Mar 2020, 19:04

Hi, Pianeta Affari.
Any third party module is not compatible with AMP by default. To make it work with AMP we have to extend AMP module what requires some time.

Pianeta Affari 05 Mar 2020, 14:34

Hi Fred,
I was afraid it was like that, however i just need a way to link the js file of the Areapack module, that's it

Fred 05 Mar 2020, 19:34

the easiest way is to add a hook, like you already did, then check what javascript files are necessary for that module and add them to AMP

Pianeta Affari 06 Mar 2020, 09:39

ok i will do that, thanks Fred

Fred 06 Mar 2020, 21:02

you are welcome. let me know in case some questions

Pianeta Affari 09 Mar 2020, 10:56

ok, i followed your advice and i hooked the module and i linked the necessary js file at the end of this block

{block name='head_scripts' append}

in product.tpl of the AMP template

But unfortunately It gives a Jquery error 'Uncaught ReferenceError: jQuery is not defined', where is the right place to link this js file?

Fred 09 Mar 2020, 19:02

yes, you have to add jquery as well

<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
Pianeta Affari 11 Mar 2020, 11:38

oh ok, I thought Jquery was already on the shop

Fred 11 Mar 2020, 12:02

so it works now?