Skip to content

Commit e71179a

Browse files
committed
6337-featured-post-order
1 parent 89d593c commit e71179a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Block/Sidebar/Featured.php

+15
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,21 @@ protected function _preparePostCollection()
3131
$this->_postCollection->addPostsFilter(
3232
$this->getPostIdsConfigValue()
3333
);
34+
35+
$ids = [];
36+
foreach (explode(',', $this->getPostIdsConfigValue()) as $id) {
37+
$id = (int)trim($id);
38+
if ($id) {
39+
$ids[] = $id;
40+
}
41+
}
42+
43+
if ($ids) {
44+
$ids = implode(',', $ids);
45+
$this->_postCollection->getSelect()->order(
46+
new \Zend_Db_Expr('FIELD(`main_table`.`post_id`,' . $ids .')')
47+
);
48+
}
3449
}
3550

3651
/**

0 commit comments

Comments
 (0)