Skip to content

Commit

Permalink
#20 - Also add proper gridview sorting to categories sections
Browse files Browse the repository at this point in the history
  • Loading branch information
Moc committed Dec 16, 2022
1 parent 08e5638 commit 29cb7f5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cookbook_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ public function renderCategory($data, $parm = array())
$this->caption = LAN_CATEGORY." - ".$category_name;

// Retrieve all recipe entries within this category
$recipes = $sql->retrieve('cookbook_recipes', '*', 'r_category = '.$category_id.'', true);
$order = e107::getPlugPref('cookbook', 'gridview_sortorder', 'desc');
$recipes = $sql->retrieve('cookbook_recipes', '*', 'r_category = '.$category_id.' ORDER BY r_datestamp '.$order, true);

$cUrlparms = array(
"c_id" => $category_id,
Expand Down Expand Up @@ -392,7 +393,8 @@ public function renderCategories()
$text .= "<h3>".$category['c_name']."</h3>"; // TODO get rid of hardcoded styling

// Retrieve all recipe entries for this category
$recipes = $sql->retrieve('cookbook_recipes', '*', 'r_category = '.$category["c_id"].'', TRUE);
$order = e107::getPlugPref('cookbook', 'gridview_sortorder', 'desc');
$recipes = $sql->retrieve('cookbook_recipes', '*', 'r_category = '.$category["c_id"].' ORDER BY r_datestamp '.$order, TRUE);

// Check if there are recipes in this category
if($recipes)
Expand Down

0 comments on commit 29cb7f5

Please sign in to comment.