您能帮我解决项目之间的空白吗? Woocommerce自定义类别

时间:2019-04-05 14:32:40

标签: jquery wordpress woocommerce

有人可以帮我解决这个问题吗?我无法解决整体类别产品之间的差距,用棕色突出显示。

尝试了所有内容,我对此很陌生...它从第9行开始。 https://www.miroslava.us/e-shop/?Cat=zakusky

<?php /* Template Name: e-shop Page */ ?>





<!-- Code to get Header from header.php  -->

<?php get_header(); 

$FirstCategory='';

$RequestCat=$_REQUEST['Cat'];

$ProdSubcat=$_REQUEST['ProdSubcat'];



?>



<!-- End of Code to get Header from header.php  -->



<!-- Products page  -->

<div class="container-fluid" id="ProductsPage">

<!--Cart Total-->

<div class="container-fluid ProdCartStatus">

<div class="row">

<div class="col-sm-12"><div id="ProdTxtTopInd">Doprava po Třinci <span id="prodtitletext">zdarma</span> při nákupu nad 500 Kč, jinak 100 Kč</div><div id="ProdShoppingCartDisplay"><!--<a href="<?php echo get_page_link( get_page_by_title("cart")->ID ); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><img id="eshopcartimage" src="<?php echo get_stylesheet_directory_uri(); ?>/images/ShopCart.png"/></a>--><?php echo sprintf ( _n( '%d Ks', '%d Ks', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> zboží za <?php echo WC()->cart->get_cart_total() . ' s DPH'; ?>

</div></div>

</div>

</div>

<!--End of Cart Total-->


<!---- Products and Categories Content Area---->

<div class="container-fluid" id="ProductsContentArea">

<?php



?>

    <div class="row">

<!-- Product Cateogy and sub-categories -->

        <div class="col-md-3">









           <div class="panel-group" id="accordion">



                <?php



                  $taxonomy     = 'product_cat';

                  $orderby      = 'description';  

                  $show_count   = 0;      // 1 for yes, 0 for no

                  $pad_counts   = 0;      // 1 for yes, 0 for no

                  $hierarchical = 1;      // 1 for yes, 0 for no  

                  $title        = '';  

                  $empty        = 0;

                  $MainCatCount = 1;



                  $args = array(

                         'taxonomy'     => $taxonomy,

                         'orderby'      => $orderby,

                         'show_count'   => $show_count,

                         'pad_counts'   => $pad_counts,

                         'hierarchical' => $hierarchical,

                         'title_li'     => $title,

                         'hide_empty'   => $empty

                  );

                 $all_categories = get_categories( $args );

                 $TotalCatCount = 1;



            foreach ($all_categories as $cat) {

                if (strpos($cat->description,"Disable")==false && $cat->name!='Uncategorized'){

                    if($cat->category_parent == 0) {

                        if ($TotalCatCount==1){

                            $FirstCategory = $cat->slug;



                        }

                        $TotalCatCount = $TotalCatCount+1;

                        $category_id = $cat->term_id;

                        ?>

            <div class="panel panel-default">

          <div class="panel-heading <?php if ($MainCatCount==1 && $RequestCat=='') {echo 'actives';} elseif ($RequestCat==$cat->slug){echo 'actives';}?>">

            <h4 class="panel-title">



              <?php

        echo '<a class="ProductMainCat accordion-toggle" catname="' . $cat->slug . '" href="#'. $cat->slug .'" data-toggle="collapse" data-parent="#accordion">'. $cat->name .'</a>';     

              ?>

            </h4>

          </div>

                        <?php       

                        $args2 = array(

                                'taxonomy'     => $taxonomy,

                                'child_of'     => 0,

                                'parent'       => $category_id,

                                'orderby'      => $orderby,

                                'show_count'   => $show_count,

                                'pad_counts'   => $pad_counts,

                                'hierarchical' => $hierarchical,

                                'title_li'     => $title,

                                'hide_empty'   => $empty

                        );

                        $sub_cats = get_categories( $args2 );

                        if($sub_cats) {

                            ?>

                            <div id="<?php echo $cat->slug;?>" class="panel-collapse collapse <?php if ($MainCatCount==1 && $RequestCat=='') {echo 'in';} elseif ($RequestCat==$cat->slug) {echo 'in';}?>">



    <ul class="ProductSubCat list-group">

       <?php

                            foreach($sub_cats as $sub_category) {

                                echo '<li class="list-group-item"><a class="ProdName" catname="' . $cat->slug . '" ProdSubcat="'. $sub_category->slug . '" href="'. get_term_link($sub_category->slug, 'product_cat') .'">'. $sub_category->name .'</a></li>';



                                //echo '<li class="list-group-item"><a class="ProdName" catname="' . $cat->slug . '" prodname="'. $sub_category->slug . '" href="'. get_term_link($sub_category->slug, 'product_cat') .'">'. $sub_category->name .'</a></li>';

                            }

                            ?>

                            </ul>

  </div>

                            <?php   

                        }

                        ?>

                        </div>

                        <?php

                    $MainCatCount++;

                    }

                }

            }

        ?>

            </div> 



        </div>

