News:

Looking for documentation? Take a look on our wiki

Main Menu

Order of custom fields

Started by athree, August 27, 2011, 11:33:27 AM

Previous topic - Next topic

cas

Hi Electricity,

My post was from Dec 18th when RC3 was the latest version.   Did you check if it works now with VM2.0.0?  I just checked it and unfortunately the problem is still the same as I described in my Dec 18th post.  Any estimate when it will be fixed?   

Thanks,
Chuck

cas

Just updated to VM2.0.1.d and it still does not work.

cas

Just updated to VM2.0.1.K and it still does not work.

cvoogt

Not sure why this still hasn't been fixed but it's pretty simple;

Edit /administrator/components/models/custom.php

Right after this:
if($search){

$search = '"%' . $this->_db->getEscaped( $search, true ) . '%"' ;

$query .= 'AND `custom_title` LIKE '.$search;

}


Insert this (should be around line 191):

$query .= ' ORDER BY ordering ASC';

The custom fields list query had no ordering, and it was displaying them willy-nilly.

cas

Thanks cvoogt.

VM team, can you let us know when this fix is implemented?

Actlas

Quote from: cvoogt on March 20, 2012, 15:22:08 PM
Not sure why this still hasn't been fixed but it's pretty simple;

Edit /administrator/components/models/custom.php

Right after this:
if($search){

$search = '"%' . $this->_db->getEscaped( $search, true ) . '%"' ;

$query .= 'AND `custom_title` LIKE '.$search;

}


Insert this (should be around line 191):

$query .= ' ORDER BY ordering ASC';

The custom fields list query had no ordering, and it was displaying them willy-nilly.

This doesn't work for me? I added this code and I want to change the order of the custom fields of a product in the backend but they don't change in the frontend?!
Is there a workaround for this problem? I am using the latest version of Virtuenet.
This is a huge flaw imo

You can see an example here:
http://dev.actual-laser.be/index.php/e-shop/deurbellen-diepgegraveerd/california-cnc-detail

I also tried renaming the custom fields with aa and bb to check if it works in alfabethical order but it doesn't work either...

ash

I have the same issue, latest version of Joomla and VM  I have a product with 6 custom fields, and regardless of the order in the back end the front end just shows them how ever it wants to, I try to change the order of the fields in the Joomla admin but the sort order or move up and down does not work.

Is there still not a fix for this as it would appear this issue has been around for a while now.

ash

Well the only way to resolve this issue was to go to the database and edit the order numbers to the order i want them in

1 custom attribute
2 custom attribute
3 custom attribute
4 custom attribute
etc etc

In the front end my custom fields for my products are now ordered correctly so the shopper is now able to buy an item without being completely confused about the product asking them for their items colour before actually choosing the product style first.

Not being able to order this list is one of the biggest pitfalls in Virtuemart, i recommend that people with large stores with many attributes use another solution or think and plan very very carefully first.

The only issue i see is that if another attribute becomes available for a product and needs to slot in between two others, then this is going to either be practically impossible or take you a heck of a long time to do.

Serious thinking on this major issue needs to be thought through by the developers.

Gees lets make it a $10 component and get it working right, i would pay that all day long. Even better if it had dynamic attributes like many of the free wordpress stores or magento.

Bigfish

Have the same problem.
I loaded 19 custom fields & tried to sort etc but no luck so started a thread (http://forum.virtuemart.net/index.php?topic=102729.0) then found this one.


Joomla 2.5.4 & VM 2.0.6 (Fresh Installs) PHP 5.2.17

cas

VM Team,

Can you let us know when this will be fixed?

razor7

Hi, I have ran into this issue again, solved this way on VM 2.0.8c :
Changed administrator/components/com_virtuemart/models/customfields.php line 818
Quote$query .= ' and is_cart_attribute = 1 group by virtuemart_custom_id';
To this
Quote$query .= ' and is_cart_attribute = 1 group by virtuemart_custom_id order by C.ordering';

Missing ordering statement!

Also, in custom field administrator, there is no way to get the items ordered by ordering columnb, bacause no matter if you click the orering column title, there is no ordering performed.

Best regards!
MGS Creativa - VirtueMart Payment Plugin Experts
http://www.mgscreativa.com

Take a look at our downloads section for VirtueMart payment plugins and mouch more!
http://www.mgscreativa.com/en/online-store

sleepigrl

razor7, you and I were on the same track!

I was in the process of modifying some other queries for ordering when I found your post.  I've made some additional changes and the end result is that the custom fields for the product are be sorted by (1) custom field order then (2) order within the custom field.

I made the changes to administrator/components/com_virtuemart/models/customfields.php @ lines 418, 735, 819 and 854.  The following is a WinMerge generated patch file.


418c418
< Where `virtuemart_product_id` =' . $virtuemart_product_id . ' order by field.`ordering` ASC';
---
> Where `virtuemart_product_id` =' . $virtuemart_product_id . ' order by C.`ordering`, field.`ordering` ASC';
735c735
< $query .= ' and is_cart_attribute = 0 order by field.`ordering`,virtuemart_custom_id';
---
> $query .= ' and is_cart_attribute = 0 order by C.`ordering`, field.`ordering`,virtuemart_custom_id';
819c819
< $query .= ' and is_cart_attribute = 1 group by virtuemart_custom_id';
---
> $query .= ' and is_cart_attribute = 1 group by virtuemart_custom_id order by C.ordering';
854c854
< $query .= ' ORDER BY field.`ordering`';
---
> $query .= ' ORDER BY C.`ordering`, field.`ordering` ASC';



In the admin, clicking the ordering button still has no effect, but input into the ordering fields does seem to be saved. 

easy

Thank you sleepgirl & razor7!
Great job - it works well!

cas

VM team,

Any chance to fix this in the base so we don't have to hack the code? 

encreplus

Dont work on 2.0.10 ;(

Stefan