Skip to content
View in the app

A better way to browse. Learn more.

thirty bees forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Waiting for paypal.com

Featured Replies

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?

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

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.

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

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.

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

  • 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?

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)?

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.

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. 

  • 8 months later...

Indeed, that line is there. Was my lack of knowledge, I was expected  to see the words in the source page

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 

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. 

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.