<!--End of Product Cateogy and sub-categories -->



<!-- Products Content layout pane -->

            <div class="col-md-9" id="ProductContentDisplayPane">

<div class="row overlayimage" align="center"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/loading-spinner.gif" id="spinner" class="img-responsive"/></div>



                <div class="row">

<?php

if ($RequestCat!='' && !isset($ProdSubcat)){

$FirstCategory=$RequestCat;

$args = array( 'post_type' => 'product', 'posts_per_page' => 100, 'orderby' => 'name','product_cat' => $FirstCategory,'tax_query' => array(

            array(

                'taxonomy' => 'product_cat',

                'field' => 'slug',

                'terms' => array( 'mini' ),

                'operator' => 'NOT IN'

                )

            ));

}

elseif ($RequestCat!='' && $ProdSubcat!=''){

$FirstCategory=$ProdSubcat;

$args = array( 'post_type' => 'product', 'posts_per_page' => -1, 'orderby' => 'name','product_cat' => $FirstCategory);

}

else

$args = array( 'post_type' => 'product', 'posts_per_page' => -1, 'orderby' => 'name','product_cat' => $FirstCategory,'tax_query' => array(

            array(

                'taxonomy' => 'product_cat',

                'field' => 'slug',

                'terms' => array( 'mini' ),

                'operator' => 'NOT IN'

                )

            ));

$loop = new WP_Query( $args );

//$loop = new WP_Query( array( 'cat' => 4 ) );



    while ( $loop->have_posts() ) : $loop->the_post(); 

    global $product; 



    $image = wp_get_attachment_image_src( get_post_thumbnail_id( $loop->post->ID), 'full');

$postcat = get_the_category();

$args = array( 'taxonomy' => 'product_cat',);

$terms = wp_get_post_terms($loop->post->ID,'product_cat', $args);

if (strpos($term->description,"Disable")==false){

?>

                    <div class="col-sm-3 col-lg-3 col-md-3">

                        <div class="thumbnail">

                         <div class="ProductTitle"><?php echo $product->get_title(); ?></div>

                          <div class="ProductThumb"><a href="<?php echo get_bloginfo('url') ?>/product-detail/?PID=<?php echo $product->get_id(); ?>&Cat=<?php echo $FirstCategory;?>" target="_new" title='<?php echo $product->get_title(); ?>'><img src='<?php  echo $image[0]; ?>' class='ProduThumbnailimage thumbnail img-responsive eshopProductThumb'></a><div class="DisplayProdPrice"><span>Cena: <?php echo wc_price($product->get_price());?></span></div></div>

                         <div class="ProductCartSel"><div class="clearfix"><span class="align-bottom"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/Button_plus.png" alt="Image" id="Add<?php echo $product->get_id(); ?>" class="buttonplus pull-left"/><input type="text" name="txtQty" id="txtQty<?php echo $product->get_id(); ?>" value="1" size="1" class="txtQty pull-left"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/Button_minus.png" id="Remove<?php echo $product->get_id(); ?>" alt="Image" class="buttonminus pull-left"/></span><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/AddtoCart1.png" alt="Image" id="ImgAddtoCart<?php echo $product->get_id(); ?>" class="img-responsive ImgAddtoCart pull-right" width="80px" height="22px"/></div></div>

                         <div id="HidProdDesc"><?php echo apply_filters( 'woocommerce_short_description', $product->post->post_excerpt );?></div><div id="HidProdID"><?php echo $product->get_id();?></div> <div id="HidProdPrice">Cena s DPH: <?php echo wc_price($product->get_price());?></div><div id="HidProdWeight">GRAMÁŽ: <?php echo $product->get_weight() . ' ' . get_option('woocommerce_weight_unit');?></div>   <div id="HidProdExpiry">TRVANLIVOST: <?php echo $product->get_attribute('TRVANLIVOST');?></div>  <div id="HidProdItemNo">ČÍSLO VÝR: <?php echo $product->get_sku();?></div><div id="HidProdCatName"><?php echo $product->get_categories();?></div>

                        </div>

                    </div>

<?php

}

