Tell us what you are trying to do?
I'm having issues after migration with maps. I've another ticket opened with different problems regarding maps.
What happens now is:
I have a Search displaying two different results (one on a map and one with info cards).
It's working fine on my develop site
hidden link
but on production, its having problems (but the procedure and coding is the same)
hidden link
What happened in this one with teh problem (as far as I can see it's the following)
I make a first search by "Provincia" and it works fine.
BUT if I make a new seacrh changing "Provincia" the map dissapears (and also all the results below it).
In the url you can see it has write the search twice
For example:
Search "Almeria"
hidden link
after this, searching "Cadiz"
hidden link
so, it adds Almeria + Cadiz instead searching only Cadiz
Is there any documentation that you are following?
No, I couldn't find anything and I'm pretty lost because its working fine on development
Is there a similar example that we can see?
What is the link to your site?
Hello and thank you for contacting the Toolset support.
I can see the issue with the URL but I do not see any error on the search results. I have run several tests each time changing a filter value and it seems to me that it always returns the correct results, maybe I am wrong. Can you provide a detailed example?
Regarding the URL, I can see the issue, and It seems that the form action URL gets encoded "#038;" is the code for "&" which needs to be on the URL. It is probably because the view search filters are rendered inside a WPBakery widget, and it gets encoded again. We'll need to investigate further in order to find out why. But if the results are not affected, we may just ignore it.
To workaround the URL issue, you can add the following Javascript code to your view:
jQuery(function($){
var form = $('form.js-wpv-filter-form-3403');
var url = form.attr('action')
form.attr('action', url.replace('#038;', ''))
})
Hi Jamal.
It's very strange you can't see the error, because it's happening for me on different devices and IP's.
You are seeing this, right?
hidden link
Here you have a map on top of the search panel.
1) You make a search (for example) for 'Provincia' selecting -> Almeria. The results are correct on Cards and on Map.
2) You make now (without refreshing the page) a new search for 'Provincia' selecting now -> Cadiz. The results are correct on Cards but Map have disappeared.
Maybe it's more clear if you see the same issue here, where everything under the map goes blank after second search.
hidden link
Unfortunately, i tried your code, but nothing really happens.
Please guide me.
I made this search with results on maps and list items thanks to Waqar help on this ticket
https://toolset.com/forums/topic/show-all-results-on-map-despite-pagination/
and it was working perfectly on my testing site, but when I migrate to my live site it broke and I can't understand how to solve this problem...
* It's not a problem with the 'Provincia' field. If you make a search with the other field 'Rutas' the problem is the same.
* If you need access to my live site I would be glad to grant you access.
My apologies, I was focused on the list of results and I did not check the map. Now I can see the issue on hidden link
I think that this code should fix the issue for it. If it does not, please allow me temporary access to check it further.
jQuery(function($){
var form = $('form.js-wpv-filter-form-3403');
var url = form.attr('action')
form.attr('action', url.replace('#038;', ''))
})
For the page hidden link the code should be:
jQuery(function($){
var form = $('form.js-wpv-filter-form-946');
var url = form.attr('action')
form.attr('action', url.replace('#038;', ''))
})
If it does not work, allow me temporary access to it and let me check it closely. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **
Hi Jamal.
It worked!
🙂
Sorry, because mark this ticket as "I still need assistance" is probably disrespectful for your work.
But it's the only way I have to ask you for some info (and learn a little bit more of Toolset in order not to be asking next time).
I guess your code says something like "in the form XXX replace the #038 with nothing". Right?
As you can imagine i'm not a code expert and this is kind of magic for me...
Can you give me some clue of what do you think it could happened in my search?
Thanks again Jamal!
Great support as always!
شكرا Jamal!
🙂
Hello, It is fine 🙂 and I am glad you asked for more details. مرحبا.
I think that the page is built using WPBakery, the view is, most probably, added inside WPBakery modules with a shortcode. The view shortcode will generate the search form and the view results.
I think that WPBakery is filtering the content of the view and applying some hooks, similar to wptexturize that might change some characters.
https://developer.wordpress.org/reference/functions/wptexturize/
I think that that's what changes the first & on the search form action URL to its HTML code #038;.
You are right, the Javascript code that I suggested, will look into the search form action, and if it found the HTML code #038; it will remove it by changing it to an empty string(nothing).
The search was already working fine, but the map was not. This fix, will remove the additional #038; and hence avoid any issues for the map.
We can try to understand this issue further and find out why this is happening. It will require some testing. But, I had to make sure that, at least, you have a workaround to let you continue working on your site while finding the root cause.
As I said, earlier, this is probably caused by WPBakery hooks. To confirm that, we'll need to try the same view in a native page(not built with WPBakery). If the issue does not appear there, we can focus on the WPBakery part and find out why is this happening.
If you judge that the workaround is enough, we can let it go unless, this is a recurring issue, in that case, we'll need to fix once and for all.
My issue is resolved now. Thank you!
Jamal is awesome!
🙂