enhance externalModules page (#33948)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
9194e4f12f
commit
baa08bad7b
1 changed files with 7 additions and 16 deletions
|
|
@ -372,22 +372,7 @@ class ExternalModules
|
|||
$this->numberTotalOfPages = (int) ceil(max($fileProductsTotal / $this->per_page, $dolistoreProductsTotal / $this->per_page));
|
||||
|
||||
// merge both sources
|
||||
$this->products = array_values(array_merge($dolistoreProducts, $fileProducts));
|
||||
|
||||
// Sort products list by datec
|
||||
usort(
|
||||
$this->products,
|
||||
/**
|
||||
* Compare creation dates
|
||||
*
|
||||
* @param array<string, mixed> $a First product for comparison.
|
||||
* @param array<string, mixed> $b Second product for comparison.
|
||||
* @return int
|
||||
*/
|
||||
static function ($a, $b) {
|
||||
return strtotime($b['datec'] ?? '0') - strtotime($a['datec'] ?? '0');
|
||||
}
|
||||
);
|
||||
$this->products = array_values(array_merge($fileProducts, $dolistoreProducts));
|
||||
|
||||
$i = 0;
|
||||
foreach ($this->products as $product) {
|
||||
|
|
@ -628,6 +613,9 @@ class ExternalModules
|
|||
} else {
|
||||
$sub = 0;
|
||||
}
|
||||
if (!empty($this->search)) {
|
||||
$param_array['search_keyword'] = $this->search;
|
||||
}
|
||||
$param_array['no_page'] = $this->no_page - $sub;
|
||||
if ($this->categorie != 0) {
|
||||
$param_array['categorie'] = $this->categorie;
|
||||
|
|
@ -651,6 +639,9 @@ class ExternalModules
|
|||
} else {
|
||||
$add = 1;
|
||||
}
|
||||
if (!empty($this->search)) {
|
||||
$param_array['search_keyword'] = $this->search;
|
||||
}
|
||||
$param_array['no_page'] = $this->no_page + $add;
|
||||
if ($this->categorie != 0) {
|
||||
$param_array['categorie'] = $this->categorie;
|
||||
|
|
|
|||
Loading…
Reference in a new issue