News:

Looking for documentation? Take a look on our wiki

Main Menu

[solved] JPagination does not let extend VM

Started by balai, November 21, 2011, 12:52:47 PM

Previous topic - Next topic

balai

Hi

I have tried to extend some VM models in a custom component and to use the category VM layout for the products display.

I m noticing one problem with the pagination.
It is always redirecting me to the VM pages.

I think that it could be solved easily, if the pagination's form action which is now a static URI, will be defined as a variable  in the category view class.

What you think?

balai


Milbo

I think we should take a look on it. You may help us and provide us with your suggested fix
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

balai

#3
Ok np

line 172 of the file components\com_virtuemart\views\category\tmpl\default.php

<form action="<?php echo JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$this->category->virtuemart_category_id ); ?>" method="post">

Could be transformed to
<form action="<?php echo $this->paginationAction;?>" method="post">

Then you have to define that var to the category view class: components\com_virtuemart\views\category\view.html.php


//set this after the $categoryId definition
$paginationAction=JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$categoryId );
$this->assignRef('paginationAction', $paginationAction);




Generally i would suggest you not to use static URIs in the layouts. Better to define them elsewhere and use a varriable.
This way if you want to add a new variable to the URI's query its easy without having all the users change their layouts.
Also the layouts could be used by other extensions


balai

#4
Hi Max

I m checking the new version.

that the var paginationAction is passed in the template through  the view class but not its not used there.
The pagination form's action is still a static URL. Also the get method is blocking queries to be passed as actions.

Is there any chance those 2 minor changes (action and method) to be done ?

file: components\com_virtuemart\views\category\tmpl\default.php (line 149)

Studio 42

Hi,
I changed to "get" to past variable in uri because the value in this form are reused to generate the pagination/orderby ... and on using "post" we can't past value form plugin search extention.
If you want to do a template with posting the values, you can, but sure this are not working as expected.
If you wan't modify a "GET" value you can use getVar and SetVar , modify it in a joomla plugin or in a javascript.

What is the interest to use "POST" and changing the

//set this after the $categoryId definition
$paginationAction=JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$categoryId );
$this->assignRef('paginationAction', $paginationAction);


The interess can be to change the option=com_virtuemart to

$option = jRequest::getvar('option','com_virtuemart');
and changing line
<form action="<?php echo JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$this->category->virtuemart_category_id ); ?>" method="get">
to
<form action="<?php echo JRoute::_('index.php?option='.$option.'&view=category&virtuemart_category_id='.$this->category->virtuemart_category_id ); ?>" method="get">

balai

Hi Electrocity

Thank you.

I though that the layout could be used also by other extensions to display products not only from a selected category but maybe grouped using other criteria.