October 26, 20197 yr I am looking for things that slow down the render of my pages and one thing that comes up on every page is a browser warning: waiting for paypal.com As far as I can tell, this is code for the Paypal login, which I do not use. It is disabled in the module yet it loads at every page. I wanted to disable the hook that calls it but I am not sure which one it is and I do not want to accidentally prevent things needed by Paypal from loading. Any insights?
October 27, 20197 yr This might be just some Paypal picture that says that you support it. You can see what it is by either: - look at the source of your page in the browser (right click somewhere on the page and then choose source code) and then search for "Paypal" - Open the "console" of the browser, choose the network tab, refresh the page and look for the line that concerns Paypal
October 27, 20197 yr Disabling a module just disables it. Which means, all hooks and overrides stay in place. To get rid of a module, one should uninstall and delete it.
October 27, 20197 yr Author 4 hours ago, Traumflug said: Disabling a module just disables it. Which means, all hooks and overrides stay in place. To get rid of a module, one should uninstall and delete it. I meant that I disabled the functionality of using Paypal to login. However, that script is still there on every page and it still checks with Paypal, even though technically, I don't need it to. I sometimes disable hooks when I know they call functions I do not need and it does speed things up, but I am not sure what hook contains the login in the TB Paypal module.
October 28, 20197 yr It is easy to see (in modules->positions) what hooks the Paypal module uses. It could also be an override that causes the effects that you see. Prestools offers an easy way to see which overrides are installed.
October 28, 20197 yr I bet you are talking about paypal's checkout.js script -- this one is included using on all pages, even though it is needed only during payment. It uses header hook to do that -- but you can't simply remove this hook, as it would disable paypal functionality on your checkout page as well. What you can do is to define hook exceptions, blacklist all controllers except checkout
October 28, 20197 yr Author 4 hours ago, datakick said: I bet you are talking about paypal's checkout.js script -- this one is included using on all pages, even though it is needed only during payment. It uses header hook to do that -- but you can't simply remove this hook, as it would disable paypal functionality on your checkout page as well. What you can do is to define hook exceptions, blacklist all controllers except checkout Yup, that's the one. How does one go about defining hook exceptions?
October 29, 20197 yr 18 hours ago, datakick said: I bet you are talking about paypal's checkout.js script -- this one is included using on all pages, even though it is needed only during payment. It uses header hook to do that -- but you can't simply remove this hook, as it would disable paypal functionality on your checkout page as well. What you can do is to define hook exceptions, blacklist all controllers except checkout I guess the ability to put PayPal checkout buttons on every product page means it's not possible to change the PayPal module to use a hook that only exists on the checkout page(s)?
October 29, 20197 yr Some changes should be made to Thirty bees paypal module, as I already mentioned in some other posts, that TB's paypal is loading on every page and delaying page load. I use PS paypal module on my TB instalation. With PS Paypal module, my landing page loads with 9 requests and 293kb of data. With installed Thirtybees Paypal module, there are 14 requests and 507kb of data.
October 29, 20197 yr 1 hour ago, toplakd said: that TB's paypal is loading on every page and delaying page load. With PS Paypal module, my landing page loads with 9 requests and 293kb of data. With installed Thirtybees Paypal module, there are 14 requests and 507kb of data. The fact that there is extra javascript file on the page doesn't mean it delays page load. In this case it does not -- the paypal checkout.js is included using async and defer keywords, which instruct browser to load this asset asynchronously, and execute it after the page is parsed and rendered. Of course, your customer browser must load unnecessary data, which is not optimal. But it does not hurt your page load time <script async defer type="text/javascript" src="//www.paypalobjects.com/api/checkout.js"></script> Why is this script loaded on every page? Well, that's because paypal module does not know which controller (page) is used for checkout. So, it includes it on every page, just to be sure I have seen many payment modules to use conditional asset loading. Something like this: public function hookHeader() { $pageName = $this->context->controller->php_self; if ($pageName === 'order' || $pageName === 'order_opc') { $this->context->controller->addJS(static::JS_FILE_URL); } } And it works ok, but only for standard order and opc page. If you install some third-party checkout module (for example my chex), then this check would make the module unusable -- that's because controller name is not 'order' anymore, but it's 'module_chex_checkout'. This is actually one of the reasons why in ps17 it's forbidden to include assets conditionally. They will actually reject module from prestashop store if they find out it is using conditional asset loading. What is the best way to tackle this problem? I don't know. While it is possible to to use different hook to include this js asset (some hook that is triggered on checkout page only), it's not the best solution either. This would work only if *all* opc modules triggered this hook. And that's not guaranteed at all. By using header hook we can at least be sure that it will be triggered on every page, even on custom OPC.
July 14, 20206 yr I have installed TB Paypal v 5.4.3 and on the I have <script type="text/javascript" src="https://www.paypalobjects.com/api/checkout.js"></script> @datakick can you please advise where to add the async and defer keywords ?
July 14, 20206 yr TB paypal has already these keywords included: https://github.com/thirtybees/paypal/blob/865ed1dcfa38c3a7e5bbba88ac979943a00adcb7/paypal.php#L817
July 14, 20206 yr Indeed, that line is there. Was my lack of knowledge, I was expected to see the words in the source page
July 14, 20206 yr 3 minutes ago, netamismb said: I was expected to see the words in the source page Well, you should see them in the page source
July 14, 20206 yr Well, they are not. All the js are on the bottom of the source page, after the footer. Anyway I can test why they are not there? the only module that is not TB native installed is Free GDPR compliance [RGPD 2016/679] v1.0.7 - by Arte e Informatica
July 14, 20206 yr 32 minutes ago, netamismb said: Well, they are not. All the js are on the bottom of the source page, after the footer. Anyway I can test why they are not there? the only module that is not TB native installed is Free GDPR compliance [RGPD 2016/679] v1.0.7 - by Arte e Informatica You have probably enabled Advanced Parameters > Performance > Move JavaScript to the end option. If so, please file an issue in https://github.com/thirtybees/thirtybees/issues , as it would be a bug in core.
July 14, 20206 yr You are right, I have tested and the async is there when the "Move Java Script to the end" is off. Have raised issue #1233.
Create an account or sign in to comment