Save and Copy - Ordering Question

Hi there,

We have a client with a long list of products in a CMSB table. They often use the "Save and Copy" feature but are frustrated by the resulting record appearing as the last item on the product list (many pages away).

The list is ordered by dragSortOrder but has gone through some changes in recent weeks due to a previous sorting problem which has since been resolved.

Is there any way we can force the newly copied-n-created record to appear as the first item on the list? Or alongside the parent record?

Thanks,

J.

Hi J. 

I've tried looking into this issue locally, but couldn't recreate the problem, as the items I created always appeared at the top of the list. It might be that you need to change the order items are listed from ascending to descending. You can do that by going to the following page:

Section Editors -> [Section Name] modify link -> Click the sorting tab at the top of the page. This is where you'll find the MySQL order by statement that is used to order the items. 

You might find that your records are currently sorted by:

dragSortOrder ASC

Instead of:

dragSortOrder DESC

Note: Doing this will cause the current order for ALL records to be swapped.

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

Hey J. 

Thanks for sending me more details on the issue. The records were being ordered in ascending order in that section, instead of the default descending order. It's possible to make a small change to the plugin to get around this issue.

On line 43 of saveAndCopy.js.php, add the following code highlighted in green:

  $('#num').val('');
  $('#preSaveTempId').val( pseudoRandomNumber );
  $("input[name='dragSortOrder']").val( '0' );

  // Copy uploads from
  //alert("Debug: Copy uploads from " +recordNum+ " to " +pseudoRandomNumber );
  var copyUploadsUrl = '?_plugin=saveAsCopy&_pluginAction=copy&menu=' +escape

Let me know if you have any questions. 

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com