Change comments order

  • Posts: 7
  • Thank you received: 0
10 years 2 weeks ago #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 "useful" comments to the top.
I've tried to use

sort($elt);
at line 58 right before
for ($i = 1; $i <= count($elt); $i++) {
			if (!empty ($elt[$i]->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 or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 2 weeks ago #150419

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 or Create an account to join the conversation.

  • Posts: 7
  • Thank you received: 0
10 years 2 weeks ago #150512

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:

JHTML::_('select.option', 'date_desc', JText::_('DATE_DESC') )
added to language/en-GB/en-GB.com_hikashop.ini (and other language-files):
DATE_DESC="Date - reverse order"
changed line 89 in components/com_hikashop/views/vote/view.html.php from
}
to
} else if($vote_comment_sort == "date_desc"){
	$order = ' ORDER BY `vote_date` 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 or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 2 weeks ago #150546

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 :)

The following user(s) said Thank You: ballonsportclub

Please Log in or Create an account to join the conversation.

Time to create page: 0.069 seconds
Powered by Kunena Forum