Drag and drop sorting isn't working (v. 2.9x)
If your drag and drop sorting isn't working:
-
Check Files: Make sure you are using the latest system release.
-
Check Mods: Do not include any customizations, modifications or other scripts while checking.
-
Check PHP: The system requires, at minimum, PHP 5.3.7. PHP 5.5 or higher is strongly recommended. If you are using an older version of PHP, the json_decode value will not work properly. See PHP End of Life Versions
- Change AJAX to POST: If your client has a lot of categories, and PHP is set to not allow long strings, the sorting may not work due to the string length. Upgrade to the latest release to correct this, or use the following instructions to change the methodology to POST.
-
Open the nestable.php file in the /includes/ folder of the /storeadmin/ folder
-
Change the line:
$jsonDecoded = json_decode($_GET['jsonstring'], true, 99);
to:
$jsonDecoded = json_decode(stripslashes($_POST['jsonstring']), true, 99);
-
Change the line:
$file_type = preg_replace("/[^a-z]+/", "", strtolower($_GET['filetyp']));to:
$file_type = preg_replace("/[^a-z]+/", "", strtolower($_POST['filetyp'])); -
Open the nestabledb.js file in the /includes/ folder of the /storeadmin/ folder
-
Replace all the code on that page with:
function menu_updatesort(jsonstring, ajaxpg) { try { ajaxRequest = new XMLHttpRequest(); // Firefox, Opera, ... } catch(err1) { try { ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); // Noen IE v. } catch(err2) { try { ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); // Noen IE v. } catch(err3) { ajaxRequest = false; } } } var nesturl = "includes/nestable.php"; var nestparams = "filetyp=" + ajaxpg +"&jsonstring=" + jsonstring + "&rand=" + Math.random()*9999; ajaxRequest.open("POST", nesturl, true); ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); ajaxRequest.send(nestparams); }