Skip Navigation

[Resolved] Passing a query between Views and MapPress

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Tagged: 

This topic contains 15 replies, has 3 voices.

Last updated by Farrel 7 years ago.

Assigned support staff: Caridad.

Author
Posts
#197376
MappressViews1.jpeg
MappressViews2.jpeg

Hello,

My topic refers to a previous thread who was marked as "resolved" : https://toolset.com/forums/topic/toolset-views-and-mappress/

I have a problem with the code that we had set up and allowed to pass to "Mappress" the query made by "Views".
As a reminder I use "Views" to filter a taxonomy named "Agencies" from two taxonomies "locations" and "services".
The result of the filter displays a list of agencies and points on a map (mappress in mashup mode).
The site is multilingual and managed by WPML.

The problem is as follows:
When the page appears without any filtering is done, Mappress mashup shows in the same map Fr and Uk agencies point. (see MappressViews1.jpeg)
If filtering is performed Uk agencies points disappear and so it resumes normal operation. (see MappressViews2.jpeg)

Have you an idea to pass before filtering the language setting to Mappress?

Thank you for your help.

/Stephane

#197429

Dear Stephane,

It will be much easier to resolve this if you can give me access to your Dashboard. You can send me the credentials using the boxes below the comment area. If you are not comfortable I can setup a test server for you instead.

Regards,
Caridad

#197616

Hi CaridadZ,

Your access are created.
Page concerned Mapress/Views :

(no filters selected, agencies duplicated)
hidden link

(expected behavior)
hidden link /?wpvlocalisation=Zone

#198371

Dear Stephane,

I dont see the MapPress plugin in the WPML compatibility list:

http://wpml.org/documentation/plugins-compatibility/

Have you seen this feature we recently added?

https://toolset.com/documentation/user-guides/map-wordpress-posts/

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Caridad

#198629

Hi Caridad,

indeed it's not in the list ... You provided me a sortcode for the query to be passed from Views to Mappress and it worked very well until now.
View the history of our discussions on the previous thread about my request. (https://toolset.com/forums/topic/toolset-views-and-mappress/)
I understand that you have developed your solution but I can't change the whole system that we have developed. I manage more than 200 offices on the website.

Tell me if you can help me because the system operates at 90%, I just have a problem to isolate markers UK and FR loading the page.

Thank you,

#199071

Dear Stephane,

I will have another look to see what I can do.

Regards,
Caridad

#199536

Dear Stephane,

Im not sure I understand. If you look in the browser error console you can see the SQL query that is being sent to the database. I have tested the SQL query with phpMyAdmin and it works fine, all results are french only.

SELECT   corpo_posts.* FROM corpo_posts   JOIN corpo_icl_translations t ON corpo_posts.ID = t.element_id
                        AND t.element_type IN ('post_agences') JOIN corpo_icl_languages l ON t.language_code=l.code AND l.active=1 WHERE 1=1  AND corpo_posts.ID NOT IN (915) AND corpo_posts.post_type = 'agences' AND (corpo_posts.post_status = 'publish') AND t.language_code='fr'  ORDER BY corpo_posts.post_date DESC  

Can you give me an example of a repeated location in the map so I can double check?

Thanks
Caridad

#201468
good_behavior_of_the_page.jpeg
page_without_filters.jpeg

I Caridad,

If you go to this page without any filtering. :
hidden link

You can see the list of agencies displays links to Fr and Uk agencies.
If you filter solely by "zone" everything works.
See the screenshots provided.

thanks for your help.

/Stéphane

#202570

hello Caridad

I have no news from you ...
Can we change the shortcode to use the language setting when loading the page without the filters being used?

add_shortcode('wpv-post-mashup', 'views_mashup');
function views_mashup($atts) {
global $WP_Views, $mappress;
//var_dump($WP_Views->post_query->query_vars);
$atts['query'] = $WP_Views->post_query->query_vars;
return $mappress->shortcode_mashup($atts);
}

Thank you,

/Stéphane

#205211

Dear Stephane,

Excuse the delay, I have been looking for a solution but it turns out more complicated than I thought. will be looking into your issue later on today and get back to you with any progress I make.

Regards,
Caridad

#207308

Dear Stephane,

I will reply here today with a working solution.

Regards,
Caridad

#207512

Dear Stephane

The trick seems to be adding the following line at mappress_query.php around line 110 (in the query function)

		$query['suppress_filters'] = false;

But if you make the change, it will be overwritten with next update of the plugin. You should contact the plugin author to see if he can included this line too.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Caridad

#207518

Hello Caridad

Thank you for your return. I will test this solution. Meanwhile we have developed a solution based on JQuery.
I'll let you know.

/ Stéphane

#207575

Dear Stephane,

I tried the code our test server and its working fine.
Let me know any problems you find.

Regards,
Caridad

#208100

Hello Caridad

This works perfectly, thank you very much. I will contact Chris Richardson to see if it can reflect the change to the code of the plugin.

Regards,

Stéphane