<?php
 /**
   * The template for Shop.
   *
   *
   * @package   bpm128 WordPress Theme
   * @copyright Copyright (C) 2016, OrdaSoft
   * @license  http://www.gnu.org/licenses/gpl-2.0.html  GNU General Public License v2 or later
   * @author    AUTHOR <www.ordasoft.com>
   * bpm128 is distributed under the terms of the GNU GPL
   */
$posts_per_page = get_theme_mod( 'bpm128_products_show', '5' );
$args=array(
    'post_type' => 'product',
    'post_status' => 'publish',
    'posts_per_page' => $posts_per_page,
);
$my_products = null;
$my_products = new WP_Query($args);?>
<ul class="products-list">
<?php
if( $my_products->have_posts() ) {
$position = 0;
while( $my_products->have_posts() ){ $my_products->the_post(); ?>
<?php if ( $position % 1==0 ) {
         $position++;
        if ($position != 0 and $position % 1==0) { ?>
        <li class="product-item <?php if ($position != 0 and $position%2==0) :
                                                    echo 'right-product';
                                                    else :
                                                    echo 'left-product';
                                                    endif;?>" >
        <?php } ?>
        <section class="product-body">
          <?php get_template_part( 'template-parts/shop/content', 'product' ); ?>
        </section>
    </li>

<?php }
} 
wp_reset_query();
} else {
    get_template_part( 'template-parts/post/content', 'none' );
} ?>
</ul>