londoh VIP
Total posts: 137
09 Aug 2013 06:13

Hi

as I said elsewhere I'm working on importing records via command line

I'm using joomla cli framework and hacking around contollers/import.php

Good: At this point records are importing ok

Bad: After import I'm creating a problem that causes admin views to fail on a query.

This happens on views for section and type

and the error is in /admin/comp/models/sections.php and types.php

at the end of those models in function getListQuery is this snippet:

        $orderCol = $this->state->get ( 'list.ordering' );

        $orderDirn = $this->state->get ( 'list.direction' );

        $query->order ( $db->escape ( $orderCol . ' ' . $orderDirn ) );

        $query->group('a.id');

'list.ordering' and 'list.direction' arent set so query fails because no order by clause.

@sergey: still searching while I was typing this I found you posted here:

edit: try this...

http://stackoverflow.com/questions/12880159/sorting-columns-in-joomla-populatestate-method

this looks like exactly the problem and I suspect you must know exactly what I'm getting wrong here. any clue please?

Last Modified: 02 Mar 2014


londoh VIP
Total posts: 137
09 Aug 2013 06:15

Sergey
Total posts: 13,748
09 Aug 2013 06:35

It require investigation. I cannot say for sure.

Are you create types and sections during import or it is already created?


londoh VIP
Total posts: 137
09 Aug 2013 10:20

Are you create types and sections during import

no. using already existing

I am however often truncating a lot of tables as I test and I wondered if that messed something up (altho I cant see why)

Obviously all thats missing is ordering and direction for type.php and section.php

These should be set in JModelList->populateState

I ran it thru degugger till I got bored, but cant see the issue.

So I just put in some defaults in section and type.php. This at least lets things work for now. I'll figure it out later.

        $orderCol = $this->state->get ( 'list.ordering' , 'a.name');

        $orderDirn = $this->state->get ( 'list.direction' , 'asc');

(unless you consider ttat a permanent fix)


Sergey
Total posts: 13,748
12 Aug 2013 01:37

I added that to next update.


Guest
12 Aug 2013 02:56

Tnx

Powered by Cobalt