endwhile; 



wp_reset_query();



?>



                </div>



            </div>

<!-- End of products content layout pane -->

        </div>



    </div>



 <!----End of Products and Categories Content Area---->   



</div>

<!-- End Products page  -->



<!---- LightBox Html -->



<div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">

  <div class="modal-dialog">

  <div class="modal-content">

    <div class="modal-header">

        <button type="button" class="close" data-dismiss="modal">×</button>

        <h3 class="modal-title ProductTitle ProductLightboxTitle">Image 3</h3>

    </div>

    <div class="modal-body">



<div class="col-md-12 ProductDetailImagePane">

   <div class="pull-left" id="ProductThumbnailImageContainer"><img src='' class='ProduThumbnailimage img-responsive' id="LightboxProductImage"></div>

   <div class="ProductDetailPane">

                      <div id="ProductDetailRate"></div>

                      <div id="ProductDetailDesc"></div>

                      <div id="ProductWeight"></div>

                      <div id="ProductExpiry"></div>

                      <div id="ProductItem"></div>

                      <div id="ProductAddRemoveProduct"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/Button_plus.png" alt="Image" id="AddL" class="buttonplusL"/><input type="text" name="txtQtyL" id="txtQtyL" value="1" size="1" class="txtQty"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/Button_minus.png" id="RemoveL" alt="Image" class="buttonminusL"/><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/AddtoCart1.png" alt="Image" id="ImgAddtoCartL" class="ImgAddtoCartL" width="80px" height="22px"/></div>

                      <div id="ProductPDF"></div>

                      </div>

</div>



    </div>

    <div class="modal-footer">

        <button class="btn btn-default" data-dismiss="modal" id="lightboxclosebtn">zavřít</button>

    </div>

   </div>

  </div>

</div>



<!----- End of LightBox Html -->



<!---- Alert box Bootstrap HTML  -->



  <div class="modal fade" id="callbackAddToCart" role="dialog">

    <div class="modal-dialog modal-lg">

      <div class="modal-content">

        <div class="modal-header">

          <button type="button" class="close" data-dismiss="modal">&times;</button>

          <h4 class="modal-title">Položka byla úspěšné přidána do košíku</h4>

        </div>

        <div class="modal-body">

          <p><a href="<?php echo get_page_link( get_page_by_title("e-shop")->ID ); ?>" target="_self">Pokračovat v nákupu</a> nebo <a href="<?php echo get_page_link( get_page_by_title("cart")->ID ); ?>" target="_self">přejít do košíku</a></p>

        </div>

        <div class="modal-footer">

          <button type="button" class="btn btn-default" data-dismiss="modal" id="alertclosebtn">zavřít</button>

        </div>

      </div>

    </div>

  </div>





    <!-- End of Alert box Bootstrap HTML -->



<!-- Code to get footer from footer.php  -->

<?php get_footer(); ?>

<!-- End of Code to get footer from footer.php  -->

0 个答案:

没有答案