News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Backend Products Ordering Glitch

Started by kaiserdom, October 28, 2017, 13:38:21 PM

Previous topic - Next topic

kaiserdom

Hello
Every time I «Save And Close» a product, the VM3.2.4  system drives me to the Products area, but it doesn't remember the sorting before the product creation. More specifically,  it sorts the products by Product_Id in ascending ordering. So, every time I have to sort again the products by Product_Id in descending ordering, in order to find the last created one.  Someone to help?

VM 3.2.4
Joomla 3.8.1
PHP 7.1.1

kaiserdom

This is important and a time saver when you import many products -one after another- with clone process. You can't just keep changing the sorting.  A penny for your thoughts   ???

kaiserdom

Anyone from the VM Developers Community?

Studio 42

With my tool https://shop.st42.fr/en/products/vm-be-pro-batch-product-edit.htm on clone, the new clone get append to the list directly with ajax, so no ordering problem
For Virtuemart, i think perhaps this is the problem in VirtuemartViewProduct:
if($cI = vRequest::getInt('virtuemart_category_id',false)){
$app = JFactory::getApplication();
//$old_state = $app->getUserState('virtuemart_category_id');
$old_state = $app->getUserState('virtuemart_category_id');
if(empty($old_state) or $old_state!=$cI){
vRequest::setVar('com_virtuemart.product.filter_order','pc.ordering');
$model->filter_order = 'pc.ordering';
$old_state = $app->setUserState('virtuemart_category_id',$cI);
}
}

If a VM core dev want to check ?

Milbo

I wonder the sorting should be stored, as userstate, when you click on the order.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

p.barg

Hi Max,
no, I can confirm that the ordering is not saved.
We also have a customer with many products and he also finds it very tedious. The behaviour was different in earlier VM versions.

-- Petra

Milbo

php 7.1.1? brave, hehe.

I cant reproduce it.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

kaiserdom

It's not the PHP version. I tried with versions 7.0 and 5.6 and the result was the same.

Jörgen

#8
Hello

This is probably not helping, but I see the same. I often switch to latest ID when entering new products. After saving the Product the ordering is reset to order by SKU, starting with lowest SKU.

Uing php 5.6, Joomla 3.8.2 and VM 3.2.5.9677

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Ventsi Genchev

+1
The same problem.
PHP 7.0, J 3.8.2, VM 3.2.4
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

Studio 42

I think that the code before :
if($cI = vRequest::getInt('virtuemart_category_id',false)){
Is the problem.
because
vRequest::setVar('com_virtuemart.product.filter_order','pc.ordering');
is never called because in admin, the category is never set on returning from product edit.
Not that i dont have checked, because i dont want to provide any patch excluding github.

Milbo

I think that was there to reset the ordering, when changing the category. Or better said, it should set the ordering to "ordering," when enabling a category. I think atm it is just outdated stuff and the whole if should be removed
Quote
if($cI = vRequest::getInt('virtuemart_category_id',false)){
            $app = JFactory::getApplication();
            //$old_state = $app->getUserState('virtuemart_category_id');
            $old_state = $app->getUserState('virtuemart_category_id');
            if(empty($old_state) or $old_state!=$cI){
               vRequest::setVar('com_virtuemart.product.filter_order','pc.ordering');
               $model->filter_order = 'pc.ordering';
               $old_state = $app->setUserState('virtuemart_category_id',$cI);
            }
         }

Btw, you can also create with git a patch for svn. There absolutly no reason to block svn. As I said very often, you can work with git
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Studio 42

Max, if VM is in github, you can fork and do pull request. Currently, you have to send a patch, no one can test it ...
For me svn is to many work(and for other contributors), it have nothing to do with SVN itself, but github is public and you can share anything with other user, so they can test your release or see directly your patch with diff... and why not participate to your current change and not send a patch, wait and hope a day a team member check it.
For Joomla, you have teams for each part of the code, they work on different fork and get time to time updates from main branch, when te patch is approved, the main branch manager simply add the pull request
BUt we have already discuss about this.

Studio 42

I found a trick, but dont know if it's the best way.
I simply added this for backend  /administrator/components/com_virtuemart/models/product.php
   in protected function populateState () {
before    
$filter_order = strtolower ($app->getUserStateFromRequest ('com_virtuemart.' . $view . '.filter_order', 'filter_order', $this->_selectedOrdering, 'cmd'));
add
$task = vRequest::getCmd ('task',false);
if($task != false) return;

So the state get not populate, if you are in a task(i dont think that in back-end the task have to be populate, but perhaps for batch mf or category ?).

Milbo


Just remove your fix please and also remove this here, (view.html.php)

Quote
if($cI = vRequest::getInt('virtuemart_category_id',false)){
            $app = JFactory::getApplication();
            //$old_state = $app->getUserState('virtuemart_category_id');
            $old_state = $app->getUserState('virtuemart_category_id');
            if(empty($old_state) or $old_state!=$cI){
               vRequest::setVar('com_virtuemart.product.filter_order','pc.ordering');
               $model->filter_order = 'pc.ordering';
               $old_state = $app->setUserState('virtuemart_category_id',$cI);
            }
         }

That is old stuff, the populateState does it already and is just overwritten here.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/