View Single Post
  #3  
Old 01-21-2008, 12:29 PM
 
poil11 poil11 is offline
 

Newbie
  
Join Date: Jan 2008
Posts: 4
 

Default Re: Add Extra options to Sort By in products list V4.x.x

Hi, new to x-cart, I have made this possible to work with 4.1.9, but i don't know where to add it to the template file to make it show up in the sort options. Or how to add it to the default listing in the admin menus. Can anyone help a bit more with this?
includes/search.php, added add_date line:
PHP Code:
$sort_fields = array(
    
"productcode"     => func_get_langvar_by_name("lbl_sku"),
    
"title"         => func_get_langvar_by_name("lbl_product"),
    
"price"         => func_get_langvar_by_name("lbl_price"),
    
"orderby"        => func_get_langvar_by_name("lbl_default"),
    
"add_date"        => func_get_langvar_by_name("lbl_add_date")
); 

Added add_date stuff:

PHP Code:
$current_area == 'B') && $data["sort_field"] == 'productcode')
            
$data["sort_field"] = 'orderby';

        switch (
$data["sort_field"]) {
            case 
"productcode":
                
$sort_string "$sql_tbl[products].productcode $direction";
                break:
case 
"add_date":
                
$sort_string "$sql_tbl[products].add_date $direction";
                break; 

includes/func/func.products.php


Added add_date stuff:

PHP Code:
if (is_null($orderby_rules)) {
        
$orderby_rules = array (
            
"title" => "product",
            
"quantity" => "$sql_tbl[products].avail",
            
"orderby" => "$sql_tbl[products_categories].orderby",
            
"quantity" => "$sql_tbl[products].avail",
            
"price" => "price",
            
"add_date" =>     "$sql_tbl[products].add_date",
            
"productcode" => "$sql_tbl[products].productcode");
    } 

Ahhhh i had to add the language file lbl_add_date, done...
__________________
4.1.9
Reply With Quote