Forums › Forums › Search & Filter Pro › Woocommerce Product Variations
Tagged: Woocommerce Product Variations
- This topic has 13 replies, 2 voices, and was last updated 9 years, 8 months ago by Ross.
-
Anonymous(Private) April 1, 2015 at 5:18 pm #14340
I think you should do a query similar to this one and use the resulting ids to query the wp_postmeta table:
SELECT CONCAT(wp_posts.ID,’,’,GROUP_CONCAT(wp_posts_variations.ID)) as ids FROM wp_posts as wp_posts
LEFT JOIN
wp_posts as wp_posts_variations
ON (wp_posts.ID = wp_posts_variations.post_parent)
WHERE wp_posts_variations.post_type = ‘product_variation’ AND wp_posts.post_type = ‘product’
GROUP BY wp_posts.IDRoss Moderator(Private) April 1, 2015 at 5:35 pm #14341Hey there
I had a user who had problems with post meta and product variation – unfortunately we never got to a quick solution.
I’m wondering, are product variations just child posts of the parent post (product)? If so, they should be included in the search, perhaps they have some strange status applied to the post type (ie, not published) which means that a regular WP_Query skips these…?
Not sure if you would know, but would love to add it to the plugin if its not working properly.
RE your SQL above, this does sound right – but I’m trying not to use any custom SQL syntax, rather keeping to the methods that are found within WP_Query (minus the sql stuff) – just for forwards compatibility.
Thanks
Anonymous(Private) April 1, 2015 at 6:07 pm #14343ID post_author post_date post_date_gmt post_content post_title post_excerpt post_status comment_status ping_status post_password post_name to_ping pinged post_modified post_modified_gmt post_content_filtered post_parent guid menu_order post_type post_mime_type comment_count
35 1 2015-03-30 17:03:41 2015-03-30 15:03:41 Variation #35 of AR111-15W publish closed open product-20-variation 2015-03-30 17:03:41 2015-03-30 15:03:41 20 http:/***.com/product_variation/product-20-variation/ 0 product_variation 0A product variations looks like this one, it’s a child post and it’s published but has “product_variation” as post_type instead of “product” so the query generate by your plugin query will skip it, also this custom post type isn’t shown in admin by default.
I will look for a more solid way to implement the query but you should absolutely support product variations, the most of the products has a variation (color, sizes, etc)Anonymous(Private) April 1, 2015 at 6:48 pm #14348I’ve found out that the best way to do this will be to use taxonomies, every attribute of a child product is also assigned as a taxonomy to the parent, it works out of the box just setting taxonomies to public.
Now, is it possible to query taxonomies using a range slider?
Ross Moderator(Private) April 1, 2015 at 6:57 pm #14349Ahhh thanks for your help – yeah I thought taxonomies were working fine but not the meta queries (on things like price)…
Unfortunately no its not possible to set a taxonomy as a range slider as taxonomies aren’t designed to handle numeric data – what kind of numeric data are you trying to apply the slider to?
Thanks
Anonymous(Private) April 1, 2015 at 7:06 pm #14350I have attributes like power consumption (watts), light intensity (lumen), light cone wideness (°deg)
(ex. http://beta.domagic.it/product/ledcandle/)So i really need a solution like a range slider, what would you suggest?
Anonymous(Private) April 2, 2015 at 11:35 am #14395Hi Ross, I appreciate your offer but it will not be necessary, I like your plugin and I’m pretty sure i will use it in other projects in future.
Plus, I’m back to post_meta and I’ve a working solution https://gist.github.com/914f5ac1b942f8c51778
I went for the fastest way, I would like to overwrite your filters (filter_meta_query_where,filter_meta_join ) from a plugin, what would be the right way to do that?Check it and if you like consider implementing it directly in your plugin, maybe after some optimization.
Anonymous(Private) April 2, 2015 at 12:16 pm #14396Oh, sorry, there was an error, it should be fixed now https://gist.github.com/anonymous/74b83b79457daa810843
-
AuthorPosts