Tips & Tricks using RVM plugin

Share RVM

Hi all, this page to explain some tricks about how to use RVM at its best with current functionality.
I’ll try to cover general questions I’ve gathered from the support page of WordPress forum and via email.

Thanks for your inputs, feedback and for your support to this project!

How can I set bigger dimensions for markers’ pinpoints ?

Is not possible set an absolute dimension for markers’ pinpoints. You’ll be able to see different dimensions just filling the “Dimension” field of at least 2 markers: this because markers’ pinpoints dimensions are relative.

So, what can I do to display them bigger ?

You can use a “trick”  :

  1. create markers you need ( start with a couple ) with a dimension suites your need
  2. create one fake marker with incorrect long and lat ( or not in the map you are using ) and assign it a small dimension…
  3. adjust markers’ dimensions suiting your needs

Soon you’ll see your markers of the desired dimensions on your wonderful RVM map !

I was installing a custom map but I’ve got an error

As said in this page, installing custom map ( a dowloaded one from this site or one you created following the RVM map format ) is an easy task in RVM, especially from ver 5.0 where Media Uploader has been integrated directly into the settings page.

Randomly some users reports issues, probably due to interaction with other plugins ( i.e.: WooCommerce ).

My advice is to:

  1. disable temporarily  other plugins
  2. install the custom map
  3. publish the map
  4. Re.enable all the other plugins

If you went into issue saying “Damned… Something went wrong !  Please check if name of the map is correct ( place just map name)  or if you have uploaded the map previous month and try again uploading map now using wordpress media uploader“, please :

  1. Delete map directory in your wp-uploads directory
  2. Use “Add New Map” > in ‘select map’ field choose  “Add Custom Map”
  3. click on “Select Map” button
  4. Delete old zip file of the map previously installed ( it’s just a reference,  but better cleaning up ) in your Media Library, upload again your custom map ( the zip file )
  5. click on “Install Your Map”
  6. publish

In case above suggestions will not fix it, we need to switch to manual way, like they do for lunar module approach 🙂

First of all, do not panic!

  1. Unzip purchased map and move unzipped map folder into /wp-content/uploads/{current year}/{current month} . If you have not year and month folder please create them.
  2. Check into your Database, in options table (should be wp_options by default), and search for rvm_custom_maps_options field. If you have not, please create it.
  3. If you are attempting to install your first custom map erase the content of rvm_custom_maps_options and replace with

    a:1:{s:{string count}:"{your-map-folder}";s:8:"{aaaa}/{mm}/";}

    where {string count} is the total count of {your-map-folder} ( i.e.: france-districts_mill_en ), {aaaa} year in four digits format and {mm} month in two digits format (i.e.: 2018/05/).
    Save it clicking on submit button.
  4. If you have already other custom maps installed move to last semicolon and curly bracket “;}” of rvm_custom_maps_options and between the semicolon and the curly bracket add

    s:{string count}:"{your-map-folder}";s:8:"{aaaa}/{mm}/";

    where again {string count} is the total count of {your-map-folder} ( i.e.: france-districts_mill_en ), {aaaa} year in four digits format and {mm} month in two digits format (i.e.: 2018/05/).
    Save it clicking on submit button.
  5. Now when you try to add a new map in RVM, you should see your map under Custom map list.

Let’s do a practical example.
Imagine you are trying to install France districts map, and you’ve purchased and downloaded france-districts_mill_en.zip on April 2018.
Now you’ve tried to install the map using the standard method (“Add New Map” —> “Add Custom Map” —> select the france-districts_mill_en.zip via the RVM media uploader —> “Install Map”) but something did not work.

You followed all the steps sent along with the purchase email confirmation but no way to install it.

Unzip purchased map and move unzipped map folder into /wp-content/uploads/2018/04.
If you have not current year and month folder please create them.

  1. Check into your Database, in options table (should be wp_options by default), and search for rvm_custom_maps_options field. If you have not, please create it.
  2. If you are attempting to install your first custom map erase the content of rvm_custom_maps_options and replace with

    a:1:{s:24:"france-districts_mill_en";s:8:"2018/04/";}

    france-districts_mill_en is 24 characters length, while 2018/04/ is 8 characters length.
    Save it clicking on submit button.
  3. If you have already other custom maps installed your first characters should be an a, followed by a number, something likea{integer-number}where {integer-number} is the total number of custom maps you’ve already installed.
    So in case you have a1, means you have 1 map, a2 2 maps and so on.
    Imagine you have already installed map of Africa ( africa_mill_en.zip ) on March 2018, in your rvm_custom_maps_options field you should have


    a:1:{s:14:"africa_mill_en";s:8:"2018/03/";}

    Now move to last semicolon and curly bracket “;}” and add following :


    s:24:"france-districts_mill_en";s:8:"2018/04/";

    Your rvm_custom_maps_options should look like the following:


    a:2:{s:14:"africa_mill_en";s:8:"2018/03/";s:24:"france-districts_mill_en";s:8:"2018/04/";}

    Save it clicking on submit button.
  4. When you try to add a new map in RVM, you should see your map under Custom map list.

