Jump to content

Sorting DB Fields in admin


Claudia M

Recommended Posts

What does this portion of admin/sources/products.index.inc.php do?  If I add new columns to the inventory database do I have to add info here too? Thanks in advance for all help.  Me

 

// Sorting

               $current_page = currentPage(array('sort'));

               if (!isset($_GET['sort']) || !is_array($_GET['sort'])) {

                              $_GET['sort'] = array('updated' => 'DESC');

               }

               $thead_sort = array (

                              'status'   => $GLOBALS['db']->column_sort('status', $lang['common']['status'], 'sort', $current_page, $_GET['sort']),

                              'digital'   => $GLOBALS['db']->column_sort('digital', $lang['common']['type'], 'sort', $current_page, $_GET['sort']),

                              'image'   => $lang['catalogue']['title_image'],

                              'name'    => $GLOBALS['db']->column_sort('name', $lang['catalogue']['product_name'], 'sort', $current_page, $_GET['sort']),

                              'product_code'  => $GLOBALS['db']->column_sort('product_code', $lang['catalogue']['product_code'], 'sort', $current_page, $_GET['sort']),

                              'price'   => $GLOBALS['db']->column_sort('price', $lang['common']['price'], 'sort', $current_page, $_GET['sort']),

                              'stock_level'  => $lang['catalogue']['title_stock'],

                              'updated'   => $GLOBALS['db']->column_sort('updated', $lang['catalogue']['title_last_updated'], 'sort', $current_page, $_GET['sort']),

                              'translations'  => $lang['translate']['title_translations']

               );

 

               foreach ($GLOBALS['hooks']->load('admin.product.table_head_sort') as $hook) include $hook;

 

               $GLOBALS['smarty']->assign('THEAD', $thead_sort);

Link to comment
Share on other sites

Essentially, this creates the links that the up/down triangles in the table listing (of products and elsewhere) column headers will instruct CubeCart to sort by that column.

If you want to sort by any additional table column header, new or derived, you will want to add an element to the $thead_sort array - as well as the skin changes.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...