Home › Forums › Community Support Forum › WordPress Plugins › Orbisius Quick Order for WooCommerce › Order Form display order
Tagged: custom, display order, order form, SKU
- This topic has 8 replies, 3 voices, and was last updated 9 years, 3 months ago by Slavi Marinov.
-
AuthorPosts
-
June 20, 2014 at 5:09 pm #2167FredTheValetParticipant
We would like to order display items on the Form by SKU rather than Name – is this possible or is there a workaround you can think of to do this?
Thanks!
– Fred.
June 21, 2014 at 9:04 am #2170Slavi MarinovKeymasterHi,
Just pushed a new release which should allow you to sort by sku.
Please, check the examples in plugin’s plugin’s settings ( WP Admin > Settings > Orbisius Quick Order for WooCommerce ).Slavi
June 26, 2014 at 3:19 am #2177FredTheValetParticipantHi Slavi –
I got the V1.1.4 update – thanks! The SKU orderby wasn’t working, so I looked at the code and it looks like there is a mix use of ‘order_by’ and ‘orderby’ in the get_products() function.
I’ve fixed my copy here for now – if you want me to send you my changes, I’d be happy to do so.
– Fred.
June 26, 2014 at 3:10 pm #2178Slavi MarinovKeymasterSure. Please do.
You can use the help email or the quote form to send it.I thought that there might be some issues if you have numeric SKU’s because WP stores them as meta fields which are chars (by default).
June 26, 2014 at 6:03 pm #2179FredTheValetParticipantDidn’t think of that! Fortunately, the customer’s SKUs are all five digits, so the SQL order works just fine.
The problem was a couple of array elements using ‘orderby’ when they should have been ‘order_by’ (or vice-versa) – I’ll email you the details, line#’s, etc.
– Fred.
June 26, 2014 at 6:21 pm #2180Slavi MarinovKeymasterAwesome thanks Fred.
I know in the plugin I’ve used order_by where in WP orderby is used.June 26, 2014 at 6:47 pm #2181Slavi MarinovKeymasterPatch received. Thanks & a new version was released.
August 18, 2015 at 4:26 pm #2915ledzep100ParticipantWould it be possible to order off of a different metafield/key? AKA custom order_by. My SKUs & pricing are arbitrary to the order I prefer.
I tried adding a custom meta field under the product in the product page called “order_form”. Then of course adding a number to the new meta field (1-whatever). I then added a “_” in phpmyadmin infront to make it a meta_key so “_order_form”.
Then I tried adding “order_form” in the array like so (line 1420):// the user actually wants to sort products by meta but has forgotten the underscore in front elseif ( in_array($filters['order_by'], array('sku', 'price', 'regular_price', 'sale_price', 'order_form')) ) { $args['meta_key'] = '_' . $filters['order_by']; // autoprefix it. $args['orderby'] = 'meta_value'; } else { $args['orderby'] = $filters['order_by']; } if (!empty($filters['order'])) { $args['order'] = $filters['order']; } }
Then in the shortcode I used the order_by=”_order_form” instead of order_by=”_sku”
I tried troubleshooting with no luck.
I really thought it would work since the _sku meta_key is stored in the table the same way as the custom meta fields of the product.
I’m learning WP development and php in a trial by fire fashion. I was super proud until it didn’t work at all. I thought I was onto something. It’s probably something obvious.
Thank you for the plugin! It’s exactly what I needed and will be recommending it to other Woo users.
Thanks for you time!August 19, 2015 at 8:35 am #2916Slavi MarinovKeymasterHi,
You were very close.
Can you try without the leading underscore?
The plugin prefixes the field if it’s in the array you mentioned.order_by="order_form"
Slavi
-
AuthorPosts
- You must be logged in to reply to this topic.