J2Store has a free module to display products ordered by some parameters like Latest added, Cost, Best-selling that can be download via below link:
It's a useful module but there are some tiny problems :
1 Sort products by latest modified
“Product descending” or latest product shows just latest added, not latest modified. This sort can be important if you have digital goods (files). Basically you don’t create a new page and edit current one.
Anyway if you need this sort, open below file and go to line (196) :
modules\mod_j2products\library\source\joomla.php
Then change this code :
case 'desc':
$sortby = 'p.j2store_product_id DESC';
To:
case 'desc':// sort based on modified date
$sortby = 'p.modified_on DESC';
Now in module edit page, if you select “latest product” the list will be sorted by latest modified date. Of course you can use this change for any other case like art_desc as you like.
2 Correct "User Select Products" order
In this module you can select some fixed products to show. But if you use this option, you will be find out soon that order of products in backend isn’t like frontend!
It’s because J2store database query (maybe a bug). If you want to correct it, open below file:
It’s because J2store database query (maybe a bug). If you want to correct it, open below file:
modules\mod_j2products\helper.php
Then before "break" in line 189 change this code:
$product_ids = array_slice($product_ids, 0, $limit+1);
break;
To:
$product_ids = array_slice($product_ids, 0, $limit+1);
//re-arrange based on user sort
foreach ($params_product_ids as $usrsrt) {
if(in_array($usrsrt,$product_ids))
$finalsort[]=$usrsrt;
}
$product_ids=$finalsort;
break;
Or an easy way? you can install modified version through download box: