Pagination in list products

16.05.2020 09:28
#1
KianWilliam121
Joomshopping forum user no avatar
Name: Kian William
19.10.2015
Posts: 70
Quote
Pagination in list products

To whom it may concern:
In category layout, list of products with pagination does not work, the object pagination includes simple links with onclick event to assign limitstart and Joomla.submitform() without being wrapped in a form, no route is specified in other words.
Joomla version is 4alpha, is there a plugin or setting that I did not consider to enable or set?
K W Nowrouzian


Joomla: 4 alpha
JoomShopping: 5. 0. 0 A 18
PHP: 7.3
 
16.05.2020 17:31
#2
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25940
Quote
Aw: Pagination in list products

Bug in JoomShopping: 5

 
17.05.2020 10:12
#3
KianWilliam121
Joomshopping forum user no avatar
Name: Kian William
19.10.2015
Posts: 70
Quote
Aw: Pagination in list products

Where is that layout file which prints pagination links? I can find it yet it takes some time. I will add myself the form with route
K W Nowrouzian

 
17.05.2020 10:46
#4
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25940
Quote
Aw: Pagination in list products

components\com_jshopping\templates\default\list_products\block_pagination.php

 
17.05.2020 14:35
#5
KianWilliam121
Joomshopping forum user no avatar
Name: Kian William
19.10.2015
Posts: 70
Quote
Aw: Pagination in list products

I already viewed that file it includes a require path with $this->blah object as the filename in which contain the original code for pagination, could you give the exact name?
K W Nowrouzian

 
17.05.2020 17:47
#6
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25940
Quote
Aw: Pagination in list products

components\com_jshopping\Model\Productlist\ListModel.php
row 61

 
18.05.2020 06:03
#7
KianWilliam121
Joomshopping forum user no avatar
Name: Kian William
19.10.2015
Posts: 70
Quote
Aw: Pagination in list products

Thanks

 
19.05.2020 09:48
#8
KianWilliam121
Joomshopping forum user no avatar
Name: Kian William
19.10.2015
Posts: 70
Quote
Aw: Pagination in list products

For those who experienced the same problem, I employed this code in listmodel.php, it is possible to use this code in a content plugin and trigger it wherever it is necessary:
In method load in the file above:
add this in the beginning of the method load:
$post = $app->input->get('jform', array(), 'post', array());
if(empty($post))
$limitstart = $this->getLimitStart();
else
$limitstart = $post['limitstart'];
then go to //$pagenav = $pagination->getPagesLinks();
comment it and instead:
$pagenav = $pagination->getPaginationPages();
$fields = "";
foreach($pagenav as $k=>$val){
if($k!=="all" && $k!=="pages"){
$value = substr($val['data']->link, strlen($val['data']->link)-3);
if(!intval($value))
{
$value = substr($val['data']->link, strlen($val['data']->link)-2);
if(!intval($value))
$value = substr($val['data']->link, strlen($val['data']->link)-1);

}



$fields .= "<button name='jform[limitstart]' value='".$value."' >".$k."</button>";}
}
$form = "<form action='index.php?option=com_jshopping&view=category&layout=category&task=view&category_id=".$catid."' method='post' id='adminForm' >".$fields."</form>";
comment this line: //$this->setPagenav($pagenav);
add this at the end of the method:
$this->setPagenav($form);
As I already mentioned, it had better to put this in a content plugin to trigger it wherever it is necessary.
Also there might be some conditions in the loop for the link attribute of paginationpages's object that I have not considered, this is only the base.
It works, yet I am possitive there are other ways.
Kian William Nowrouzian

 
19.05.2020 15:47
#9
KianWilliam121
Joomshopping forum user no avatar
Name: Kian William
19.10.2015
Posts: 70
Quote
Aw: Pagination in list products

I forgot to add this:
$catid = JFactory::getApplication()->input->get('category_id');
Paste it at the beginning of the load method, then it feeds the form action request variable category_id.
Kian William Nowrouzian


Last change: 19.05.2020 15:48
 
20.05.2020 09:13
#10
KianWilliam121
Joomshopping forum user no avatar
Name: Kian William
19.10.2015
Posts: 70
Quote
Aw: Pagination in list products

Also in case that your store has too many pages, you may employ an inner loop using $toalpages as counter variable to print numbers based on that variable for jform[limitstart] and publish them in $fields . My store is arranged in a way that there is only two pages for all categories, that is why I did not employ it in the code above.
Kian William Nowrouzian


Last change: 20.05.2020 09:14
 


Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.