mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-24 22:11:01 -06:00
#4671 [advs-module] Date sorting is not working properly
This commit is contained in:
parent
1025e4521d
commit
8ea7879cd0
@ -38,6 +38,7 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
$limit = null, $category = null, $city = null, $paginate = true
|
$limit = null, $category = null, $city = null, $paginate = true
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
$isSort = !empty($param['sort_by']);
|
||||||
$isActiveDopings = new AdvModel();
|
$isActiveDopings = new AdvModel();
|
||||||
$isActiveDopings = $isActiveDopings->is_enabled('dopings');
|
$isActiveDopings = $isActiveDopings->is_enabled('dopings');
|
||||||
|
|
||||||
@ -161,11 +162,11 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
$query = $query->whereRaw("ST_DISTANCE(ST_GeomFromText('POINT(" . $param['dlong'] . " " . $param['dlat'] . ")'), coor) < " . $param['distance']);
|
$query = $query->whereRaw("ST_DISTANCE(ST_GeomFromText('POINT(" . $param['dlong'] . " " . $param['dlat'] . ")'), coor) < " . $param['distance']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isActiveDopings) {
|
if ($isActiveDopings && !$isSort) {
|
||||||
$query = app('Visiosoft\DopingsModule\Http\Controller\DopingsController')->search($query, $param);
|
$query = app('Visiosoft\DopingsModule\Http\Controller\DopingsController')->search($query, $param);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($param['sort_by'])) {
|
if ($isSort) {
|
||||||
switch ($param['sort_by']) {
|
switch ($param['sort_by']) {
|
||||||
case "popular":
|
case "popular":
|
||||||
$query = $query->orderBy('advs_advs.count_show_ad', 'desc');
|
$query = $query->orderBy('advs_advs.count_show_ad', 'desc');
|
||||||
@ -177,10 +178,10 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
$query = $query->orderBy('advs_advs.price', 'asc');
|
$query = $query->orderBy('advs_advs.price', 'asc');
|
||||||
break;
|
break;
|
||||||
case "sort_time_newest":
|
case "sort_time_newest":
|
||||||
$query = $query->orderBy('advs_advs.created_at', 'desc');
|
$query = $query->orderBy('advs_advs.publish_at', 'desc');
|
||||||
break;
|
break;
|
||||||
case "sort_time_oldest":
|
case "sort_time_oldest":
|
||||||
$query = $query->orderBy('advs_advs.created_at', 'asc');
|
$query = $query->orderBy('advs_advs.publish_at', 'asc');
|
||||||
break;
|
break;
|
||||||
case "address_a_z":
|
case "address_a_z":
|
||||||
$query = $query->join('location_cities_translations', 'advs_advs.city', '=', 'location_cities_translations.entry_id')
|
$query = $query->join('location_cities_translations', 'advs_advs.city', '=', 'location_cities_translations.entry_id')
|
||||||
@ -201,7 +202,7 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
$query = $query->orderBy('advs_advs.created_at', 'desc');
|
$query = $query->orderBy('advs_advs.created_at', 'desc');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isActiveDopings) {
|
if ($isActiveDopings && !$isSort) {
|
||||||
$query = app('Visiosoft\DopingsModule\Http\Controller\DopingsController')->querySelect($query, $param);
|
$query = app('Visiosoft\DopingsModule\Http\Controller\DopingsController')->querySelect($query, $param);
|
||||||
} else {
|
} else {
|
||||||
$query = $query->select('advs_advs.*', 'advs_advs_translations.name as name',
|
$query = $query->select('advs_advs.*', 'advs_advs_translations.name as name',
|
||||||
|
|||||||
@ -22,8 +22,6 @@ use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
|
|||||||
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
|
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
|
||||||
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationRepositoryInterface;
|
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationRepositoryInterface;
|
||||||
use Visiosoft\AdvsModule\OptionConfiguration\OptionConfigurationModel;
|
use Visiosoft\AdvsModule\OptionConfiguration\OptionConfigurationModel;
|
||||||
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
|
|
||||||
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
|
|
||||||
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
||||||
use Visiosoft\LocationModule\City\CityModel;
|
use Visiosoft\LocationModule\City\CityModel;
|
||||||
use Visiosoft\LocationModule\City\CityRepository;
|
use Visiosoft\LocationModule\City\CityRepository;
|
||||||
@ -218,7 +216,7 @@ class AdvsController extends PublicController
|
|||||||
'list', $param, $customParameters, null, $category, $cityId, false
|
'list', $param, $customParameters, null, $category, $cityId, false
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($isActiveDopings) {
|
if ($isActiveDopings && empty($param['sort_by'])) {
|
||||||
$featuredAdvsQuery = clone $advs;
|
$featuredAdvsQuery = clone $advs;
|
||||||
$response__featured_doping = app('Visiosoft\DopingsModule\Http\Controller\DopingsController')
|
$response__featured_doping = app('Visiosoft\DopingsModule\Http\Controller\DopingsController')
|
||||||
->listFeatures($featuredAdvsQuery);
|
->listFeatures($featuredAdvsQuery);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user