Author Topic: Backend Products Ordering Glitch  (Read 3540 times)

kaiserdom

  • Jr. Member
  • **
  • Posts: 80
  • A beginner
Backend Products Ordering Glitch
« on: October 28, 2017, 13:38:21 pm »
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

  • Jr. Member
  • **
  • Posts: 80
  • A beginner
Re: Backend Products Ordering Glitch
« Reply #1 on: October 29, 2017, 12:45:37 pm »
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

  • Jr. Member
  • **
  • Posts: 80
  • A beginner
Re: Backend Products Ordering Glitch
« Reply #2 on: October 31, 2017, 18:55:59 pm »
Anyone from the VM Developers Community?

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4330
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Backend Products Ordering Glitch
« Reply #3 on: November 01, 2017, 02:54:27 am »
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:
Code: [Select]
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10040
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Backend Products Ordering Glitch
« Reply #4 on: November 04, 2017, 00:05:46 am »
I wonder the sorting should be stored, as userstate, when you click on the order.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

p.barg

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 166
    • Barg IT
Re: Backend Products Ordering Glitch
« Reply #5 on: November 06, 2017, 11:35:03 am »
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10040
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Backend Products Ordering Glitch
« Reply #6 on: November 08, 2017, 16:32:32 pm »
php 7.1.1? brave, hehe.

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

kaiserdom

  • Jr. Member
  • **
  • Posts: 80
  • A beginner
Re: Backend Products Ordering Glitch
« Reply #7 on: November 20, 2017, 21:59:34 pm »
It's not the PHP version. I tried with versions 7.0 and 5.6 and the result was the same.

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2750
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Backend Products Ordering Glitch
« Reply #8 on: November 21, 2017, 08:54:20 am »
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)

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 303
    • Audio Store
Re: Backend Products Ordering Glitch
« Reply #9 on: November 21, 2017, 19:13:57 pm »
+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

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4330
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Backend Products Ordering Glitch
« Reply #10 on: November 21, 2017, 21:35:12 pm »
I think that the code before :
Code: [Select]
if($cI = vRequest::getInt('virtuemart_category_id',false)){Is the problem.
because
Code: [Select]
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10040
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Backend Products Ordering Glitch
« Reply #11 on: November 23, 2017, 16:03:24 pm »
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
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4330
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Backend Products Ordering Glitch
« Reply #12 on: November 23, 2017, 18:40:51 pm »
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

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4330
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Backend Products Ordering Glitch
« Reply #13 on: November 23, 2017, 23:17:23 pm »
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    
Code: [Select]
$filter_order = strtolower ($app->getUserStateFromRequest ('com_virtuemart.' . $view . '.filter_order', 'filter_order', $this->_selectedOrdering, 'cmd'));add
Code: [Select]
$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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10040
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Backend Products Ordering Glitch
« Reply #14 on: November 27, 2017, 21:24:58 pm »

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.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/