This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

PolloZen
PolloZen

Hi, I've extends the Rainlab Blog plugin, adding and extra field to the post. "teaCups" This extra fields lives on a separated table (has october documentation recommends), and works great, (this a dumb($post) from Rainlab Post Component on the function listPosts) +hasOne: array:1 [▼ "teacups" => array:1 [▼ 0 => "Test\TeaCups\Models\teacups" ] ] but, when I try to sort the results by "teacups" I get this error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'teacups.teacups' in 'order clause' (SQL: select from rainlab_blog_posts where published is not null and published = 1 and published_at is not null and published_at < 2016-02-11 18:40:24 and (select count() from rainlab_blog_categories inner join rainlab_blog_posts_categories on rainlab_blog_categories.id = rainlab_blog_posts_categories.category_id where rainlab_blog_posts_categories.post_id = rainlab_blog_posts.id and id in (11)) >= 1 and post_type_id in (1) order by rank.stars desc limit 7 offset 0)

when I use this "extra field" on the front end, I just access to this using: $this->page[ 'post' ]->teacup->teacup and works fine... so, How can I sort the results using this extra field?

Thanks a lot.

1-1 of 1

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.