|

How To Sort The Database By Date
Posted 17 April 2015 - 09:53 PM #1
Does someone can show me how to sort the database by recent date please?
My website is multivendor with 4.2.3
Thank in advance!
Franck
Posted 20 April 2015 - 09:39 AM #2
$backup_files = fn_sort_array_by_key($backup_files, 'create');
before this one:
Registry::get('view')->assign('backup_files', $backup_files);
GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart USD 1210 Multi-Vendor USD 1250 Multi-Vendor PLUS USD 3100 (2775)
CS-Cart Ultimate USD 4025 CS-Cart + YOUPI USD 1459 Multi-Vendor Ultimate USD 7500 (6000)
Posted 20 April 2015 - 06:01 PM #3
Dear, I have change like this: </p>Please open the app\controllers\backend\database.php file and add this line:
$backup_files = fn_sort_array_by_key($backup_files, 'create');before this one:Registry::get('view')->assign('backup_files', $backup_files);
<div> }</div>
<div> }</div>
<div> </div>
<div>$backup_files = fn_sort_array_by_key($backup_files, 'create');</div>
<div> Registry::get('view')->assign('backup_files', $backup_files);</div>
<div> </div>
<div>But it s can not sort by recent date, I have clear the cach too, may be something wrong?</div>
<div> </div>
<div>Thanks</div>
Posted 21 April 2015 - 06:30 AM #4
One Step Checkout Addon - The ultimate checkout experience
Best CS-Cart SEO addon - CS-Cart SEO Ultimate Addon
PM for 365-day support and custom development service
Posted 21 April 2015 - 08:54 AM #5
Sincerely yours,
CS-Market.
GET A FREE QUOTE │ CS-Cart add-ons │ CS-Cart custom development │ CS-Cart design integration │ CS-Cart license
Сертифицированный разработчик на CS-Cart Русская Версия. More than 8 years experience in CS-Cart development.
Posted 21 April 2015 - 12:19 PM #6
Replace:
if (is_array($files)) { foreach ($files as $file) { $backup_files[$file]['size'] = filesize(Registry::get('config.dir.database') . $file); $backup_files[$file]['type'] = strpos($file, '.tgz')===false ? 'sql' : 'tgz'; $backup_files[$file]['create'] = fn_date_format(filemtime(Registry::get('config.dir.database') . $file), $date_format); } } Registry::get('view')->assign('backup_files', $backup_files);
with
if (is_array($files)) { foreach ($files as $file) { $backup_files[$file]['size'] = filesize(Registry::get('config.dir.database') . $file); $backup_files[$file]['type'] = strpos($file, '.tgz')===false ? 'sql' : 'tgz'; $backup_files[$file]['create'] = fn_date_format(filemtime(Registry::get('config.dir.database') . $file), $date_format); $backup_files[$file]['date'] = filemtime(Registry::get('config.dir.database') . $file); } } $backup_files = fn_sort_array_by_key($backup_files, 'date'); Registry::get('view')->assign('backup_files', $backup_files);
GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart USD 1210 Multi-Vendor USD 1250 Multi-Vendor PLUS USD 3100 (2775)
CS-Cart Ultimate USD 4025 CS-Cart + YOUPI USD 1459 Multi-Vendor Ultimate USD 7500 (6000)
Posted 21 April 2015 - 05:49 PM #7
Dear EcomlabsPlease try the following solution:
Replace:if (is_array($files)) { foreach ($files as $file) { $backup_files[$file]['size'] = filesize(Registry::get('config.dir.database') . $file); $backup_files[$file]['type'] = strpos($file, '.tgz')===false ? 'sql' : 'tgz'; $backup_files[$file]['create'] = fn_date_format(filemtime(Registry::get('config.dir.database') . $file), $date_format); } } Registry::get('view')->assign('backup_files', $backup_files);
withif (is_array($files)) { foreach ($files as $file) { $backup_files[$file]['size'] = filesize(Registry::get('config.dir.database') . $file); $backup_files[$file]['type'] = strpos($file, '.tgz')===false ? 'sql' : 'tgz'; $backup_files[$file]['create'] = fn_date_format(filemtime(Registry::get('config.dir.database') . $file), $date_format); $backup_files[$file]['date'] = filemtime(Registry::get('config.dir.database') . $file); } } $backup_files = fn_sort_array_by_key($backup_files, 'date'); Registry::get('view')->assign('backup_files', $backup_files);
It's work for old > recent, can you show me how to make recent date > old date please?
Thank very much
Franck
Posted 22 April 2015 - 08:52 AM #8
It's work for old > recent, can you show me how to make recent date > old date please?
Please try:
$backup_files = fn_sort_array_by_key($backup_files, 'date', SORT_DESC);
GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart USD 1210 Multi-Vendor USD 1250 Multi-Vendor PLUS USD 3100 (2775)
CS-Cart Ultimate USD 4025 CS-Cart + YOUPI USD 1459 Multi-Vendor Ultimate USD 7500 (6000)
Posted 22 April 2015 - 05:31 PM #9
thank very much, it's work now.Please try:
$backup_files = fn_sort_array_by_key($backup_files, 'date', SORT_DESC);
Posted 23 April 2015 - 09:06 AM #10
GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart USD 1210 Multi-Vendor USD 1250 Multi-Vendor PLUS USD 3100 (2775)
CS-Cart Ultimate USD 4025 CS-Cart + YOUPI USD 1459 Multi-Vendor Ultimate USD 7500 (6000)