Author Topic: VirtueMart Category Module - minor ordering issue after 3.0.6 upgrade  (Read 8845 times)

mronayne

  • Beginner
  • *
  • Posts: 45
Joomla Version 3.4.0

I just upgraded to VM 3.0.6 and the behavior of the VirtueMart Category module changed such that whenever I select a category, the module reorders my categories alphabetically. When I navigate back to the main store page, the categories are back in the order I set them to?

In VM 3.0.4, the order of my categories remains as I set them in the Admin Category ordering - which is how I want this module to behave.

While this may seem like something minor - I prefer that the categories remain in the order I set them to. At least give me a way in the module to disable this automatic alphabetical ordering.

You can see this behavior here: http://cejay2014.cejayengineering.com/products/buy-online  Then just expand any of the categories in the "Product Categories" module.

patbe60

  • Jr. Member
  • **
  • Posts: 51
Re: VirtueMart Category Module - minor ordering issue after 3.0.6 upgrade
« Reply #1 on: February 22, 2015, 11:26:30 am »
Hello

Same problem here. But it only happens when I have a category with subcategories:
When I click the main category, the other categories change into alphabetic order. When I click a subcategory, the categories change back into the order I have set in the BE.

I have found the problem:

In administrator/components/com_virtuemart/models/category.php there is a new code in line 329:

Code: [Select]
if(trim($this->_selectedOrdering) == 'c.ordering'){
$this->_selectedOrdering = 'c.ordering, l.`category_name`';
}

When uncommenting this code, the category ordering works fine again.

Maybe there is a setting in the configuration I have not yet found or there is a little error in this code.

Regards
Patrik

mronayne

  • Beginner
  • *
  • Posts: 45
Re: VirtueMart Category Module - minor ordering issue after 3.0.6 upgrade
« Reply #2 on: February 22, 2015, 15:50:04 pm »
Patrik,

Thank you for your reply. I have a quick question for you though...
I found the code you reference at line 329, but it is already un-commented?

The line above at  328 is commented as is the line below at 332 - is one of these the line you uncommented? Both?

Code: [Select]
//$selOrdering = $this->_selectedOrdering;
if(trim($this->_selectedOrdering) == 'c.ordering'){
$this->_selectedOrdering = 'c.ordering, l.`category_name`';
}
//$ordering = ' ORDER BY '.$this->_selectedOrdering.' '.$this->_selectedOrderingDir ;


mronayne

  • Beginner
  • *
  • Posts: 45
Re: VirtueMart Category Module - minor ordering issue after 3.0.6 upgrade
« Reply #3 on: February 22, 2015, 15:56:01 pm »
Patrik,

I figured it out... you must have meant that you commented out this code at 329. After I did that, the ordering remains as I have it configured.

Thanks again!
Regards,
Mike

breetlee6666

  • Beginner
  • *
  • Posts: 1
Re: VirtueMart Category Module - minor ordering issue after 3.0.6 upgrade
« Reply #4 on: February 23, 2015, 06:37:34 am »
There is my shop with parts for jewelery. I'm a programmer and owner of that shop. Of course there is much work to do yet. Thanks Virtuemart team, you did fantastic job.
ahsan

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10261
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: VirtueMart Category Module - minor ordering issue after 3.0.6 upgrade
« Reply #5 on: February 23, 2015, 10:35:34 am »
The correct code should be
Quote
      if(trim($this->_selectedOrdering) == 'c.ordering'){
         $this->_selectedOrdering = 'c.ordering, l.`category_name`';
      }
      $ordering = $this->_getOrdering();
Patrick maybe uncommented "$this->_selectedOrdering = 'c.ordering, l.`category_name`';"
Actually it should Order first by ordering and if the you have sometimes the same ordering, then by name. Example
Cat A Ordering 2
Cat B Ordering 2
Cat C Ordering 1
=> Cat C, Cat A, Cat B

I found the error, the reason is different

Code: [Select]
if(trim($this->_selectedOrdering) == 'c.ordering'){
$this->_selectedOrdering = 'c.ordering, category_name';
}

The new selectedOrdering was not in the self::$_validOrderingFields and failed
Code: [Select]
if(!in_array($selectedOrdering, self::$_validOrderingFields)){
$selectedOrdering = 'category_name';
}
in function getChildCategoryList, the solution is to add 'c.ordering, l.`category_name`' in line 33

