Your Cart is currently empty!
Product update
Coupon
add
Coupon code invalid! Please re-enter!
AJAX loader
You are here: HomeForum
Welcome, Guest

[SOLVED]Custom item ordering doesn't work well 2
(1 viewing) (1) Guest

TOPIC: [SOLVED]Custom item ordering doesn't work well 2

Re: Custom item ordering doesn't work well 2 10 years, 1 month ago #17801

Hello

At least "sj-k2-slideShow-III" module helped me to solve issue by my own. I compared
code below this syntax "if ($params->get('source') == 'specific')" in both modules helper files.

So, in module "sj-k2-slideShow-II", in file "core/helper_base.php", I changed this code:

if (count($current)>0){
$query = "SELECT i.*, c.name AS categoryname,c.id AS categoryid, c.alias AS categoryalias, c.params AS categoryparams
							FROM #__k2_items as i
							LEFT JOIN #__k2_categories c ON c.id = i.catid
							WHERE i.published = 1 ";
					$query .= " AND i.access IN(".implode(',', $user->getAuthorisedViewLevels()).") ";
					$query .= " AND i.trash = 0 AND c.published = 1 ";
					$query .= " AND c.access IN(".implode(',', $user->getAuthorisedViewLevels()).") ";
					$query .= " AND c.trash = 0
							AND ( i.publish_up = ".$db->Quote($nullDate)." OR i.publish_up <= ".$db->Quote($now)." )
									AND ( i.publish_down = ".$db->Quote($nullDate)." OR i.publish_down >= ".$db->Quote($now)." )
									AND i.id IN(".implode(',', $current).") ";
					if ($mainframe->getLanguageFilter())
					{
						$languageTag = JFactory::getLanguage()->getTag();
						$query .= " AND c.language IN (".$db->Quote($languageTag).", ".$db->Quote('*').") AND i.language IN (".$db->Quote($languageTag).", ".$db->Quote('*').")";
					}
					$db->setQuery($query);
					$items = $db->loadObjectList();
				}



with this code from module "sj-k2-slideShow-III", from file "core/helper.php":

foreach ($current as $id) {

                $query = "SELECT i.*, c.name AS categoryname,c.id AS categoryid, c.alias AS categoryalias, c.params AS categoryparams
				FROM #__k2_items as i 
				LEFT JOIN #__k2_categories c ON c.id = i.catid 
				WHERE i.published = 1 ";
                if (K2_JVERSION != '15') {
                    $query .= " AND i.access IN(" . implode(',', $user->getAuthorisedViewLevels()) . ") ";
                } else {
                    $query .= " AND i.access<={$aid} ";
                }
                $query .= " AND i.trash = 0 AND c.published = 1 ";
                if (K2_JVERSION != '15') {
                    $query .= " AND c.access IN(" . implode(',', $user->getAuthorisedViewLevels()) . ") ";
                } else {
                    $query .= " AND c.access<={$aid} ";
                }
                $query .= " AND c.trash = 0
				AND ( i.publish_up = " . $db->Quote($nullDate) . " OR i.publish_up <= " . $db->Quote($now) . " )
				AND ( i.publish_down = " . $db->Quote($nullDate) . " OR i.publish_down >= " . $db->Quote($now) . " )
				AND i.id={$id}";
                if (K2_JVERSION != '15') {
                    if ($mainframe->getLanguageFilter()) {
                        $languageTag = JFactory::getLanguage()->getTag();
                        $query .= " AND c.language IN (" . $db->Quote($languageTag) . ", " . $db->Quote('*') . ") AND i.language IN (" . $db->Quote($languageTag) . ", " . $db->Quote('*') . ")";
                    }
                }
                $db->setQuery($query);
                $item = $db->loadObject();
                if ($item)
                    $items[] = $item;

            }	


And now ordering for custom items works as it should!


Regards
Last Edit: 10 years, 1 month ago by Krx.
The topic has been locked.
Time to create page: 0.21 seconds

Notification

Please find your issue via Suggested Posts before submitting your question. We have solved the most of issues and maybe your issue was solved before.

Latest My Topics

No posts to display.

Love all our templates?

Join our membership clubs starting at $49 only for access to all of our templates

Join Now
Home Pricing
Your Cart is currently empty!
Product update
Coupon
add
Coupon code invalid! Please re-enter!
AJAX loader
SearchSupport
Magento Themes Magento Extensions Free Magento Extensions Prestashop Themes Prestashop Modules Magento 2 Themes