
Tagged: Product Grid, woocommerce
-
AuthorPosts
-
April 10, 2014 at 11:49 am #249725
hi again guys,
i added some custom sorting filters to woocommerce to sort my own product group. the filter is shown in woo-backend, but does not show in the product grid frontend as an option. may you have an idea? here is the code i use to add the filter:
// Sortierfilter zu Woocommerce hinzufügen function custom_woocommerce_get_catalog_ordering_args( $args ) { $orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) ); if ( 'MY-CUSTOM-FILTER-SELECT-1' == $orderby_value ) { $args['orderby'] = 'A-CUSTOM-FIELD-1'; $args['order'] = ''; $args['meta_key'] = ''; } elseif ( 'MY-CUSTOM-FILTER-SELECT-2' == $orderby_value ) { $args['orderby'] = 'A-CUSTOM-FIELD-2'; $args['order'] = ''; $args['meta_key'] = ''; } return $args; } function custom_woocommerce_catalog_orderby( $sortby ) { $sortby['A-CUSTOM-FIELD-1'] = 'CUSTOM-NAME-1'; $sortby['A-CUSTOM-FIELD-2'] = 'CUSTOM-NAME-2'; return $sortby; } add_filter( 'woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args' ); add_filter( 'woocommerce_default_catalog_orderby_options', 'custom_woocommerce_catalog_orderby' ); add_filter( 'woocommerce_catalog_orderby', 'custom_woocommerce_catalog_orderby' );
-
This topic was modified 11 years, 1 month ago by
isee.
April 11, 2014 at 3:24 pm #250252hi again, i found this part of code in /config-woocommerce/config.php
can you help me to ADD my custom types within the child theme:(edit – code removed)
-
This reply was modified 11 years, 1 month ago by
Dude.
April 14, 2014 at 8:50 am #250938Hi!
You just need to copy the entire avia_woocommerce_frontend_search_params function (located in /config-woocommerce/config.php) into your child theme functions.php file. Then modify the function code there. The child theme file will be loaded first and your custom sort function will overwrite the code in the parent theme files because we wrapped all functions into a function_exists() if statement. If you need help with the code implementation please hire a freelancer. I recommend a platform like: http://studio.envato.com/
Best regards,
PeterApril 14, 2014 at 11:58 am #250994hey dude, thanx for that, i integrated everything and its working fine :-)
-
This topic was modified 11 years, 1 month ago by
-
AuthorPosts
- The topic ‘Product Grid Woocommerce / Custom Sorting Filters’ is closed to new replies.