Code: [Select]
static $_validOrderingFields = array('category_name','category_description','c.ordering','c.category_shared','c.published','c.ordering, l.`category_name`');
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

mronayne

  • Beginner
  • *
  • Posts: 45
Re: VirtueMart Category Module - minor ordering issue after 3.0.6 upgrade
« Reply #6 on: February 23, 2015, 15:19:51 pm »
I replaced line 33 with your code exactly and now I get the following SQL Error. What did I do wrong?

Code: [Select]
Unknown column 'l.category_name' in 'order clause' SQL=SELECT L.* FROM `gbo82_virtuemart_categories_en_gb` as L INNER JOIN `gbo82_virtuemart_categories` as c using (`virtuemart_category_id`) LEFT JOIN `gbo82_virtuemart_category_categories` as cx on c.`virtuemart_category_id` = cx.`category_child_id` WHERE cx.`category_parent_id` = 6 AND c.`virtuemart_vendor_id` = 1 AND c.`published` = 1 ORDER BY c.ordering, l.`category_name` ASC

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10261
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: VirtueMart Category Module - minor ordering issue after 3.0.6 upgrade
« Reply #7 on: February 23, 2015, 23:57:32 pm »
use category_name anywhere instead of l.category_name or similar. Or just check the svn http://dev.virtuemart.net/projects/virtuemart/repository
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

mronayne

  • Beginner
  • *
  • Posts: 45
Re: VirtueMart Category Module - minor ordering issue after 3.0.6 upgrade
« Reply #8 on: March 04, 2015, 18:32:35 pm »
Thank You! This problem is fixed in VM 3.0.6.2

d0ublezer0

  • Jr. Member
  • **
  • Posts: 210
Re: VirtueMart Category Module - minor ordering issue after 3.0.6 upgrade
« Reply #9 on: March 11, 2015, 14:40:49 pm »
VM 3.0.6.2
mod_virtuemart_category
orders alphabetically , instead of backend ordering settings (i use russian language of categories names)

mronayne

  • Beginner
  • *
  • Posts: 45
Re: VirtueMart Category Module - minor ordering issue after 3.0.6 upgrade
« Reply #10 on: March 11, 2015, 16:20:02 pm »
You can control the Ordering of the Category Module with the Configuration settings on the "Product Order Settings" tab.
To the right of "Default category sort order" selecting "Category Name" will either sort Ascending or Descending based on your choice. Selecting "Ordering, Name" will sort by your Category ordering.
At least this is how it is working for me. Seems reasonable?

d0ublezer0

  • Jr. Member
  • **
  • Posts: 210
Re: VirtueMart Category Module - minor ordering issue after 3.0.6 upgrade
« Reply #11 on: March 12, 2015, 07:31:51 am »
You can control the Ordering of the Category Module with the Configuration settings on the "Product Order Settings" tab.
To the right of "Default category sort order" selecting "Category Name" will either sort Ascending or Descending based on your choice. Selecting "Ordering, Name" will sort by your Category ordering.
At least this is how it is working for me. Seems reasonable?
Unfortunately, there are no Ordering tab (vm 3.0.6.2, J2.5.24):


jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28314
  • Always on vacation
    • Jenkin Hill Internet
Re: VirtueMart Category Module - minor ordering issue after 3.0.6 upgrade
« Reply #12 on: March 12, 2015, 10:58:35 am »
The setting is not in the module it is in VM Configuration/Product Order Settings  as  Default category sort order  - this affects the module and the category listing order.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VirtueMart  4.0.2 10661 on Joomla 3.10.9 PHP 7.4.29

d0ublezer0

  • Jr. Member
  • **
  • Posts: 210
Re: VirtueMart Category Module - minor ordering issue after 3.0.6 upgrade
« Reply #13 on: March 12, 2015, 11:00:51 am »
The setting is not in the module it is in VM Configuration/Product Order Settings  as  Default category sort order  - this affects the module and the category listing order.
OMG, thank you!

kaybee57

  • Beginner
  • *
  • Posts: 27
  • VirtueMart Version: VM 3.6.0 10113
Re: VirtueMart Category Module - minor ordering issue after 3.0.6 upgrade
« Reply #14 on: March 17, 2015, 00:11:33 am »
Thank You! This problem is fixed in VM 3.0.6.2
Agreed - quick update and ordering now works! Thank you folks!