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

[bugfix?] Display order for custom fields

Started by sleepigrl, August 09, 2012, 20:21:04 PM

Previous topic - Next topic

sleepigrl

I posted this yesterday in the Product Creation forum, but I'm reposting here in hopes that this change could be evaluated for inclusion in core.  I changes to administrator/components/com_virtuemart/models/customfields.php 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.


See:  http://forum.virtuemart.net/index.php?topic=90362.msg354017#msg354017

Milbo

I think openglobal took care of it. Should be already in the svn.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

sleepigrl

I don't see those changes in the SVN, unless I'm missing it or looking in the wrong place.  I'm looking here:  https://dev.virtuemart.net/svn/virtuemart/trunk/virtuemart/administrator/components/com_virtuemart/models/customfields.php 

Best as I can tell, that one will still sort only by the ordering within each customfield, not by the ordering of the customfields themselves.

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/

sleepigrl

I do not have a development environment set up at this point, but I downloaded the customfields.php file from the SVN and replaced mine.  The custom field order that I selected in the admin was ignored.

In customfields.php the join in this query causes the final ordering to be determined by the ordering within the custom field - the multiple values used for rearranging sizes, etc.  For a custom field that doesn't have multiple values, the ordering is always 0.  Other queries use the same logic for ordering, so they have the same results.
$query = 'SELECT C.`virtuemart_custom_id` , `custom_element`, `custom_jplugin_id`, `custom_params`, `custom_parent_id` , `admin_only` , `custom_title` ,
`custom_tip` , C.`custom_value` AS value, `custom_field_desc` , `field_type` , `is_list` , `is_cart_attribute` , `is_hidden` , C.`published` , field.`virtuemart_customfield_id` ,
field.`custom_value`,field.`custom_param`,field.`custom_price`,field.`ordering`
FROM `#__virtuemart_customs` AS C
LEFT JOIN `#__virtuemart_product_customfields` AS field ON C.`virtuemart_custom_id` = field.`virtuemart_custom_id`
Where `virtuemart_product_id` =' . $virtuemart_product_id . ' order by field.`ordering` ASC';



It seems that we really need to have both fields in use for ordering, so that fields are ordered first by their order from the customfield list in the admin and then by their order within the customfield. 

Where `virtuemart_product_id` =' . $virtuemart_product_id . ' order by C.`ordering`, field.`ordering` ASC';

As a side note, I tried to connect to the SVN with tortoise to grab all the files at once, but it tells me a need a username & password. 

celticwebs

I think I have just come across this bug too, I'm on the latest release 2.0.10 and a client has just asked me how she adds a custom field to the beginning of a list of products custom fields that already exist on a product.  I can't for the life of me work out ow you reorder them.  there doesn't seem o be anywhere to do it, I di dit in the main custom fields section and it had no effect on the order shown in the product.  The only way I can see to do it would be to delete all the custom fields from the product then add them all back in putting the new one in first, surely this sin't the only way to do it? 

Any help would be greatly appreciated.  Theres quite a few products I would need to spend a lot of time on if this simple feature isn't available in the software.