Home › Forums › WoodMart support forum › Dokan Geolocation does not work with AJAX Shop feature
Dokan Geolocation does not work with AJAX Shop feature
- This topic has 10 replies, 2 voices, and was last updated 3 years, 11 months ago by
Artem Temos.
-
AuthorPosts
-
March 10, 2021 at 10:35 pm #272550
kevinParticipantHi, I’ve been using your theme and really like it. I’m just having one major issue…
As background, I’m using WoodMart and Dokan Pro. I have turned Dokan’s Geolocation feature on and linked it to a Google Maps API (see attached image #1). Everything works as long as I have WoodMart’s “AJAX Shop” feature turned OFF.
When “AJAX Shop” is turned ON, I have the problem. When I use a product filter on the shop page (example: Sort by price), the entire Dokan Geolocation module disappears and is replaced by a loading icon. The icon just spins and spins but nothing ever loads (see attached image #2).
So my question is, how can I tie the Dokan Geolocation module into the Woodmart theme AJAX? If you can’t tell me how to fix this, can you tell me where to look and give me a general overview for what I can do on my own?
Other important points:
- I have turned geolocation features OFF in WooCommerce.
- For security reasons I will not provide access to my site or FTP client. With that said, I have provided annotated images so you can see the behavior I mentioned above. I am simply looking for guidance here.
- Lastly, I already contacted Dokan about this and they said this is a theme-related issue so I need to contact you.
Thank you and I look forward to your reply.
Attachments:
You must be logged in to view attached files.March 11, 2021 at 7:59 am #272640
Artem TemosKeymasterHello,
Yes, this map has to be reinited with JS after AJAX loading. You can contact plugin developers and ask which script should be used to init the map. Then, we will give you an instruction about where to use that code to init the map right after AJAX content loaded. Otherwise, you will need to disable the AJAX shop at all.
Kind Regards
March 11, 2021 at 5:27 pm #272789
kevinParticipantHi Artem, thanks for your help on this. I am waiting to hear back from Dokan. In the meantime I have been going through the files and believe I have what we need.
In the attached file, on line 97, there’s several functions related to the Maps init. Specifically, I think the one we need is
DokanGeo.LocationsMaps.init();
But, I’m not sure if you need more than the function call so I attached the entire Dokan Javascript file. Luckily it’s a pretty short file. Is this everything we need to move forward?
Thank you,
KevinMarch 11, 2021 at 5:29 pm #272793
kevinParticipantI forget to ZIP the JS file before attaching in my previous post. Trying again here…
Attachments:
You must be logged in to view attached files.March 12, 2021 at 7:14 am #272912
Artem TemosKeymasterHi,
Could you please send us a link to your website where we can see this issue? We will try to use this code to init the map.
Kind Regards
March 12, 2021 at 9:05 pm #273181
kevinParticipantHi Artem, I included the link in the Private Content section. Thanks again!
March 15, 2021 at 7:28 am #273503
Artem TemosKeymasterTry to add the following code snippet to the Custom JS area on a document ready in Theme Settings to init the map after AJAX.
jQuery(document).on('pjax:end', function () { if ('undefined' !== typeof DokanGeo) { DokanGeo.LocationsMaps.init(); } });
March 15, 2021 at 3:37 pm #273646
kevinParticipantHi Artem,
That got the map working! The geolocation widget filters above the map still exhibit the same loading issue (see attached image). I think we have this almost solved…
Just so you know, this morning I heard back from Dokan. They said, “The Dokan Geolocation map script has been loaded within the enqueue_scripts function. The function has been available in the module.php file, and it is located in the following directory –
dokan-pro\modules\geolocation\module.php”The module.php file is included in the attached Zip folder. I also included all the other Geolocation-related files. For example, in the file \geolocation\assets\js\dokan-geolocation-filters.js I see the init function for the filter widgets but it’s much more complicated. I tried getting this to work in the Theme Settings > Custom JS > Document Ready field but have been unsuccessful.
Could you please help provide the code for this final step? Thank again for all your help!
Attachments:
You must be logged in to view attached files.March 16, 2021 at 7:13 am #273771
Artem TemosKeymasterHello,
We don’t know how to init the filters. But the code should look like this
jQuery(document).on('pjax:end', function () { if ('undefined' !== typeof DokanGeo) { // SOME JS FUNCTION TO INIT THE FILTERS } });
You can ask plugin developers for the exact code for this.
Kind Regards
March 17, 2021 at 2:48 am #274119
kevinParticipantHi Artem,
I’m hoping for a little clarification here… What is it about the filter code that makes it harder to solve than the map code? Is it because the function is not explicitly called out in dokan-geolocation-filters.js file? I have tried experimenting with variations on the functions below but have not been able to get it to work:
GeolocationFilter.prototype.init();
new GeolocationFilter($(this));
The WoodMart theme claims to be compatible with Dokan. The Geolocation module is a very popular part of Dokan Pro. So it seems to me that figuring this out would benefit many of your future Dokan customers and live up to the marketing claims… Especially considering that in-page loading (with AJAX) has become a standard for most reputable websites. So, I hope we can get this resolved and help others who may be experiencing the same problem and end up having to leave WoodMart’s AJAX feature off.
I will try contacting Dokan again but they have been pretty unhelpful…
Thanks Artem!
March 17, 2021 at 9:44 am #274217
Artem TemosKeymasterHello,
All we need to do is to get the code the reinit the filters. Yes, our theme is fully compatible with both Dokan lite. But as you can see, some functions with AJAX shop don’t work well and have to reinited. And it happens with all other plugins not only with Dokan. That is why, we are always trying to do our best to provide a custom JS code to reinit the plugin scripts after AJAX. It is not possible to predict which scripts should be reinited from dozens of plugins that we want our make to be compatible with. As a workaround, you can disable AJAX shop function. Otherwise, we need this code from plugin’s developers. And we can’t contact them since we don’t have a PRO version.
Kind Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register