Display your products by stock

To display your products list by stock, modify function fn_get_products_sorting in fn.catalog.php and replace this in function fn_get_products_sorting :



```php

‘popularity’ => array(‘description’ => fn_get_lang_var(‘popularity’), ‘default_order’ => ‘desc’)

```



by



```php

‘popularity’ => array(‘description’ => fn_get_lang_var(‘popularity’), ‘default_order’ => ‘desc’),

‘amount’ => array(‘description’ => fn_get_lang_var(‘in_stock’), ‘default_order’ => ‘desc’)

```



You can add more Sorting with



```php

‘code’ => ‘products.product_code’,

‘status’ => ‘products.status’,

‘product’ => ‘descr1.product’,

‘position’ => ‘products_categories.position’,

‘price’ => ‘prices.price’,

‘list_price’ => ‘products.list_price’,

‘weight’ => ‘products.weight’,

‘amount’ => ‘products.amount’,

‘timestamp’ => ‘products.timestamp’,

‘popularity’ => ‘popularity.total’,

‘company’ => ‘company_name’,

```

Any screenshot ?

check the page : [url]http://tinyurl.com/3h8jdz8[/url]

but i think in cscart we can also able to hide out of stock products, than why this mod required ?

it’s not necessary, but if someone want to display in first the products in the stock to encourage people to buy your products avalaible, it’s possible. Not necessary it’s depends on your business

I have on my product table one field called sa_message_id and I would like to be able to sort product by it on customer view.





How can I put it sorting my sa_message_id the adicional field that I have in my product tables?



Thanks in advance.

[quote name='miguelboy78' timestamp='1309788284' post='116232']

I have on my product table one field called sa_message_id and I would like to be able to sort product by it on customer view.





How can I put it sorting my sa_message_id the adicional field that I have in my product tables?



Thanks in advance.

[/quote]





Just do similar to my exemple for stock, add your variable for sa_message_id as



'message' => array('message' => fn_get_lang_var('my_message'), 'default_order' => 'desc')

'message' => 'descr1.sa_message_id',

my function is like this:



$sorting = array(

‘position’ => array(‘description’ => fn_get_lang_var(‘default’), ‘default_order’ => ‘asc’),

‘product’ => array(‘description’ => fn_get_lang_var(‘name’), ‘default_order’ => ‘asc’),

‘price’ => array(‘description’ => fn_get_lang_var(‘price’), ‘default_order’ => ‘asc’),

‘popularity’ => array(‘description’ => fn_get_lang_var(‘popularity’), ‘default_order’ => ‘desc’),

‘message’ => array(‘description’ => fn_get_lang_var(‘shipping_availability’), ‘default_order’ => ‘asc’),

‘message’ => ‘descr1.sa_message_id’



However, it is not working. When I try to sort the options are as this image:







even if I put exactly the code you gave me the options will be the same =S and in the status bar it is like this:



http://localhost/cscart/index.php?dispatch=categories.view&category_id=153&sort_by=message&sort_order=d



How can I put this working?



Thanks

Just to make sure that I was not doind anything wrong I tried to sort by company_name using the code:

'company' => 'company_name',



And just happend the same thing…



please, if you know how I can fix this tell me.



Thanks

[color=#000000][font=Arial, sans-serif][size=4]Thanks, excellent addition![/size][/font][/color]



[color=#000000][font=Arial, sans-serif][size=4]But there is a problem with the f[/size][/font][/color]eatures [color=#000000][font=Arial, sans-serif][size=4]of the product on the detailed page[/size][/font][/color]

[color=#000000][font=Arial, sans-serif][size=4]Some features disappear, others appear all at once :confused:[/size][/font][/color][color=#000000][font=Arial, sans-serif][size=4] [/size][/font][/color]

[color=#000000][font=Arial, sans-serif][size=4]Why did it happen?[/size][/font][/color]

[color=#000000][font=Arial, sans-serif][size=4]Someone can help me? So please…[/size][/font][/color]