-
AuthorPosts
-
Henning Friend
Henning
- Join date:
- February 2012
- Posts:
- 69
- Downloads:
- 45
- Uploads:
- 9
- Thanks:
- 40
- Thanked:
- 9 times in 1 posts
June 5, 2014 at 9:46 am #198498Hi Guys,
First off, I’m using the Portfolio Layout as an events calendar. Thus the articles’ created date is the day on which the event will appear, I simply wish to sort these articles so that the most recent or upcoming events are first.
I have double checked the dates on each article so the created date is configured correctly, all of them are in 2014 as well. On the Menu on which these articles should appear I have set the blog layout as mentioned below;
Category Order; Use Global
Article Order; Most Recent First
Date for Ordering; Created (The day on which the event occurs.)I have also cleared the website’s cache as well as my browser’s cache but the articles are still in no particular order. It’s a bit mixed up; The typical order is of these events are displayed as follow; 14 December, 21 Sept, 14 June, 30 November etc.
Please advise.
kind Regards,
HenningNinja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
June 6, 2014 at 8:02 am #538011Just for better clarification, please include screenshot to illustrate the issue, I will help to check further.
Henning FriendHenning
- Join date:
- February 2012
- Posts:
- 69
- Downloads:
- 45
- Uploads:
- 9
- Thanks:
- 40
- Thanked:
- 9 times in 1 posts
June 6, 2014 at 12:38 pm #538059Hi,
Thanks for the feedback. Please find attached the screenshot of the current layout. You’ll notice that an event occuring in December is actually in front of an event occuring in June, the filtering is completely random.
Regards,
Henning
Henning FriendHenning
- Join date:
- February 2012
- Posts:
- 69
- Downloads:
- 45
- Uploads:
- 9
- Thanks:
- 40
- Thanked:
- 9 times in 1 posts
June 9, 2014 at 12:02 pm #538318Hi Guys,
Any progress or advise on this topic?
Regards,
HenningNinja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
June 9, 2014 at 2:39 pm #538341HI Henning,
I could not see the option to set ordering on this module but you can try to my customize about on this module
Open templates/ja_sugite/html/mod_articles_categories/portfolio_items.php file
Change
defined('_JEXEC') or die;
To
defined('_JEXEC') or die;
function compare_create_date($a, $b) {
if($a->created_time == $b->created_time) {
return 0 ;
}
return ($a->created_time > $b->created_time) ? -1 : 1;
}
usort($list, 'compare_create_date');It will help you to change the ordering via created_time of article
Let me know if it helps
Regards
Henning FriendHenning
- Join date:
- February 2012
- Posts:
- 69
- Downloads:
- 45
- Uploads:
- 9
- Thanks:
- 40
- Thanked:
- 9 times in 1 posts
June 9, 2014 at 6:05 pm #538368Hi,
I have changed the portfolio_items.php located in ‘templates/ja_sugite/html/mod_articles_categories/’ and it seems that the articles are still in no particular order.
The code in the portfolio_items.php is as follow;
defined('_JEXEC') or die;
function compare_create_date($a, $b) {
if($a->created_time == $b->created_time) {
return 0 ;
}
return ($a->created_time > $b->created_time) ? -1 : 1;
}
usort($list, 'compare_create_date');
foreach ($list as $item) :?>
<li <?php if ($_SERVER['PHP_SELF'] == JRoute::_(ContentHelperRoute::getCategoryRoute($item->id))) echo ' class="active"';?>> <?php $levelup=$item->level-$startLevel -1; ?>
<a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($item->id)); ?>">
<?php echo $item->title;?>
</a><?php
if($params->get('show_description', 0))
{
echo JHtml::_('content.prepare', $item->description, $item->getParams(), 'mod_articles_categories.content');
}
if($params->get('show_children', 0) && (($params->get('maxlevel', 0) == 0) || ($params->get('maxlevel') >= ($item->level - $startLevel))) && count($item->getChildren()))
{echo '<ul>';
$temp = $list;
$list = $item->getChildren();
require JModuleHelper::getLayoutPath('mod_articles_categories', $params->get('layout', 'default').'_items');
$list = $temp;
echo '</ul>';
}
?>
</li>
<?php endforeach; ?>Please Advise.
Regards,
HenningHenning FriendHenning
- Join date:
- February 2012
- Posts:
- 69
- Downloads:
- 45
- Uploads:
- 9
- Thanks:
- 40
- Thanked:
- 9 times in 1 posts
June 10, 2014 at 9:45 am #538457Hi Guys,
Any ideas or suggestions, I’m still battling to filter these articles according to the created date. I have made changes to the code mentioned in the previous post but still no fix.
Regards,
HenningNinja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
June 10, 2014 at 11:02 am #538471Hi Henning,
You can try to do this again
Open templates/ja_sugite/html/com_content/category/portfolio.php file
Change
<?php if (!empty($this->intro_items)) : ?>
To
<?php if (!empty($this->intro_items)) :
function compare_create_date($a, $b) {
if($a->created == $b->created) {
return 0 ;
}
return ($a->created > $b->created) ? -1 : 1;
}
usort($this->intro_items, 'compare_create_date');
?>
Let me know the result
Regards
Henning FriendHenning
- Join date:
- February 2012
- Posts:
- 69
- Downloads:
- 45
- Uploads:
- 9
- Thanks:
- 40
- Thanked:
- 9 times in 1 posts
June 10, 2014 at 7:11 pm #538506Hi,
I have edited the code on portfolio.php and after refresh the page is blank (I have attached a Screenshot) with only the categories visible.
The Code for portfolio.php is as follow;
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers');
JHtml::addIncludePath(T3_PATH.'/html/com_content');
JHtml::addIncludePath(dirname(dirname(__FILE__)));
JHtml::_('behavior.caption');
//register the helper class
JLoader::register('SugiteHelper', T3_TEMPLATE_PATH . '/templateHelper.php');
//template params
$tplparams = JFactory::getApplication()->getTemplate(true)->params;
//Load grid items
SugiteHelper::loadGridItems();
?><div class="ja-masonry-wrap">
<?php if ($this->params->get('show_page_heading', 1)) : ?>
<div class="page-header clearfix">
<h1 class="page-title"> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1>
</div>
<?php endif; ?><?php if ($this->params->get('show_category_title', 1) or $this->params->get('page_subheading')) : ?>
<div class="page-subheader clearfix">
<h2 class="page-subtitle"><?php echo $this->escape($this->params->get('page_subheading')); ?>
<?php if ($this->params->get('show_category_title')) : ?>
<small class="subheading-category"><?php echo $this->category->title;?></small>
<?php endif; ?>
</h2>
</div>
<?php endif; ?><?php if ($this->params->get('show_description', 1) || $this->params->def('show_description_image', 1)) : ?>
<div class="category-desc clearfix">
<?php if ($this->params->get('show_description_image') && $this->category->getParams()->get('image')) : ?>
<img src="<?php echo $this->category->getParams()->get('image'); ?>"/>
<?php endif; ?>
<?php if ($this->params->get('show_description') && $this->category->description) : ?>
<?php echo JHtml::_('content.prepare', $this->category->description, '', 'com_content.category'); ?>
<?php endif; ?>
</div>
<?php endif; ?>
<!-- Load Modules with position "portfolio-menu" -->
<?php if(SugiteHelper::loadmodules('portfolio-menu','T3xhtml')): ?>
<div class="inset">
<?php echo SugiteHelper::loadmodules('portfolio-menu','T3xhtml'); ?>
</div>
<?php endif;?>
<!-- End load -->
<div class="grid blog<?php echo $this->pageclass_sfx;?>" id="grid"><?php if ($this->params->get('show_tags', 1) && !empty($this->category->tags->itemTags)) :
$this->category->tagLayout = new JLayoutFile('joomla.content.tags');
echo $this->category->tagLayout->render($this->category->tags->itemTags);
endif; ?><?php if (empty($this->lead_items) && empty($this->link_items) && empty($this->intro_items)) :
if ($this->params->get('show_no_articles', 1)) : ?>
<p><?php echo JText::_('COM_CONTENT_NO_ARTICLES'); ?></p>
<?php endif; ?>
<?php endif; ?><?php $leadingcount = 0; ?>
<?php if (!empty($this->lead_items)) : ?>
<?php foreach ($this->lead_items as &$item) : ?>
<?php
$this->item = &$item;
echo $this->loadTemplate('item');
?>
<?php $leadingcount++; ?>
<?php endforeach; ?>
<?php endif; ?><?php
$introcount = (count($this->intro_items));
$counter = 0;
?><?php if (!empty($this->intro_items)) :function compare_create_date($a, $b) {
if($a->created == $b->created) {
return 0 ;
}
return ($a->created > $b->created) ? -1 : 1;
}
usort($this->intro_items, 'compare_create_date'); ?>
<?php foreach ($this->intro_items as $key => &$item) : ?>
<?php $rowcount = ((int) $counter % (int) $this->columns) + 1; ?>
<?php
$this->item = &$item;
echo $this->loadTemplate('item');
?>
<?php $counter++; ?><?php endforeach; ?>
<?php endif; ?><?php if ($this->params->get('show_pagination') == 3 && $this->pagination->get('pages.total') > 1) : ?>
<nav id="page-nav" class="pagination">
<?php
$urlparams = '';
if (!empty($this->pagination->_additionalUrlParams)){
foreach ($this->pagination->_additionalUrlParams as $key => $value) {
$urlparams .= '&' . $key . '=' . $value;
}
}$next = $this->pagination->limitstart + $this->pagination->limit;
$nextlink = JRoute::_($urlparams . '&' . $this->pagination->prefix . 'limitstart=' . $next);
?>
<a id="page-next-link" href="<?php echo $nextlink ?>" data-limit="<?php echo $this->pagination->limit; ?>" data-start="<?php echo $this->pagination->limitstart ?>" data-page-total="<?php echo ceil($this->pagination->total / $this->pagination->limit);?>" data-total="<?php echo $this->pagination->total;?>"></a>
</nav>
<?php endif; ?>
</div>
<?php
//Override pagination
if ($this->params->def('show_pagination', 2) == 1 || ($this->params->get('show_pagination') == 2 && $this->pagination->get('pages.total') > 1) || $this->params->def('show_pagination', 2) == 3) : ?>
<?php if ($this->params->def('show_pagination', 2) == 3) : ?>
<?php if($this->pagination->get('pages.total') > 1) :?>
<div id="infinity-next" class="btn btn-primary btn-block hidden"><?php echo JText::_('TPL_INFINITY_NEXT')?></div>
<?php else:?>
<div id="infinity-next" class="btn btn-primary btn-block disabled"><?php echo JText::_('TPL_JSLANG_FINISHEDMSG');?></div>
<?php endif;?>
<?php else : ?>
<div class="pagination">
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter pull-right">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
Any suggestions? I’m really concerned about the articles not filtering according to the parameters I’ve set. Thanks for the help, but still not fixed.
Regards,
Henning
Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
June 11, 2014 at 4:47 am #538555I just fixed it directly on your site, here is what I have changed.
function cmp($a, $b)
{
if($a->created == $b->created) {
return 0 ;
}
return ($a->created > $b->created) ? -1 : 1;
}
$a = $this->intro_items;
usort($a, "cmp");
$this->intro_items = $a;
Please check again and let me know if it helps.
-
1 user says Thank You to Ninja Lead for this useful post
Henning FriendHenning
- Join date:
- February 2012
- Posts:
- 69
- Downloads:
- 45
- Uploads:
- 9
- Thanks:
- 40
- Thanked:
- 9 times in 1 posts
June 11, 2014 at 12:10 pm #538597Hi Ninja Lead,
It’s fixed, thanks a bunch, just had a look and the filtering is working 100% according to the ‘most recent first’ and ‘created date’ parameters.
Just another question; How do I set the filter on those articles to display the most recent date instead of the last date? It should start from January to December. It’s currently showing from December to January.
Thanks again for your help! I appreciate it sincerely!
Kind Regards,
HenningHenning FriendHenning
- Join date:
- February 2012
- Posts:
- 69
- Downloads:
- 45
- Uploads:
- 9
- Thanks:
- 40
- Thanked:
- 9 times in 1 posts
June 12, 2014 at 8:24 am #538711Hi Ninja Lead,
Were you able to have a look at my question posted in the previous topic?
“How do I set the filter on those articles to display the most recent date instead of the last date? It should start from January to December. It’s currently showing from December to January.”
Regards,
HenningNinja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
June 12, 2014 at 4:59 pm #538745Hi Henning,
I just fixed it as your request. For now, It’s showing from January to December. Here is my workaround
function cmp($a, $b)
{
if($a->created == $b->created) {
return 0 ;
}
return ($a->created < $b->created) ? -1 : 1;
}
$a = $this->intro_items;
usort($a, "cmp");
$this->intro_items = $a;
Regards
1 user says Thank You to Ninja Lead for this useful post
Henning FriendHenning
- Join date:
- February 2012
- Posts:
- 69
- Downloads:
- 45
- Uploads:
- 9
- Thanks:
- 40
- Thanked:
- 9 times in 1 posts
June 12, 2014 at 6:32 pm #538755Hi Ninja Lead,
Well done! It’s fixed! Thank you very much, your support was most appreciated!
Regards,
HenningAuthorPostsViewing 14 posts - 1 through 14 (of 14 total)This topic contains 14 replies, has 2 voices, and was last updated by Henning 10 years, 5 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum
Jump to forum