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

VirtueMart Category Module - minor ordering issue after 3.0.6 upgrade

Started by mronayne, February 21, 2015, 15:50:14 PM

Previous topic - Next topic

mronayne

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

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:

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

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?


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


mronayne

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

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

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


if(trim($this->_selectedOrdering) == 'c.ordering'){
$this->_selectedOrdering = 'c.ordering, category_name';
}


The new selectedOrdering was not in the self::$_validOrderingFields and failed

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


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

I replaced line 33 with your code exactly and now I get the following SQL Error. What did I do wrong?

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

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


d0ublezer0

VM 3.0.6.2
mod_virtuemart_category
orders alphabetically , instead of backend ordering settings (i use russian language of categories names)

mronayne

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

Quote from: mronayne 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?
Unfortunately, there are no Ordering tab (vm 3.0.6.2, J2.5.24):


jenkinhill

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
Lowestoft, Suffolk, UK

Retired from forum life November 2023

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

d0ublezer0

Quote from: jenkinhill 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.
OMG, thank you!

kaybee57

Quote from: mronayne on March 04, 2015, 18:32:35 PM
Thank You! This problem is fixed in VM 3.0.6.2
Agreed - quick update and ordering now works! Thank you folks!