Ido Angel
Admite hilos creados en los últimos 30 días: 0
Debates favoritos del foro
Este usuario no tiene debates favoritos.
Temas del foro creados
Status | Debate | Supporter | Voces | Mensajes | Caducidad |
---|---|---|---|---|---|
Filter products by the ones which are currently in the cart
Iniciado por: Ido Angel
en: Toolset Professional Support
Problem: The user wanted to display a view of products according to the ones which are currently in the cart on the checkout page. Although not possible using native Toolset tools, custom PHP code can be used to achieve this. Solution: - Utilize WooCommerce hooks to get the list of products currently in the cart. function wpc_elementor_shortcode( $atts ) { // Get full cart object $items = WC()->cart->get_cart(); // Initialize array to store product IDs $product_ids = array(); // Loop through cart items foreach( $items as $item => $values ) { // Load product object $product = wc_get_product( $values['data']->get_id() ); // Access product data using product object $product_id = $product->get_id(); // Add product ID to array $product_ids[] = $product_id; } // Join product IDs into comma-separated string $product_ids_string = implode( ', ', $product_ids ); // Output comma-separated list of product IDs echo $product_ids_string; } add_shortcode( 'my_elementor_php_output', 'wpc_elementor_shortcode'); - Use the shortcode [my_elementor_php_output] to output the comma-separated list of product IDs currently in the cart. Relevant Documentation: WooCommerce - Get Products in Cart: https://wpdavies.dev/woocommerce-get-products-in-cart/ Toolset - Adding Custom Code: https://toolset.com/documentation/programmer-reference/adding-custom-code/using-toolset-to-add-custom-code/ PHP Implode function: https://www.php.net/manual/en/function.implode.php |
2 | 5 | hace 1 año, 8 meses | ||
relevanssi prevents from ordering by custom field
Iniciado por: Ido Angel en: Toolset Professional Support |
3 | 5 | hace 2 años, 2 meses | ||
taxonomy shows up only for a random post…
Iniciado por: Ido Angel en: Toolset Professional Support |
1 | 2 | hace 2 años, 2 meses | ||
wpv-post-next-link not working properly
Iniciado por: Ido Angel en: Toolset Professional Support |
3 | 9 | hace 2 años, 3 meses | ||
Infinite scroll created duplicate entries
Iniciado por: Ido Angel en: Toolset Professional Support |
2 | 5 | hace 2 años, 5 meses | ||
display taxonomy's parent in taxonomy view
Iniciado por: Ido Angel en: Toolset Professional Support |
2 | 5 | hace 2 años, 10 meses | ||
Same search filter for different post types (sharing taxonomies)
Iniciado por: Ido Angel
en: Toolset Professional Support
Problem: Customize the taxonomy archive pages. Solution: You can setup Toolset WordPress Archive for taxonomy "super-category", and add custom search form in it, see our document. Relevant Documentation: https://toolset.com/course-lesson/creating-a-custom-archive-page/ |
2 | 16 | hace 3 años, 10 meses | ||
too many taxonomies crash site
Iniciado por: Ido Angel en: Toolset Professional Support |
2 | 9 | hace 3 años, 10 meses | ||
views plugin adds extra elements in strange places
Iniciado por: Ido Angel en: Toolset Professional Support |
2 | 9 | hace 3 años, 10 meses | ||
Infinite scroll "load more" works only for logged in users
Iniciado por: Ido Angel en: Toolset Professional Support |
2 | 6 | hace 3 años, 11 meses | ||
Add product images to relationship filter dropdown
Iniciado por: Ido Angel en: Toolset Professional Support |
4 | 11 | hace 3 años, 11 meses | ||
view won't let me save with this code
Iniciado por: Ido Angel en: Toolset Professional Support |
2 | 8 | hace 4 años | ||
Load more button using the pagination
1
2
Iniciado por: Ido Angel en: Toolset Professional Support |
2 | 21 | hace 4 años | ||
Sort by relevance
Iniciado por: Ido Angel en: Toolset Professional Support |
2 | 5 | hace 4 años, 2 meses | ||
OR + AND in the same filter?
Iniciado por: Ido Angel
en: Toolset Professional Support
Problem: I have a custom search View that includes 4 custom taxonomy filters. I would like to set one of the filters to a static value, so that all the results include one term from that custom taxonomy. Then I would like to use the relation "AND" to combine that with a group of 3 other custom taxonomy filters, which can be chosen on the front-end by the User, and combined using the "OR" relation. The combined effect should be like this graphic representation: ------------------------------------------------------ | Recipe Category (equal to "Shake") | | | | - AND - | | | | ____________________________________________ | | | | | | | Main Ingredient (set by URL parameter) | | | | | | | | - OR - | | | | | | | | Extra Ingredient (set by URL parameter) | | | | | | | | - OR - | | | | | | | | Fluid (set by URL parameter) | | | -------------------------------------------- | | | ----------------------------------------------------- Solution: This type of combination of filters with nested AND/OR relations is not possible through the standard Views GUI, and requires a custom code solution. We offer the wpv_filter_query API that allows you to intercept the query and modify its tax_query details in real-time. function tssupp_change_tax_query_and_or($view_args, $view_settings, $view_id) { $view_ids = array( 22575 ); // comma-separated list of View IDs where you want to apply this filter $static_tax = 'recipe-category'; // the slug of the taxonomy that includes the static term "shake" $static_term_id = 1084; // the term ID of "shake" in the static taxonomy "recipe-category" /* -- do not edit below this line -- */ if ( in_array($view_id, $view_ids) ) { // new tax query template $new_tax_query = array( array( // code below will unshift selected front-end tax filters into this array 'relation' => 'OR', ), array( 'taxonomy' => $static_tax, 'field' => 'id', 'terms' => array( $static_term_id ), 'operator' => 'IN', 'include_children' => 1, ), 'relation' => 'AND', ); foreach ( $view_args['tax_query'] as $tax_query_term ) { // loop over selected filters, // verify is_array to skip 'relation' index, // verify the slug of this tax is not // same as the static taxonomy slug, // unshift it into the new query's OR block if( is_array($tax_query_term) && $tax_query_term['taxonomy'] != $static_tax ){ array_unshift( $new_tax_query[0], $tax_query_term ); } } // now overwrite the original tax_query with // the new tax_query and you're done $view_args['tax_query'] = $new_tax_query; } return $view_args; } add_filter('wpv_filter_query', 'tssupp_change_tax_query_and_or', 99, 3); Up at the top, modify the View if necessary to customize it for your site. You may add other View IDs to the $view_ids array in comma-separated format if you have more than one View with similar filters where you want to apply this custom snippet. I copied the taxonomy slugs and term IDs from the debug information, so I'm pretty sure those are correct. Add the code in your child theme's functions.php file, or in Toolset > Settings > Custom Code, and test it on the front-end of the site. Let me know the results and we can go from there. Relevant Documentation: |
2 | 7 | hace 4 años, 2 meses |