Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter jinx180

    (@jinx180)

    I should also mention that the Single Product page for each product still works fine.

    Edit:

    I’m pretty sure that this is causing the issue.

    <?php
                
                    $args = array(
                        'post_type' => 'product',
                        'posts_per_page' => 4,
                        'tax_query' => array(
                                array(
                                    'taxonomy' => 'product_visibility',
                                    'field'    => 'name',
                                    'terms'    => 'featured',
                                ),
                            ),
                        );
    
                    $loop = new WP_Query( $args );
                
                    while ( $loop->have_posts() ) : $loop->the_post();
                                    
                        global $product;
                  
                        $currency = get_woocommerce_currency_symbol();
                        $price = get_post_meta( get_the_ID(), '_regular_price', true);
                        $sale = get_post_meta( get_the_ID(), '_sale_price', true);
                        if($sale) {
                            echo '
                        <div class="pickproductsitem">
                          <div class="pickprodimage" style="background-image: url(' . get_the_post_thumbnail_url() . ');"></div>
                          <div class="prodname">'.get_the_title().'</div>
                          <div class="prodinfo">'. get_the_excerpt() .'</div>
                          <div class="prodprice"><span style="text-decoration: line-through;">Only '.$currency.$price.'</span><span style="color: green;"> SALE '.$currency.$sale.'</span></div><a href="'.get_permalink().'" class="prodbutton w-button">VIEW</a></div>';
                        }
                        elseif($price) 
                        {
                            echo '
                        <div class="pickproductsitem">
                          <div class="pickprodimage" style="background-image: url(' . get_the_post_thumbnail_url() . ');"></div>
                          <div class="prodname">'.get_the_title().'</div>
                          <div class="prodinfo">'. get_the_excerpt() .'</div>
                          <div class="prodprice">Only '.$currency.$price.'</div><a href="'.get_permalink().'" class="prodbutton w-button">VIEW</a></div>';
                        }
                        
                    endwhile;
    
                    wp_reset_query();
                ?>

    This should work, it was working anyway. But like I said I’m no expert.

    • This reply was modified 7 years, 8 months ago by jinx180. Reason: Extra information
    Thread Starter jinx180

    (@jinx180)

    Hello, Shane.
    Thank you for relying. Yes it does work correctly on the Twenty Fifteen theme. The files that are giving the 404 is whats left in the header while the site was converted to WordPress.

    This is the Products page code.

    <?php 
    /*
    Template Name: Products
    */
    include('header.php'); 
    ?>
    
      <div class="productswrapper">
        <div class="div-block-3">
          <div class="row-2 w-row">
            <div class="column-5 w-col w-col-3 w-col-stack">
              <div class="cattitle">
                <div class="cattitletext">Category</div><img src="<?php bloginfo('template_url'); ?>/images/Icon-cross.png" width="26" class="cross" data-ix="new-interaction-4">
                <div class="cat_burger_wraooer" data-ix="new-interaction-3">
                  <div class="cat_burger_slice"></div>
                  <div class="cat_burger_slice"></div>
                  <div class="cat_burger_slice"></div>
                </div>
              </div>
              <ul class="catlist w-list-unstyled">
                <?php
                  
                  $orderby = 'name';
                    $order = 'asc';
                    $hide_empty = false ;
                    $cat_args = array(
                        'orderby'    => $orderby,
                        'order'      => $order,
                        'hide_empty' => $hide_empty,
                    );
    
                    $product_categories = get_terms( 'product_cat', $cat_args );
    
                    if( !empty($product_categories) ){
                        echo '
    
                    <ul>';
                        foreach ($product_categories as $key => $category) {
                            echo '
    
                    <li class="catitemmain">';
                            echo '<a class="catlink w-inline-block" href="'.get_term_link($category).'" >';
                            echo $category->name;
                            echo '</a>';
                            echo '</li>';
                        }
                        echo '</ul>
    
                    ';
                    }
                  ?>
              </ul>
            </div>
            <div class="column-8 w-col w-col-9 w-col-stack">
              <div class="maintitle">All Products</div>
              <div class="itemswrapper w-clearfix">
                  
                  <?php
                
                    $args = array(
                        'post_type'      => 'product',
                    );
    
                    $loop = new WP_Query( $args );
                
                    while ( $loop->have_posts() ) : $loop->the_post();
                                    
                        global $product;
                  
                        $currency = get_woocommerce_currency_symbol();
                        $price = get_post_meta( get_the_ID(), '_regular_price', true);
                        $sale = get_post_meta( get_the_ID(), '_sale_price', true);
                        if($sale) {
                        echo '<div class="product"><img src=" '. get_the_post_thumbnail_url() .' " width="421" class="productimage">
                  <div class="productname-2">'.get_the_title().'</div>
                  <div class="prodprice-2"><span style="text-decoration: line-through;">Only '.$currency.$price.'</span><span style="color: green;"> SALE '.$currency.$sale.'</span></div><a href="'.get_permalink().'" class="link w-button">View</a></div>';
                        }
                  elseif($price) 
                        {
                      echo '<div class="product"><img src=" '. get_the_post_thumbnail_url() .' " width="421" class="productimage">
                  <div class="productname-2">'.get_the_title().'</div>
                  <div class="prodprice-2">Only '.$currency.$price.'</div><a href="'.get_permalink().'" class="link w-button">View</a></div>';
                  }
                    
                    endwhile;
    
                    wp_reset_query();
                ?>
                
              </div>
            </div>
          </div>
        </div>
      </div>
    
    <?php include('footer.php'); ?>

    I’ve used this in another website and it works fine. I’m the the theme developer. I’m no expert but I’m sure its all correct. But then again if it was correct it would work!

    Thread Starter jinx180

    (@jinx180)

    Thank you. I’m not sure how to fix the Zoom issue this is a custom theme and I’m rather new to adding plugins in custom woo themes.

    I’ll make the other changes.

Viewing 3 replies - 1 through 3 (of 3 total)