News:

Support the VirtueMart project and become a member

Main Menu

Order of custom fields

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

Previous topic - Next topic

sleepigrl

@encreplus, I made the same changes to my 2.0.10 version just a few minutes ago and the ordering is applied correctly. 

One thing to note, clicking on the Ordering header in the admin (ostensibly to sort by ordering) has no effect.  But making manual changes to the order there does affect the order that the custom fields are displayed in the frontend using the hack I posted above.

cas

VM team,

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

cmb

Quote from: cas on August 25, 2012, 01:58:13 AMAny chance to fix this in the base so we don't have to hack the code?

The code given by sleepigrl above in this thread works. One hopes that it will find its way into the code soon. I just upgraded to VirtueMart 2.0.12b and, of course, had to dredge up the old \administrator\components\com_virtuemart\models\customfields.php file to get my site working correctly again.

I noticed that Matt Lewis-Garner changed the Status of the bug report from Assigned to Resolved two months ago. The Issue is still open but marked 100% Done. Can anyone tell us when the repairs will be implemented?
Charles

neo314

I'm using 2.0.14 and sleepigirl's code does not seem to work in that and the ordering is still not fixed on my install. Any updates on this issue?

selor

This fix doesnt working on 2.0.14 ..

Grr What the hell about this problem ???
it exist for a longgggggggggggggggggg Time ago and the custom fields always gone me mad with this order that is not considered ..

Pliz someone have a fix for that ???

Production: Joomla 2.5.8 | VM 2.0.15d | PHP Version 5.3.19 Apache 2.0 Handler

Safe Mode : Disabled
Disabled Functions:set_time_limit,passthru,exec,system,popen,shell_exec,proc_open

cas


Milbo

Selor, the fix does not work ,because the fix is already there. How do you add a fix, if there is already the same code. I just checked the code.

Also works for me. So maybe your problems are due an hacked store?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

T.A. Garrison, LLC

Quote from: Milbo on January 13, 2013, 11:41:21 AM
Selor, the fix does not work ,because the fix is already there. How do you add a fix, if there is already the same code. I just checked the code.

Also works for me. So maybe your problems are due an hacked store?

I have not applied "any" hacks, and the sort does not work for me. I keep adding and removing the custom fields because they "do not" sort correctly.

I want "First Flavor 1", "Second Flavor 1", "First Flavor 2", "Second Flavor 2", "Third Flavor 1" and "Third Flavor 2" in that order.
I can't get 16 flavor names in the "Default" custom field, so I have to create the first and second flavor select lists - another issue that should have already been addressed. I don't want to edit the database because the client will need to update flavors, pricing, attributes, etc., over time and won't be aware of the issue(s) every time they update.
These issues are tolerable for developers to work around. But clients who simply "use" the site don't have any idea about how and why these simple annoyances are keeping them from having their site work properly.
So Virtuemart needs to be addressed in order that clients don't have to keep calling and paying developers to "fix" their site.

So, in order to have 16 flavors from which to choose, and allow the user to select 3 of the 16, I have to have 6 select lists each with 8 options (flavors). This "should" be done with 3 select lists.
But every time I add the second list, even only the first half, it appears on the front-end "above" the first list. In the back-end, the ordering column displays the sort number ("Ordering" column) I last applied. But the front-end is not responding to what is shown in the back-end.

My next attempt will be to add the lists in reverse order.
Please. Don't say that this is fixed when it's not.
Having to input everything in reverse order is more than simply an annoyance. And when the client updates something it will be all out of order again and "I" am the one who is going to be in trouble.

I'm using the latest update, to which I just updated my client today - 2.0.18a.

Please don't consider this a complaint - simply stating the facts and asking if, perhaps, I've overlooked something that needs to be addressed, or, instead, if the "fix" is not...
T.A. Garrison, LLC
3150 Orleans St. # 28261
Bellingham, WA 98228

T.A. Garrison, LLC

Here is the resolve "I" found to work for my specific project.
So you understand in order to see if it will work for you, I have 1 product that needs to have 3 selections made for the order. Each of the 3 selections must be from the same list of 16 flavors.
So, the customer needs to select 3 flavors from a list of 16.

