[Skip to main content](#vessel-content)

#   Change comments order

##

- **[ballonsportclub](/forum/user/30773-ballonsportclub "View ballonsportclub's Profile")**
- [![ballonsportclub's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar30773.png)](/forum/user/30773-ballonsportclub "View ballonsportclub's Profile") Topic Author
- [ Offline](/forum/user/30773-ballonsportclub)

Less More

- Posts: 7
- Thank you received: 0
-
-

12 years 7 months ago [\#150378](#150378) by [ballonsportclub](/forum/user/30773-ballonsportclub "View ballonsportclub's Profile")  *[Change comments order](/forum/42-vote/867079-change-comments-order#150378 "-- url of the page with the problem -- : not public atm -- HikaShop version -- : Business 2.3.0 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.21  Comments in product details page are sorted from oldest (top) to newest (bottom). Is it possible to change the order of the comments and bring the newest to the top? The only option in configuration i've found, is to bring the &quot;useful&quot; comments to the top. I've tried to use  at line 58 right before  in vote/listing.php The comments are sorted in the wanted order but one comment is not shown (e.g. after setting sort($elt); only 3 of 4 comments are visible)  Could you please give me a advice to change the order?  THX Michael")* was created by *[ballonsportclub](/forum/user/30773-ballonsportclub "View ballonsportclub's Profile")*

-- url of the page with the problem -- : not public atm
-- HikaShop version -- : Business 2.3.0
-- Joomla version -- : 3.2.3
-- PHP version -- : 5.3.21

Comments in product details page are sorted from oldest (top) to newest (bottom).
Is it possible to change the order of the comments and bring the newest to the top?
The only option in configuration i've found, is to bring the "useful" comments to the top.
I've tried to use Code:

sort($elt);

at line 58 right before Code:

for ($i = 1; $i &lt;= count($elt); $i++) { if (!empty ($elt[$i]-&gt;vote_comment)) {

in vote/listing.php
The comments are sorted in the wanted order but one comment is not shown (e.g. after setting sort($elt); only 3 of 4 comments are visible)

Could you please give me a advice to change the order?

THX
Michael

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQyLXZvdGUvODY3MDc5LWNoYW5nZS1jb21tZW50cy1vcmRlcj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

12 years 7 months ago [\#150419](#150419) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Change comments order](/forum/42-vote/867079-change-comments-order#150419 "-- url of the page with the problem -- : not public atm -- HikaShop version -- : Business 2.3.0 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.21  Comments in product details page are sorted from oldest (top) to newest (bottom). Is it possible to change the order of the comments and bring the newest to the top? The only option in configuration i've found, is to bring the &quot;useful&quot; comments to the top. I've tried to use  at line 58 right before  in vote/listing.php The comments are sorted in the wanted order but one comment is not shown (e.g. after setting sort($elt); only 3 of 4 comments are visible)  Could you please give me a advice to change the order?  THX Michael")*

Hi,

You will have to edit the file "components/com_hikashop/views/vote/view.html.php" and in the function "listing()" replace the "ASC" by "DSC" in the MySQL requests.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQyLXZvdGUvODY3MDc5LWNoYW5nZS1jb21tZW50cy1vcmRlcj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[ballonsportclub](/forum/user/30773-ballonsportclub "View ballonsportclub's Profile")**
- [![ballonsportclub's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar30773.png)](/forum/user/30773-ballonsportclub "View ballonsportclub's Profile") Topic Author
- [ Offline](/forum/user/30773-ballonsportclub)

Less More

- Posts: 7
- Thank you received: 0
-
-

12 years 7 months ago [\#150512](#150512) by [ballonsportclub](/forum/user/30773-ballonsportclub "View ballonsportclub's Profile")  Replied by *[ballonsportclub](/forum/user/30773-ballonsportclub "View ballonsportclub's Profile")* on topic *[Change comments order](/forum/42-vote/867079-change-comments-order#150512 "-- url of the page with the problem -- : not public atm -- HikaShop version -- : Business 2.3.0 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.21  Comments in product details page are sorted from oldest (top) to newest (bottom). Is it possible to change the order of the comments and bring the newest to the top? The only option in configuration i've found, is to bring the &quot;useful&quot; comments to the top. I've tried to use  at line 58 right before  in vote/listing.php The comments are sorted in the wanted order but one comment is not shown (e.g. after setting sort($elt); only 3 of 4 comments are visible)  Could you please give me a advice to change the order?  THX Michael")*

Thanks Xavier,

I had hoped for a less invasive way (I guess i have to change it again after installing an update).

Or is it possible, to include this option in the next version? In my opinion, the changes are not so big.
Here is what I did:
added new line in administrator/components/com_hikashop/views/config/tmpl/features.php after line 157: Code:

JHTML::_('select.option', 'date_desc', JText::_('DATE_DESC') )

added to language/en-GB/en-GB.com_hikashop.ini (and other language-files): Code:

DATE_DESC="Date - reverse order"

changed line 89 in components/com_hikashop/views/vote/view.html.php from Code:

}

to Code:

} else if($vote_comment_sort == "date_desc"){ $order = ' ORDER BY &#96;vote_date&#96; DESC'; }

Did I miss anything?
(beside the fact that my code change will not work in combination with the option to sort comments by visitors. For this, additional changes would be necessary but i don't use this option.)

THX
Michael

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQyLXZvdGUvODY3MDc5LWNoYW5nZS1jb21tZW50cy1vcmRlcj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

12 years 7 months ago [\#150546](#150546) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Change comments order](/forum/42-vote/867079-change-comments-order#150546 "-- url of the page with the problem -- : not public atm -- HikaShop version -- : Business 2.3.0 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.21  Comments in product details page are sorted from oldest (top) to newest (bottom). Is it possible to change the order of the comments and bring the newest to the top? The only option in configuration i've found, is to bring the &quot;useful&quot; comments to the top. I've tried to use  at line 58 right before  in vote/listing.php The comments are sorted in the wanted order but one comment is not shown (e.g. after setting sort($elt); only 3 of 4 comments are visible)  Could you please give me a advice to change the order?  THX Michael")*

Hi,

I have added these modifications on our end, by this way it will be available by default in the next package.
Thanks to have shared your solution ![:)](/media/kunena/emoticons/3.png ":)")

The following user(s) said Thank You: [ballonsportclub](/forum/user/30773-ballonsportclub "View ballonsportclub's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQyLXZvdGUvODY3MDc5LWNoYW5nZS1jb21tZW50cy1vcmRlcj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.054 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
