Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1320124

    afungusboy
    Participant

    I’m needing a custom taxonomy page to use for my woocommerce category pages and I can’t get this to work using the template structure of x. I’ve followed the instructions listed at https://community.theme.co/forums/topic/custom-category-archives-2/ and I see no changes happening after making the changes…so I think it might be how I’m naming the files?

    I am placing the new files in: /themes/x-child/framework/views/ethos/
    The files are named:
    taxonomy-product_cat.php
    wp-index-product_cat.php
    _index-product_cat.php

    #1320125

    afungusboy
    Participant
    This reply has been marked as private.
    #1320251

    afungusboy
    Participant

    I also tried adding a modified woocommerce template file of taxonomy-product_cat.php in /themes/x-child/woocommerce

    None of my changes in this file are showing up either.

    #1320668

    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in! Would you mind providing us the ftp login credentials so we can take a closer look? This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your credentials, we will be happy to assist you with everything.

    To do this, you can make a post with the following info:
    – FTP Hostname
    – FTP Username
    – FTP Password

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thank you.

    #1320677

    afungusboy
    Participant
    This reply has been marked as private.
    #1320678

    afungusboy
    Participant
    This reply has been marked as private.
    #1320859

    Rad
    Moderator

    Hi there,

    Please check this https://docs.woocommerce.com/document/template-structure/

    Gotcha: If your theme has a woocommerce.php file, you will be unable to override the woocommerce/archive-product.php custom template in your theme, as woocommerce.php has priority over other template files. This is intended to prevent display issues.

    X theme uses woocommerce.php as integration and it’s more prioritized than any taxonomy or archive template. You can try removing the woocommerce.php in theme’s root directory. But it may have side effects on X theme’s woocommerce styling.

    Thanks!

    #1321295

    afungusboy
    Participant

    Thanks for that info. Yes, removing woocommerce.php allows my template changes to show up but removing woocommerce.php breaks the theme’s layout.

    It seems like the best solution would be to modify the woocommerce.php file. I see code in that file for <?php if ( x_is_product() ) : ?> …so what would I need to add to that to have a separate sections of code for is_product_category( ‘wrist-malas’ ), is_product_category( ‘full-malas’ ), is_product_category( ‘additional’ )?

    #1321377

    afungusboy
    Participant

    Would something like this work in woocommerce.php:

    <?php
    
    // =============================================================================
    // VIEWS/ETHOS/WOOCOMMERCE.PHP
    // -----------------------------------------------------------------------------
    // WooCommerce page output for Ethos.
    // =============================================================================
    
    ?>
    
    <?php get_header(); ?>
    
      <div class="x-container max width main">
        <div class="offset cf">
          <div class="<?php x_main_content_class(); ?>" role="main">
    
            <?php if ( x_is_product() ) : ?>
              <?php x_ethos_entry_top_navigation(); ?>
              <?php woocommerce_content(); ?>
              
            } elseif (x_is_product_tag()  ) : ?>
              <?php woocommerce_content(); ?>
              
              } elseif ( x_is_product_category( 'wrist-m' ) ) {
        echo do_shortcode( '[reactive key="13490"]' );
              
               } elseif ( x_is_product_category( 'full-m' ) ) {
        echo do_shortcode( '[reactive key="13496"]' );
              
              
            <?php else; ?>
    
            <?php woocommerce_content(); ?>
    
          </div>
    
          <?php get_sidebar(); ?>
    
        </div>
      </div>
    
    <?php get_footer(); ?>
    #1321695

    Rad
    Moderator

    Hi there,

    Yes conditional would work, but that code will not. Try this,

    <?php
    
    // =============================================================================
    // VIEWS/ETHOS/WOOCOMMERCE.PHP
    // -----------------------------------------------------------------------------
    // WooCommerce page output for Ethos.
    // =============================================================================
    
    ?>
    
    <?php get_header(); ?>
    
      <div class="x-container max width main">
        <div class="offset cf">
          <div class="<?php x_main_content_class(); ?>" role="main">
    
            <?php if ( x_is_product() ) : ?>
              
              <?php x_ethos_entry_top_navigation(); ?>
             
              <?php if ( is_product_category( 'wrist-m' ) ) : echo do_shortcode( '[reactive key="13490"]' ); ?>
              <?php elseif ( is_product_category( 'full-m' ) ) : echo do_shortcode( '[reactive key="13496"]' ); ?>
              <?php else : woocommerce_content(); endif; ?>
    
          </div>
    
          <?php get_sidebar(); ?>
    
        </div>
      </div>
    
    <?php get_footer(); ?>

    Hope this helps.

    #1322323

    afungusboy
    Participant

    Thanks but when I added your code to VIEWS/ETHOS/WOOCOMMERCE.PHP I get a blank white screen. Can you figure out what in the code is causing the error?

    #1323242

    Lely
    Moderator

    Hi There,

    A white screen usually means there is a fatal PHP error. Can you please enable WP_DEBUG mode? You can do this by opening wp-config.php and adding
    define( 'WP_DEBUG' , true ); just above /* That's all, stop editing! Happy blogging. */ For example:

    define('WP_DEBUG', true);
    
    /* That's all, stop editing! Happy blogging. */

    When you revisit the page with the white screen, you should have some error output describing the issue in more detail.

    #1323322

    afungusboy
    Participant

    Parse error: syntax error, unexpected end of file in /wp-content/themes/x-child/framework/views/ethos/woocommerce.php on line 32

    #1323632

    Christian
    Moderator

    Please add endif below x_ethos_entry_top_navigation

    <?php x_ethos_entry_top_navigation(); ?>
    <?php endif; ?>

    If that doesn’t help, or not what you expected, please check for syntax errors and if the functions or conditionals are correct.

    Thanks.

    #1323846

    afungusboy
    Participant

    Thanks, that worked!

    But now that I have debug on I see the following message on my woocommerce product page:

    Notice: id was called incorrectly. Product properties should not be accessed directly. Please see Debugging in WordPress for more information. (This message was added in version 2.7.) in /wp-includes/functions.php on line 4091

    How do I fix this?