- Posts: 54
COMMUNITY FORUM
Featured Ordering not work
- MGS Creativa
- Offline
- Senior Member
Thanks!
Please Log in or Create an account to join the conversation.
- MGS Creativa
- Offline
- Senior Member
- Posts: 54
Thanks!
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
- Posts: 15920
Is the ordering/ feature ordering being saved in the DB cells of the xx_k2_items table?
Also, did you check the network tab for the requests and their response?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- MGS Creativa
- Offline
- Senior Member
- Posts: 54
I'll try to answer as clear as possible, but if you want to have access to my site backend, feel free to ask.
First of all, I have Joomla 3.4.4 and K2 2.6.9 mysql 5.5.44 PHP 5.5.9 Server Apache/2.4.7
This error arraises because I'm migrating a complete messy website into a new and more professional one, for that, I decided to migrate all contents (huge list by the way) from J! content to K2, so far so good. My site has a particularity, the homepage has to show only featured items and they have to be manually reordered in a regular basis over time. Doing so, I've found that featured items got reordered after manually ordering them.Krikor wrote: How did you encounter this error?
I think that's not working, in this screenshot i.imgur.com/zKO1c9y.png you can see a query with a lot of items with "featured_ordering" set to 0!, this happened just after I set item id 845 to be the first by manual order, in the screenshot appears at 6th position with "featured_ordering" set to 0!Krikor wrote: Is the ordering/ feature ordering being saved in the DB cells of the xx_k2_items table?
This screenshot displays request result after set item id 17 first by manual reordering i.imgur.com/vd9iPgB.jpg and this one shows the featured item list after reloading the page after set item id 17 at first by manual reordering i.imgur.com/k5LGXTC.jpgKrikor wrote: Also, did you check the network tab for the requests and their response?
The request result has a lot of HTML because I have enabled XDebug, but the error is this:
Notice: Array to string conversion in libraries/joomla/filter/input.php on line 201
Call Stack
# Time Memory Function Location
1 0.0003 261904 {main}( ) .../index.php:0
2 0.0395 954184 JApplicationCms->execute( ) .../index.php:47
3 0.0395 954488 JApplicationAdministrator->doExecute( ) .../cms.php:252
4 0.0853 2190992 JApplicationAdministrator->dispatch( ) .../administrator.php:152
5 0.0860 2197368 JComponentHelper::renderComponent( ) .../administrator.php:98
6 0.0873 2209864 JComponentHelper::executeComponent( ) .../helper.php:372
7 0.0878 2228560 require_once( '/var/www/clients/client1/web2/web/residencias/administrator/components/com_k2/k2.php' ) .../helper.php:392
8 0.0954 2322608 K2HelperPermissions::checkPermissions( ) .../k2.php:39
9 0.0954 2322920 JRequest::getInt( ) .../permissions.j16.php:26
10 0.0954 2323064 JRequest::getVar( ) .../request.php:193
11 0.0954 2323320 JRequest::_cleanVar( ) .../request.php:152
12 0.0954 2323320 JFilterInput->clean( ) .../request.php:553
I think it's a K2 bug, because I'm expecting featured item list manual reordering to behave as Joomla! featured item list
If you need something else, just ask
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
- Posts: 15920
If not, try to disable error reporting from your site's global configuration and try again.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- MGS Creativa
- Offline
- Senior Member
- Posts: 54
Here is the result of set item id 845 at first, imgur.com/2XjKjmE then, after page reload, the order got missing! imgur.com/KC4Frq6
Really need to dig deeper, because I think it's some kind of issue with K2 or with new J! 3.4.4
Thanks!
PS: Really Krikor, do you want to have access to the site to check by yourself?
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
- Posts: 15920
Can you try installing the dev version?
getk2.org/assets/get/
PS. Backup first
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- MGS Creativa
- Offline
- Senior Member
- Posts: 54
After installing dev build, tried to set items ID 17 and 777 respectively imgur.com/x8lT6Wh, but after reload reorder still gets missing imgur.com/b7HOIHs
Please Log in or Create an account to join the conversation.
- MGS Creativa
- Offline
- Senior Member
- Posts: 54
As far as I can tell, the cid post var contains the manual reordeing array of IDs ans looks just fine, but the order post var has another array of IDs and the order looks juast as what you get after reloading the page. I think that for featured items, that var should not be taken into account.
function savefeaturedorder()
{
$mainframe = JFactory::getApplication();
$db = JFactory::getDBO();
$cid = JRequest::getVar('cid', array(0), 'post', 'array');
$total = count($cid);
$order = JRequest::getVar('order', array(0), 'post', 'array');
JArrayHelper::toInteger($order, array(0));
$groupings = array();
for ($i = 0; $i < $total; $i++)
{
$row = JTable::getInstance('K2Item', 'Table');
$row->load((int)$cid[$i]);
$groupings[] = $row->catid;
if ($row->featured_ordering != $order[$i])
{
$row->featured_ordering = $order[$i];
if (!$row->store())
{
JError::raiseError(500, $db->getErrorMsg());
}
}
}
$params = JComponentHelper::getParams('com_k2');
if (!$params->get('disableCompactOrdering'))
{
$groupings = array_unique($groupings);
foreach ($groupings as $group)
{
$row = JTable::getInstance('K2Item', 'Table');
$row->reorder('featured = 1 AND trash=0', 'featured_ordering');
}
}
$cache = JFactory::getCache('com_k2');
$cache->clean();
return true;
}
Please Log in or Create an account to join the conversation.
- MGS Creativa
- Offline
- Senior Member
- Posts: 54
Basically takes into account if the list given is only featured items and then reorder the items by cid post param if not, then do actual k2 stuff (that may be buggy)
function savefeaturedorder()
{
$mainframe = JFactory::getApplication();
$db = JFactory::getDBO();
$cid = JRequest::getVar('cid', array(0), 'post', 'array');
$total = count($cid);
$order = JRequest::getVar('order', array(0), 'post', 'array');
$filterauthor = JRequest::getVar('filter_author', 0, 'post', 'integer');
$filtercategory = JRequest::getVar('filter_category', 0, 'post', 'integer');
$filterfeatured = JRequest::getVar('filter_featured', 0, 'post', 'integer');
$filterstate = JRequest::getVar('filter_state', -1, 'post', 'integer');
$filtertrash = JRequest::getVar('filter_trash', 0, 'post', 'integer');
JArrayHelper::toInteger($order, array(0));
$groupings = array();
for ($i = 0; $i < $total; $i++)
{
$row = JTable::getInstance('K2Item', 'Table');
$row->load((int)$cid[$i]);
$groupings[] = $row->catid;
if ($filterfeatured == 1 && $filterauthor == 0 && $filtercategory == 0 && $filterstate == -1 && $filtertrash == 0)
{
$row->featured_ordering = $i;
}
else if ($row->featured_ordering != $order[$i])
{
$row->featured_ordering = $order[$i];
}
if (!$row->store())
{
JError::raiseError(500, $db->getErrorMsg());
}
}
$params = JComponentHelper::getParams('com_k2');
if (!$params->get('disableCompactOrdering'))
{
$groupings = array_unique($groupings);
foreach ($groupings as $group)
{
$row = JTable::getInstance('K2Item', 'Table');
$row->reorder('featured = 1 AND trash=0', 'featured_ordering');
}
}
$cache = JFactory::getCache('com_k2');
$cache->clean();
return true;
}
Please Log in or Create an account to join the conversation.