Jump to content
thirty bees forum
  • 0

Backoffice order page too slow


Pedalman

Question

Hello

the orders page in the back office is loading too slow. Sometimes this is not the case but since days I notice an annoying delay.

So, I assumed that there are some scripts running that have difficulties to to run or are slowing down the order pages and I started network traffic analysis in the browser tools.

alt text

I have no real clue how to use these browser tools but I see that there is a 404 (Ganalytics ?)

and a https://maps.googleapis.com/maps/api/js/QuotaService.RecordEvent?1 .... ?

Mh, reading "reacorded event" gives me a goose neck :) but anyhow I would really appreciate if TB would give us an option to use Gmaps service or not.

=> I vote for a TB exclusive tab in future ThirtyBees version with options like this that might increase priovacy a bit more.

Until then, I would like to ask where I can block the Gmaps call (edit file) and what causes the 404.

Thank you

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 0

TB uses google location services to help you determine if customer's address is valid or not. This might prevent you from sending your goods to non-existing address. I would say that's a good thing.

In order for this to work, you need to get google api key and save it to Preferences > General > Google Maps API Key. Without api key this whole process is useless.

If you are really that paranoid and think that google is out there to get you, you can always edit file /controllers/admin/AdminOrdersController.php . line ~ 400. :)

Link to comment
Share on other sites

  • 0

Actually, in order to satisfy both types of shop owners - the ones who care about Google connections and those who do not -

best would be to have an "on demand" look up Google Map adress button.

I think this goes with Thirty Bees concept and should be build in.

Thank you alot

Link to comment
Share on other sites

  • 0

@pedalman said in Backoffice order page too slow:

Actually, in order to satisfy both types of shop owners - the ones who care about Google connections and those who do not -

best would be to have an "on demand" look up Google Map adress button.

I think this goes with Thirty Bees concept and should be build in.

Thank you alot

That seems reasonable imo. I think address validation doesn't even work for my country. No sense having it enabled.

Link to comment
Share on other sites

  • 0

Hello, i absolutely agree with that idea, >> best would be to have an “on demand” look up Google Map adress button, so we can choose if this should be enabled or disabled, also regarding privacy policies in some countries.

I have checked the /controllers/admin/AdminOrdersController.php and this begins in line 383:

/**
 * Set Media
 *
 * @return void
 *
 * @since 1.0.0
 */
public function setMedia()
{
    parent::setMedia();

    $this->addJqueryUI('ui.datepicker');
    $this->addJS(_PS_JS_DIR_.'vendor/d3.v3.min.js');

    if ($this->tabAccess['edit'] == 1 && $this->display == 'view') {
        $apiKey = (Configuration::get('TB_GOOGLE_MAPS_API_KEY')) ? 'key='.Configuration::get('TB_GOOGLE_MAPS_API_KEY').'&' : '';
        $protocol = (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) ? 'https' : 'http';
        $this->addJS($protocol.'://maps.google.com/maps/api/js?'.$apiKey);
        $this->addJS(_PS_JS_DIR_.'admin/orders.js');
        $this->addJS(_PS_JS_DIR_.'tools.js');
        $this->addJqueryPlugin('autocomplete');
    }
}

HOW TO DISABLE THIS FUNCTION MANUALLY? Just comment this out or delete something? Please tell me, thank you!

Link to comment
Share on other sites

  • 0

Hi,

Another way, is to block assets you don't want to load on your browser.

Way to do in chrome: options panel (3 dots in top right) -> More Tools -> Developer Tools -> Network tab -> right click on what you want block -> Block request URL

Resources will be block forever, no need to do it every time. Hopefully, you can unblock if needed.

0_1517066538299_BlockRequest.jpg image url)

Link to comment
Share on other sites

  • 0

Mh

I never learned how to programm so I had a look at the Terms&Conditions check during checkout and tried to edit the controller in question - but without luck :)

  if ($this->tabAccess['edit'] == 1 && $this->display == 'view' 
         && isset($checkedMAP) && $checkedMAP checked=='checked' )

