fbpx

Placeholder on product grid not showing. Maintenance page not working

HomeTopicsSupport forumPlaceholder on product grid not showing. Maintenance page not working
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #16474
    Avatar
    rrogers
    Participant

    Hi there ,

    Placeholder on product grid not showing.

    Maintenance page is not working at all.

    Attachments:
    You must be logged in to view attached files.
    #16478
    Artem Temos
    Artem Temos
    Keymaster

    Hello,

    When we test this on our development environment both features work correctly. Are you able to upload your website to hosting so we can check what is wrong?

    Kind Regards

    #16479
    Avatar
    BadChip
    Participant

    I have same problems on Tethys theme by the way, the maintenance mode is not effective (Even after selecting a specific page), also placeholder images (configured in woocommerce settings) only apply to Single product page, not the shop page.

    #16480
    Artem Temos
    Artem Temos
    Keymaster

    Try to add the following code to the functions.php file in your child theme to fix the placeholder issue

    if ( ! function_exists( 'xts_custom_product_loop_thumbnail' ) ) {
       /**
        * Custom product loop thumbnail.
        */
       function xts_custom_product_loop_thumbnail() {
          remove_filter( 'woocommerce_before_shop_loop_item_title', 'xts_product_loop_thumbnail', 10 );
          add_action( 'woocommerce_before_shop_loop_item_title', 'xts_output_product_loop_thumbnail', 10 );
       }
    
       add_action( 'init', 'xts_custom_product_loop_thumbnail', 100 );
    }
    
    if ( ! function_exists( 'xts_output_product_loop_thumbnail' ) ) {
       /**
        * Output product loop thumbnail.
        */
       function xts_output_product_loop_thumbnail() {
          global $product;
    
          $attachment_ids    = $product->get_gallery_image_ids();
          $image_size        = xts_get_loop_prop( 'product_image_size' );
          $custom_image_size = xts_get_loop_prop( 'product_image_custom' );
          $product_design    = xts_get_loop_prop( 'product_design' );
    
          ?>
          <div class="xts-product-image">
             <?php if ( ! empty( get_post_thumbnail_id() ) ) : ?>
                <?php
                echo xts_get_image_html( // phpcs:ignore
                   array(
                      'image_size'             => $image_size,
                      'image_custom_dimension' => $custom_image_size,
                      'image'                  => array(
                         'id' => get_post_thumbnail_id(),
                      ),
                   ),
                   'image'
                );
                ?>
             <?php else : ?>
                <?php echo wc_placeholder_img( $image_size ); // phpcs:ignore ?>
             <?php endif; ?>
          </div>
    
          <?php if ( isset( $attachment_ids[0] ) && $attachment_ids[0] && 'small' !== $product_design && 'small-bg' !== $product_design && 'mask' !== $product_design && xts_get_loop_prop( 'product_hover_image' ) ) : ?>
             <div class="xts-product-hover-image xts-fill">
                <?php
                echo xts_get_image_html( // phpcs:ignore
                   array(
                      'image_size'             => $image_size,
                      'image_custom_dimension' => $custom_image_size,
                      'image'                  => array(
                         'id' => $attachment_ids[0],
                      ),
                   ),
                   'image'
                );
                ?>
             </div>
          <?php endif; ?>
          <?php
       }
    }

    Kind Regards

    #16481
    Avatar
    BadChip
    Participant

    Artem THANKS! Tried the code and I can confirm it works. It’s weird this minor issue requires all that code.

    1) Will this fix be included in next updates?
    2) What about the Maintenance mode? It’s not effective what-so-ever for me.

    #16484
    Avatar
    rrogers
    Participant

    Hi there,
    Thank you for your reply.
    The placeholder issue is fixed. I will do some more tests with the maintenance mode, I give feedback later.
    I had to replace on page framework/integration/woocommerce/template-tags/loop-product.php

    <div class="xts-product-image">
    			<?php
    			echo xts_get_image_html( // phpcs:ignore
    				array(
    					'image_size'             => $image_size,
    					'image_custom_dimension' => $custom_image_size,
    					'image'                  => array(
    						'id' => get_post_thumbnail_id(),
    					),
    				),
    				'image'
    			);
    			?>
    		</div>

    to:

    	<div class="xts-product-image">
                <?php if ( ! empty( get_post_thumbnail_id() ) ) : ?>
                    <?php
                    echo xts_get_image_html( // phpcs:ignore
                        array(
                            'image_size'             => $image_size,
                            'image_custom_dimension' => $custom_image_size,
                            'image'                  => array(
                                'id' => get_post_thumbnail_id(),
                            ),
                        ),
                        'image'
                    );
                    ?>
                <?php else : ?>
                    <?php echo wc_placeholder_img( $image_size ); // phpcs:ignore ?>
                <?php endif; ?>
    
    		</div>
    #16490
    Artem Temos
    Artem Temos
    Keymaster

    Try to add the following code snippet to the functions.php file in the child theme to fix the maintenance mode

    use XTS\Framework\Modules;
    
    if ( ! function_exists( 'xts_update_maintenance' ) ) {
       /**
        * Update maintenance.
        */
       function xts_update_maintenance() {
          remove_action( 'template_redirect', array( Modules::get( 'maintenance' ), 'maintenance_redirect' ), 10 );
          add_action( 'template_redirect', 'xts_update_maintenance_redirect', 11 );
       }
    
       add_action( 'init', 'xts_update_maintenance', 11 );
    }
    
    if ( ! function_exists( 'xts_update_maintenance_redirect' ) ) {
       /**
        * Redirect maintenance page.
        */
       function xts_update_maintenance_redirect() {
          $maintenance_page = xts_get_opt( 'maintenance_page' );
    
          if ( ! xts_get_opt( 'maintenance_mode' ) || ! $maintenance_page || is_user_logged_in() ) {
             return;
          }
    
          if ( ! is_page( $maintenance_page ) ) {
             wp_safe_redirect( get_permalink( $maintenance_page ) );
             exit();
          }
       }
    }
    #16501
    Avatar
    rrogers
    Participant

    Hi there,
    Suggestion: Coming Soon mode (returning HTTP 200 code) or Maintenance Mode (returning HTTP 503 code) dropdown option.

    Maintenance mode works now. But I had to change on page:

    #framework/modules/maintenance/class-maintenance.php line 45

    ` if ( is_page( $maintenance_page ) ) {
    wp_safe_redirect( get_permalink( $maintenance_page ) );
    exit();
    }`

    to

    ` if ( ! is_page( $maintenance_page ) ) {
    wp_safe_redirect( get_permalink( $maintenance_page ) );
    exit();
    }`

    Thank you !

    #16503
    Artem Temos
    Artem Temos
    Keymaster

    Yes, this fix will be included in our next theme update.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.

Sign in

No account yet?

Create an Account