article order

Phoca Guestbook - creating guestbooks in Joomla! CMS
zerofield
Phoca Member
Phoca Member
Posts: 20
Joined: 17 Sep 2014, 12:34

article order

Post by zerofield »

Dear,

After migrating the review database from our Joomla 2.5 to 3.x I wrote some test messages to see how stuff was taken care of.
Unfortunately I was unable to order all articles based on date. The two items written to the database are always at the end of the ordering(date descending).
In another thread I asked for an explanation of the sql table columns lft rgt and catid.
When I had a good look on the values in these columns I noticed the lft rgt values for each item were ascending upto value 33. The new written items started back again at 3.
After changing these database values ascending from 34 all items were published in the correct order.
So it seems by setting the menu item in the backend to date ascending is actually not ordering items on date but on lft rgt values.
Now when writing an new item in the frontend it gets even worse because it is made child of most recent previous post. All can be corrected in the database, but any suggestions on how can this be changed to function correctly?

Kind regards,
Christopher Witmer
User avatar
Benno
Phoca Hero
Phoca Hero
Posts: 9452
Joined: 04 Dec 2008, 11:58
Location: Germany
Contact:

Re: article order

Post by Benno »

Hi,
did you use this guide for migration: Phoca Guestbook Migration https://www.phoca.cz/documents/50-phoca/ ... o-joomla-3
And if yes, did you follow this guide completely:
Now, items are imported but we need to set the right ordering, run the following SQL queries:
Kind regards,
Benno
zerofield
Phoca Member
Phoca Member
Posts: 20
Joined: 17 Sep 2014, 12:34

Re: article order

Post by zerofield »

Hi Benno,

As I wrote in a different post; yes I did follow some instructions back in November last year. To be honest it looks like instructions have gone through some major modifications. I will give it a new try and let you know the result.
Thanks for pointing me to these new instructions.

Kind regards,
Christopher Witmer
User avatar
Benno
Phoca Hero
Phoca Hero
Posts: 9452
Joined: 04 Dec 2008, 11:58
Location: Germany
Contact:

Re: article order

Post by Benno »

ok.

Kind regards,
Benno

Ps. Christopher Witmer sounds german ??
Falls ja, freundliche Grüße.
zerofield
Phoca Member
Phoca Member
Posts: 20
Joined: 17 Sep 2014, 12:34

Re: article order

Post by zerofield »

So after a failure of making a post which cost me yesterday evening an hour I was asked to login again - and lost my hard work. So here is my second try:

These are my findings:
After installation of the component, the first (and only) row in the phocaguestbook_items table looks like below (id,catid,parent_id,lft,rgt,level,username, date-without time):
1,0,0,0,1,0,ROOT,0000-00-00

After importing the backup table and executing all queries successfully according the link mentioned earlier in this post the table looks like below(first 4 and final row, the rest in between is numbered consecutive):
1,0,0,1,2,0,ROOT,0000-00-00
33,23,1,3,4,1,Dani,2012-09-21
54,23,5,6,1,Thomas,2012-09-27
527,23,1,7,8,1,Maria,2012-11-26
542,23,1,29,30,1,Frank,2014-12-12
With the menu item set to order descending on date(not the manual date) this gives in the front-end from top to bottom: Frank,Maria,Thomas,Dani. Everything fine so far.

Now I make a new post and the first 4 rows and the two final ones are as listed below:
1,0,0,1,4,0,ROOT,0000-00-00
33,23,1,5,6,1,Dani,2012-09-21
54,23,7,8,1,Thomas,2012-09-27
527,23,1,9,10,1,Maria,2012-11-26
542,23,1,31,32,1,Frank,2014-12-12
543,23,1,2,3,1,chris1,2015-03-05
Which gives me in the front-end the order of Frank, Maria,Thomas, Dani,Chris1 where it should be Chris1, Frank, Maria, Dani.

Therefore my conclusion has been and still is somehow the items in the front-end are not ordered on date but on lft/rgt numbers.
Not even talking about what happens if I try to post a reply etc.

Thanks for the effort to read through.

Two notes:
To me it was not clear when multiple queries are shown in one code block I had to split them into single queries and execute them separately to avoid errors.
In step 8 the 1 and the end of the query should be between ‘ ‘ where it is between ` `.

Close call, but no I’m from the Netherlands and sorry but I don’t know any kind of geographical background about my surname. Aber ich verstehe auch ein sehr kleines bischen Deutsch :wink:
zerofield
Phoca Member
Phoca Member
Posts: 20
Joined: 17 Sep 2014, 12:34

Re: article order

Post by zerofield »

Hi,

Well after my structured analysis in my previous post, today I had a bright moment. I realized the core of the problem is in the rgt value for ROOT.
In step 8.2 of the migration instructions the rgt value is set to 1.

This is wrong(if you have imported a couple or more reviews), since the value will be used as an index number for the next new review.
So I can confirm ordering on date is ordering on rgt lft values instead of the actual recorded date.

Fix:
Skip 8.2 and perform the following query after you have executed the final query UPDATE jos_phocaguestbook_items SET rgt= etc..
UPDATE `jos_phocaguestbook_items` SET `catid` = '0' WHERE `id`=`1`; Note, change the 1 at the end for the highest value you can find for rgt in the items database.

Now everything should work like a charm. At least it did for me, including posting replies.

Please update the migration instructions to reflect these findings. If migration instructions are updated, this post can be marked as SOLVED.

Kind regards, Christopher Witmer
Last edited by zerofield on 10 Nov 2015, 23:12, edited 1 time in total.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: article order

Post by Jan »

Ok, thank you for the info.

Jan
If you find Phoca extensions useful, please support the project
Post Reply