That was meant to be the first step. The second would be to have a button that sets checkedMAP. Anyhow syntax is wrong and all what I could do was to set the display condition to something else that does not exist... if ($this->tabAccess['edit'] == 1 && $this->display == 'view2'

Link to comment
Share on other sites

  • 0

@pedalman what are you trying to achieve?

If you want to disable the whole address validation functionality, then you need to do following steps:

1 - don't load google api library - get rid of following lines from AdminOrderController

$apiKey = (Configuration::get('TB_GOOGLE_MAPS_API_KEY')) ? 'key='.Configuration::get('TB_GOOGLE_MAPS_API_KEY').'&' : ''; $protocol = (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) ? 'https' : 'http'; $this->addJS($protocol.'://maps.google.com/maps/api/js?'.$apiKey);

2 - get rid of actual geolocation javascript call. Edit file <admin>/themes/default/template/controllers/orders/helpers/view/view.tpl and remove everything related to geocoder.

For example, you can replace line

var geocoder = new google.maps.Geocoder(); with var geocoder = (window.google ? new google.maps.Geocoder() : { geocode: function(address) { console.info("Automatic geocoding was disabled: "+address.address); } });

Now, if you want to make this whole functionality on demand, that will add a lot of complexity. You would need to

  1. add some preference so tb users could actually choose if they want this functionality on demand, or keep it as it is now
  2. if it's on demand, then you'll need edit order page, add some button, bunch of javascript that will dynamically and asynchronously load the google library, and once the library is loaded then initialize it with api key, and perform the actual geo call...

This is a lot of work. And I wouldn't expect guys on core team to implement this, as it really doesn't bring any actual value to merchants. It doesn't fix any bug, it doesn't provide new functionality,...

Link to comment
Share on other sites

  • 0

Well,

I have to pick up my complain and question again.

I upgraded to 1.0.4 latest repo in the meantime in order to exclude any issues or old bugs with the bo controller etc. But the backoffice orders page still hangs about 5 seconds due to loading google maps ?

I have entered an API code in bo for gmaps but this does not help. This is more than annoying and really makes no fun to work in Thirtybees BO. This behaviour started in January so I still believe this is due to some Google servers but I also still believe a free Prestashop for should give us the option to use GoogleMaps/GoogleFonts etc. in Backoffice and elsewhere!

But in I am willing to calm down :) and want to ask other European users if they notice or do not notice this delay in bo/orders ? This would be very helpful.

Link to comment
Share on other sites

  • 0

Update: Firefox Quantum and an extension (LastPass) seem to be partly responsible for the delays. After editing the files above in order to stop the Gstatic/Gmaps ... calls all seems to be pretty fast with Chrome! That is really weird but now I can work again in BO without building up frustration :)

PS: still a problem with ganalytics in BO: https://i.imgur.com/vOom7ss.png

Link to comment
Share on other sites

  • 0
On 1/23/2018 at 9:54 AM, datakick said:

TB uses google location services to help you determine if customer's address is valid or not. This might prevent you from sending your goods to non-existing address. I would say that's a good thing.

In order for this to work, you need to get google api key and save it to Preferences > General > Google Maps API Key. Without api key this whole process is useless.

If you are really that paranoid and think that google is out there to get you, you can always edit file /controllers/admin/AdminOrdersController.php . line ~ 400. :)

Hello, today I found this geocoding feature in BO, I didn't know it existed.
Google is now requiring you to have a billing account in it's cloud services. In theory, it is free if you don't use it very often (they give you $200 every month).

Would it be possible to reimplement georeference with a service like openstreetmaps for example? I prefer Matomo over Analitics, and really don't like the addresses of every customer being calculated by Google.

Thanks!

  • Like 1
Link to comment
Share on other sites

  • 0
2 hours ago, Wartin said:

Hello, today I found this geocoding feature in BO, I didn't know it existed.
Google is now requiring you to have a billing account in it's cloud services. In theory, it is free if you don't use it very often (they give you $200 every month).

Would it be possible to reimplement georeference with a service like openstreetmaps for example? I prefer Matomo over Analitics, and really don't like the addresses of every customer being calculated by Google.

Thanks!

I agree this geocoding should be on opt-in basis. Especially since this probably breaks couple of GDPR rules.

I have filed an issue to fix this: https://github.com/thirtybees/thirtybees/issues/1278

Since this is security issue, it will have priority

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

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