Jump to content
thirty bees forum
  • 1

Waiting for paypal.com


Question

Posted

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?

16 answers to this question

Recommended Posts

  • 1
Posted

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

  • 1
Posted

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.

  • Thanks 1
  • 0
Posted
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.

  • 0
Posted

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.

  • 0
Posted

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

  • Like 1
  • 0
Posted
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?

  • Like 1
  • 0
Posted
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)?

  • 0
Posted
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. 

  • Thanks 1
  • 0
Posted

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 

  • 0
Posted
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. 

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...