friends. I need a form where there will be categories and subcategories in the checkbox. The search result can be varied according to the pattern:
My question is : what is the best way to pass the information by POST and play in a loop to display the products according to their category and subcategory.
This will give me all products. I need something like this to reber information via POST and display only specific products.
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'product',
'paged' => $paged,
);
$wp_query = new WP_Query($args);
if (!isset($_GET['all']))
{
?>
<?php do_action('woocommerce_archive_description'); ?>
<?php if (have_posts()) : ?>
<?php
// I don't want the sorting anymore
//do_action('woocommerce_before_shop_loop');
?>
<ul class="products">
<?php while (have_posts()) : the_post(); ?>
<li>
<?php woocommerce_get_template_part('content', 'product'); ?>
</li>
<?php endwhile; // end of the loop. ?>
</ul>
<?php
/* woocommerce pagination */
do_action('woocommerce_after_shop_loop');
?>
<?php elseif (!woocommerce_product_subcategories(array('before' => woocommerce_product_loop_start(false), 'after' => woocommerce_product_loop_end(false)))) : ?>
<?php woocommerce_get_template('loop/no-products-found.php'); ?>
<?php endif; ?>
<?php
}
else
{
// Code to display the product categories with thumbnails.
}
?>
Aucun commentaire:
Enregistrer un commentaire