Here is the working site http://www.superiorvaping.com/vaping-products/sample-packs/34/sample-pack-detail.html

This was my process:

After creating your product:
1 Create a "Custom Field" (New)
   Custom Field Type: Cart Variant
   Title (whatever you wish)
   Published: Yes
   Parent: "Please Select" (which is NONE - leave at default)
   Cart Attribute: Yes
   Description, Default, Tooltip and Layout position are all blank
   Admin only: No
   Is a list? No
   Hidden: No

2 Save and Close that field.

3 Repeat step 1 for each drop-down box you wish to create for your 1 product.

4 Sort the custom fields you have just created.
4a Type in the numbers you wish for the custom fields you want displayed with your product.
The first field should have the lowest number and the last field will have the highest number.
Save the updated sort order.

5 Select Products > "Your Product" > Custom Fields

6 Under "Custom Field Type:" select one of the custom fields you created in step 1.
6a For every option you want added to one drop-down list, repeat step 6, making sure to select the same custom field name. If you want several drop-down selection boxes you'll need to select and add the custom field name as many times as you want options for that 1 drop-down box.

7 Type in the text you want displayed as one of the options in your drop-down list in the blank "Value" box to the right of your custom field name.
7a Repeat this process for each of the blank fields you created.

8 OPTIONAL
If you want to add a fee with each (or some) selection(s), replace the "0" in the "Price" box with the value you wish "added" to your product price.

9 Save the entries you just made and review the new options for your product on the front-end of your site.

I spent a couple of days on this, trying variations of "Group", custom field with "Default" text (which wasn't large enough to fit all the flavors) and other ideas. Nothing worked that would also allow me to sort the boxes in the order I wanted. I read the hacks and possible outcomes of using a hack. Since I'm always dealing with clients who don't want to spend much I'm constantly trying to assure that when I'm finished, the project is going to do what the client needs without my constant attention.
Hacking means I'll have to be back whenever there is an update, and perhaps even when there is just something the client "should not have done".
I don't have that luxury and I'm sure a lot of you don't.
So my goal was to find a solution that may have been a bit more involved than I wanted but no hacking, and the client won't have to worry about messing with anything later.

I hope this helps your situation.
T.A. Garrison, LLC
3150 Orleans St. # 28261
Bellingham, WA 98228

Popandos

Hello, i saw that this bug have appeared after 2.0.20b update. There is no Sleepgirl's fix in the customfields.php file, so the custom fields aren't ordering by order field now, only by custom id. The problem had been solved after i made that hack. So, i hope, that this fix will be in the later updates of virtuemart.

Actlas

Thank you so much sleepigirl and all others! This worked for me on vm 2.0.6.

cas

Is this fixed in the base?  In the admin, Custom fields aren't ordering by order field, but only by custom id.

LeonZ

After updating to 2.0.22a my custom fields messed up again. thanks to this old post got it on the right track fast and I was able to sort on my custom ordering again. D*mm, I wasn't thinking about dragging and dropping the custom fields ordering by hand for all my products.

TNX

Quote from: sleepigrl on August 07, 2012, 19:24:39 PM
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. 


denvarel

Quote from: LeonZ on August 03, 2013, 10:53:21 AM
After updating to 2.0.22a my custom fields messed up again. thanks to this old post got it on the right track fast and I was able to sort on my custom ordering again. D*mm, I wasn't thinking about dragging and dropping the custom fields ordering by hand for all my products.

TNX

Quote from: sleepigrl on August 07, 2012, 19:24:39 PM
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. 

Confirmed to work either in Virtuemart 2.0.24 the lines numbers is different and in (previous line 819)now 824 the string
$query .= ' and is_cart_attribute = 1 group by virtuemart_custom_id';
is changed becoming:
$query .= ' and is_cart_attribute = 1 group by virtuemart_custom_id ORDER BY field.`ordering`';
and has to be replaced with
$query .= ' and is_cart_attribute = 1 group by virtuemart_custom_id ORDER BY C.`ordering`';