In order to count total characters in map name I’ve used
https://wordcounter.net/
but feel free to use your favourite online tool !

How get rid of subdivisions’ name on mouse hover

This will be integrated in future RVM version, but in the meanwhile, if you cannot wait, this is a solution.

You do not need specifc php or javascript knowledge, just follow these steps accurately:

open responsive-vecto-maps > includes > rvm_shortcode.php

Backup it in case an issue occurs and just to be sure:

and just after :

// Region label popup
if ( isset( $output_is_regions_popup ) && $output_is_regions_popup ) {
$output .= ', onRegionTipShow : function(event, label, code){';
$output .= 'if(!region_popup.hasOwnProperty(code)) {';
// no text found, return standard state name
$output .= 'return true ;';
$output .= '}';
// else construct label for state with extra text
$output .= 'label.html(label.html() + "<br/>"  + region_popup[code]); ';
$output .= ' }';

} //isset($output_is_regions_popup) && $output_is_regions_popup

add

else {
$output .= ', onRegionTipShow : function(event, label, code){';
$output .= 'event.preventDefault();';
$output .= ' }';
}

this way we stop the label show event.

Please remember that any further update of the plugin will erase this behavior, so you’ll need manually placing this code ( unless I will include this feature…) !

Translate subdivisions’ names on front end ( visible map on your site )

If you are trying to change names of a default map coming with RVM , please following these easy steps:

you need to edit the corresponding javascript file inside

responsive-vector-maps > js > regions-data .
Open map you need to update with your favorite editor.

I.e: in order to change Belgium subdivision names, open jquery-jvectormap-be_merc_en.js and replace names you would like to change in your language.

For special characters maybe encoding needed.
You can have a look at Javascript character encoding for further details about encoding ( thanks prodefu ).

If you are trying to change names of a custom map downloaded from this site, please following these easy steps:

search for map you would like to update inside the wordpress “wp-content” > “uploads” folder

In the folder you’ll find two files, open the javascript file ( ending with “.js” ) and repeat same steps used for the default maps above .

Translate subdivisions’ names on subdivisions settings tab

In order to modify the default maps coming with RVM, please open corresponding map you need to modify in following location:

responsive-vector-maps > includes > regions 

Ie.: to modify Belgium subdivisions’ names, open belgium-regions.php with your favourite editor and change only the last item of the array ( ‘Brussels’ in case of first row ).

If you want to modify a custom map downloaded from this site, please search for map you would like to update inside the wordpress “wp-content” > “uploads” folder

and open the rvm-cm-settings.php .

Open it and  update only the last element of the array ( same as we did above for settings ).

Number of markers can be saved

If you are trying to save a big amount of markers, may happen you see they are not saved from a certain number onward.

Inserting manually into DB it works… so what ?

Newer versions of PHP , by default, are set to accept only one thousand of parameters sent by a form.

Considering the fact that main settings, subdivisions  and markers fields are sent as a whole, it means that unfortunately you reached this quota !

I tried this plugin : https://wordpress.org/plugins/wp-max-submit-protect/

which basically alerts you when this limit is reached.

Here an explanation on how to solve it via php.ini or via htaccess file.

Newer versions of PHP implement a php.ini directive called max_input_vars usually set to 1000. This means that posting > 1000 form fields for instance would be truncated  preventing data from being saved.

This can be changed in php.ini:

max_input_vars = 2000

If you need to do this via htaccess (on a shared host for instance) you may use:

php_value max_input_vars 2000

This is the page where I’ve got the workaround above : http://docs.woothemes.com/document/problems-with-large-amounts-of-data-not-saving-variations-rates-etc/ ).

Please let me know if you are able to solve it.

 

If you can, please give a hand to this project to fly !




 

Share RVM

Stop using area tag!