Support Forums

Support Offline : Mon - Fri / 10am - 6pm (GMT +6)

Your Time: Our Time:

Sorting Items

Featured Lock Resolved Issue
Hi everyone,

Is it possible to sort the items also by date, i mean to show the latest items first and if so where i can do the changes.

best regards

13 Answers

Rifat Wahid Alif - Staff

More than a month ago #Permalink
Open the following file:


1. /components/com_spsimpleportfolio/models/items.php on 92 no line you will get:


$query->order($order . ' ' . $dir);

replace it by:


$query->order($db->quoteName('created_on') . ' DESC');


2. /modules/mod_spsimpleportfolio/helper.php on 27 no line you will get:


->order($db->quoteName('ordering') . ' ASC')


replace it by:


->order($db->quoteName('created_on') . ' DESC')



- Thanks

Rifat Wahid Alif - Staff

More than a month ago #Permalink
you can order items by created date but if you want to sort items by date then there you have to do to many steps. which is custom work.

- Thanks

sebastianpro

More than a month ago #Permalink
you can order items by created date but if you want to sort items by date then there you have to do to many steps. which is custom work.

- Thanks

I want to sort them by created date so that the latest will be first. I cannot find that option anywhere.

sebastianpro

More than a month ago #Permalink
Open the following file:


1. /components/com_spsimpleportfolio/models/items.php on 92 no line you will get:


$query->order($order . ' ' . $dir);

replace it by:


$query->order($db->quoteName('created_on') . ' DESC');


2. /modules/mod_spsimpleportfolio/helper.php on 27 no line you will get:


->order($db->quoteName('ordering') . ' ASC')


replace it by:


->order($db->quoteName('created_on') . ' DESC')



- Thanks

OK thank you, that works, but when i make an override it doesn't. is there any chance to make it with override.
I tried as follow my template/html/com_spsimpleportfolio/models/items.php and there is no change.
Thank you

Rifat Wahid Alif - Staff

More than a month ago #Permalink
Hi,
You can't overwrite models you can overwrite only template file only.

- Thanks

sebastianpro

More than a month ago #Permalink
Ok thank you very much

Rifat Wahid Alif - Staff

More than a month ago #Permalink
you are always welcome :)

[email protected]

More than a month ago #Permalink
Open the following file:


1. /components/com_spsimpleportfolio/models/items.php on 92 no line you will get:


$query->order($order . ' ' . $dir);

replace it by:


$query->order($db->quoteName('created_on') . ' DESC');


2. /modules/mod_spsimpleportfolio/helper.php on 27 no line you will get:


->order($db->quoteName('ordering') . ' ASC')


replace it by:


->order($db->quoteName('created_on') . ' DESC')



- Thanks


Hello,

The change on the module works perfectly, but in the component there is nothing in line 92, you have something similar on lines 45 and 177.
And if I do the changes on this lines, an error occurs.

Could you please let me know? Find items.php attached.

Thanks for your support

Attachments (1)

  • items.zip 1.9 KB

[email protected]

More than a month ago #Permalink
Open the following file:


1. /components/com_spsimpleportfolio/models/items.php on 92 no line you will get:


$query->order($order . ' ' . $dir);

replace it by:


$query->order($db->quoteName('created_on') . ' DESC');


2. /modules/mod_spsimpleportfolio/helper.php on 27 no line you will get:


->order($db->quoteName('ordering') . ' ASC')


replace it by:


->order($db->quoteName('created_on') . ' DESC')



- Thanks


Hello,

The change on the module works perfectly, but in the component there is nothing in line 92, you have something similar on lines 45 and 177.
And if I do the changes on this lines, an error occurs.

Could you please let me know? Find items.php attached.

Thanks for your support


Finally, I managed to it. I don´t know if its the best way but it works for me. Please correct me if something is wrong.
Thanks

See attachment

Attachments (1)

  • ItemsORdering.png
    ItemsORdering.png 18.5 KB

Rifat Wahid Alif - Staff

More than a month ago #Permalink
Hi,
You should get the error by this code. i saw you used only "id" column for sorting it should be "a.id".

- Thanks

[email protected]

More than a month ago #Permalink
For some reason it works ok for me. But I will have it into consideration. Thank you.

The site is https://pruebas.bolsacfd.es if you want to check.

Rifat Wahid Alif - Staff

More than a month ago #Permalink
oh yes, it's perfect. you are using latest one :)


There are no replies made for this post yet.
Be one of the first to reply to this post!

Leaderboard (30 days)

Sifat

Sifat

Total Accepted Answers: 119
Paul Frankowski

Paul Frankowski

Total Accepted Answers: 110
Toufiq

Toufiq

Total Accepted Answers: 89
Kamruzzaman Alam

Kamruzzaman Alam

Total Accepted Answers: 4
FUTURECLIENT

FUTURECLIENT

Total Accepted Answers: 2

115

Templates

296161

Community Users

Newsletter

Don’t miss any updates of our new templates and extensions and all the astonishing offers we bring for you.
We never spam

Joomla! ® name is used under a limited license from Open Source Matters in the United States and other countries. JoomShaper.com is not affiliated with or endorsed by Open Source Matters or the Joomla! Project.

Connect Us