403Webshell
Server IP : 172.67.71.254  /  Your IP : 216.73.216.4
Web Server : nginx/1.27.1
System : Linux in-5 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64
User : arabianexpress ( 1872)
PHP Version : 8.0.30
Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /storage/v9321/leapdubai/public_html/wp-content/themes/printx/inc/woocommerce/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /storage/v9321/leapdubai/public_html/wp-content/themes/printx/inc/woocommerce/tp-woocommerce.php
<?php

// shop page hooks
remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30);

// content-product hooks--
// action remove
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
remove_action('woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
remove_action('woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10);
remove_action('woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10);
remove_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5);
remove_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10);
remove_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5);
remove_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10);

//single hook remove
remove_action('woocommerce_single_product_summary','woocommerce_template_single_title',5);
remove_action('woocommerce_single_product_summary','woocommerce_template_single_rating',10);
remove_action('woocommerce_single_product_summary','woocommerce_template_single_price',10);
remove_action('woocommerce_single_product_summary','woocommerce_template_single_excerpt',20);
remove_action('woocommerce_single_product_summary','woocommerce_template_single_add_to_cart',30);
remove_action('woocommerce_single_product_summary','woocommerce_template_single_meta',40);
remove_action('woocommerce_single_product_summary','woocommerce_template_single_sharing',50);


// compare_false
add_filter( 'woosc_button_position_archive', '__return_false' );
add_filter( 'woosc_button_position_single', '__return_false' );

// wishlist false
add_filter( 'woosw_button_position_archive', '__return_false' );
add_filter( 'woosw_button_position_single', '__return_false' );


// product-content single
if( !function_exists('printx_content_single_details') ) {
    function printx_content_single_details( ) {
        global $product;
        global $post;
        global $woocommerce;
        $rating = wc_get_rating_html($product->get_average_rating());
        $ratingcount = $product->get_review_count();
        $regularPrice = $product->get_regular_price();

        $attachment_ids = $product->get_gallery_image_ids();

        foreach( $attachment_ids as $attachment_id ) {
            $image_link = wp_get_attachment_url( $attachment_id );
        }

        $categories = get_the_terms( $post->ID, 'product_cat' );
        $stock = $product->is_in_stock();
        $stock_quantify = $product->get_stock_quantity();

        ?>

<div class="tp-shop-details__right-warp tp-product-details-wrapper">
    <h3 class="tp-shop-details__title-sm"><?php the_title(); ?></h3>
    <div class="tp-shop-details__ratting d-flex">

        <?php if(!empty($rating)) : ?>
        <?php echo wp_kses_post($rating); ?>
        <?php else : ?>
        <div class="tp-fea-product__star">
            <?php 
            for($i=1; $i<6; $i++){
                echo '<i class="fa-solid fa-star color"></i>';
            }
            ?>
        </div>
        <?php endif; ?>
        <span class="review-text">( <?php echo esc_html($ratingcount); ?> <?php echo esc_html($ratingcount) <= 1 ? 'review' : 'reviews'; ?> )</span>
    </div>
    <div class="tp-shop-details__price d-flex align-items-center">
        <?php woocommerce_template_single_price(); ?>
        <?php if( $product->is_on_sale() && empty($product->is_type( 'grouped' ))) : ?>
        <span class="red-color ml-20"><?php echo printx_sale_percentage(); ?></span>
        <?php endif; ?>
    </div>
    <?php if(!empty(woocommerce_template_single_excerpt())) :?>
    <div class="tp-shop-details__text-2">
        <p><?php woocommerce_template_single_excerpt(); ?></p>
    </div>
    <?php endif; ?>
    <div class="tp-shop-details__quantity-wrap mt-30 d-flex align-items-center">
        <?php woocommerce_template_single_add_to_cart(); ?>
    </div>
    <?php woocommerce_template_single_meta(); ?>
</div>


<?php
    }
}
add_action( 'woocommerce_single_product_summary', 'printx_content_single_details', 4 );



/*************************************************
## Free shipping progress bar.
*************************************************/
function printx_shipping_progress_bar() {
        
        $total           = WC()->cart->get_displayed_subtotal();
        $limit           = get_theme_mod( 'shipping_progress_bar_amount' );
        $percent         = 100;


        if ( $total < $limit ) {
            $percent = floor( ( $total / $limit ) * 100 );
            $message = str_replace( '[remainder]', wc_price( $limit - $total ), get_theme_mod( 'shipping_progress_bar_message_initial') );
        } else {
            $message = get_theme_mod( 'shipping_progress_bar_message_success' );
        }
        
    ?>

<div class="tp-free-progress-bar">
    <div class="free-shipping-notice">
        <?php echo wp_kses( $message, 'post' ); ?>
    </div>
    <div class="tp-progress-bar">
        <span class="progress progress-bar progress-bar-striped progress-bar-animated"
            data-width="<?php echo esc_attr( $percent ); ?>%"></span>
    </div>
</div>

<?php
}
    
if(get_theme_mod( 'shipping_progress_bar_location_card_page',0) == '1'){
    add_action( 'woocommerce_before_cart_table',  'printx_shipping_progress_bar' );
}

if(get_theme_mod( 'shipping_progress_bar_location_mini_cart',0) == '1'){
    add_action( 'woocommerce_before_mini_cart_contents', 'printx_shipping_progress_bar' );
}

if(get_theme_mod( 'shipping_progress_bar_location_checkout',0) == '1'){
    add_action( 'woocommerce_checkout_before_customer_details', 'printx_shipping_progress_bar' );
}


/*************************************************
## sale percentage
*************************************************/

function printx_sale_percentage(){
   global $product;
   $output = '';

   if ( $product->is_on_sale() && $product->is_type( 'variable' ) ) {
      $percentage = ceil(100 - ($product->get_variation_sale_price() / $product->get_variation_regular_price( 'min' )) * 100);
      $output .= '-'.$percentage.'%';
   } elseif( $product->is_on_sale() && $product->get_regular_price()  && !$product->is_type( 'grouped' )) {
      $percentage = ceil(100 - ($product->get_sale_price() / $product->get_regular_price()) * 100);
      $output .= '-'.$percentage.'%';
   }
   return $output;
}



// woocommerce mini cart content
add_filter('woocommerce_add_to_cart_fragments', function ($fragments) {
    ob_start();
    ?>
    <div class="mini_shopping_cart_box">
        <?php woocommerce_mini_cart(); ?>
    </div>
    <?php $fragments['.mini_shopping_cart_box'] = ob_get_clean();
    return $fragments;
});

// woocommerce mini cart count icon
if ( ! function_exists( 'printx_header_add_to_cart_fragment' ) ) {
    function printx_header_add_to_cart_fragment( $fragments ) {
        ob_start();
        ?>
        <b class="tp-header__icon-text cart__count" id="tp-cart-item" >
            <?php echo esc_html( WC()->cart->cart_contents_count ); ?>
        </b>
        <?php
        $fragments['#tp-cart-item'] = ob_get_clean();

        return $fragments;
    }
}
add_filter( 'woocommerce_add_to_cart_fragments', 'printx_header_add_to_cart_fragment' );


// product-content archive
if( !function_exists('printx_content_product_grid') ) {
    function printx_content_product_grid( ) {
        global $product;
        global $post;
        global $woocommerce;
        $rating = wc_get_rating_html($product->get_average_rating());
        $ratingcount = $product->get_review_count();
        $terms = get_the_terms(get_the_ID(), 'product_cat');
        $attachment_ids = $product->get_gallery_image_ids();

        foreach( $attachment_ids as $key => $attachment_id ) {
            $image_link =  wp_get_attachment_url( $attachment_id );
            $arr[] = $image_link;
        }
        
        ?>

<div class="col ">
    <div class="tp-fea-product__item tp-fea-product__item-2 tp-product-action">
        <?php if( has_post_thumbnail() ) : ?>
        <div class="tp-fea-product__thumb fix p-relative">
            <?php the_post_thumbnail(); ?>
            <?php if( $product->is_on_sale()) : ?>
                <div class="tp-product-badge tp-product-on-sale">
                    <?php woocommerce_show_product_loop_sale_flash($post->ID); ?>
                </div>
            <?php endif; ?>
            <div class="tp-fea-product__icon-box">

                <div class="product-action-btn product-add-to-cart-btn">
                    <?php woocommerce_template_loop_add_to_cart();?>   
                </div>

                <?php if( class_exists( 'WPCleverWoosq' )) : ?>
                <div class="product-action-btn">
                    <?php echo do_shortcode('[woosq]'); ?>
                </div>
                <?php endif; ?>
                <?php if( function_exists( 'woosw_init' )) : ?>
                <div class="product-action-btn product-add-wishlist-btn">
                        <?php echo do_shortcode('[woosw]'); ?>
                </div>
                <?php endif; ?>
            </div>
        </div>
        <?php endif; ?>
        <div class="tp-fea-product__content text-center">
            <?php if(!empty($rating)) : ?>
            <div class="tp-fea-product__star d-flex justify-content-center">
                <?php echo wp_kses_post($rating); ?>
            </div>
            <?php else : ?>
            <div class="tp-fea-product__star">
                <?php 
                for($i=1; $i<6; $i++){
                    echo '<i class="fa-solid fa-star color"></i>';
                }
                ?>
            </div>
            <?php endif; ?>
            <h4 class="tp-fea-product__title-sm"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
            <div class="tp-product-content-price">
                <span class="product-item-3-price"><?php echo woocommerce_template_loop_price();?></span>
            </div>
        </div>
    </div>
</div>

<?php
    }
}
add_action( 'woocommerce_before_shop_loop_item', 'printx_content_product_grid', 10 );


// smart quickview
add_filter( 'woosq_button_html', 'printx_woosq_button_html', 10, 2 );
function printx_woosq_button_html( $output , $prodid ) {
    return $output = '<a href="#" class="icon-btn woosq-btn woosq-btn-' . esc_attr( $prodid ) . ' ' . get_option( 'woosq_button_class' ) . '" data-id="' . esc_attr( $prodid ) . '" data-effect="mfp-3d-unfold"><svg width="19" height="16" viewBox="0 0 19 16" fill="none" xmlns="http://www.w3.org/2000/svg">
   <path d="M9.49943 5.34978C8.23592 5.34978 7.20896 6.37595 7.20896 7.63732C7.20896 8.89774 8.23592 9.92296 9.49943 9.92296C10.7629 9.92296 11.7908 8.89774 11.7908 7.63732C11.7908 6.37595 10.7629 5.34978 9.49943 5.34978M9.49941 11.3456C7.45025 11.3456 5.78394 9.68213 5.78394 7.63738C5.78394 5.59169 7.45025 3.92725 9.49941 3.92725C11.5486 3.92725 13.2158 5.59169 13.2158 7.63738C13.2158 9.68213 11.5486 11.3456 9.49941 11.3456" fill="currentColor"/>
   
   <path d="M1.49145 7.63683C3.25846 11.5338 6.23484 13.8507 9.50001 13.8517C12.7652 13.8507 15.7416 11.5338 17.5086 7.63683C15.7416 3.7408 12.7652 1.42386 9.50001 1.42291C6.23579 1.42386 3.25846 3.7408 1.49145 7.63683V7.63683ZM9.50173 15.2742H9.49793H9.49698C5.56775 15.2714 2.03943 12.5219 0.0577129 7.91746C-0.0192376 7.73822 -0.0192376 7.53526 0.0577129 7.35601C2.03943 2.75248 5.5687 0.00306822 9.49698 0.000223018C9.49888 -0.000725381 9.49888 -0.000725381 9.49983 0.000223018C9.50173 -0.000725381 9.50173 -0.000725381 9.50268 0.000223018C13.4319 0.00306822 16.9602 2.75248 18.942 7.35601C19.0199 7.53526 19.0199 7.73822 18.942 7.91746C16.9612 12.5219 13.4319 15.2714 9.50268 15.2742H9.50173Z" fill="currentColor"/>

   </svg></a>';
}


// product add to cart button
function woocommerce_template_loop_add_to_cart( $args = array() ) {
    global $product;

    $stock = $product->is_in_stock();

    $stock_class = $stock ? 'stock-available' : 'stock-out';

    $price = $product->get_regular_price();

    $price_class = $price ? NULL : 'price-empty';

        if ( $product ) {
            $defaults = array(
                'quantity'   => 1,
                'class'      => implode(
                    ' ',
                    array_filter(
                        array(
                            'cart-button icon-btn button product-action product-action-1 '.$stock_class.' '.$price_class,
                            'product_type_' . $product->get_type(),
                            $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',
                            $product->supports( 'ajax_add_to_cart' ) && $product->is_purchasable() && $product->is_in_stock() ? 'ajax_add_to_cart' : '',
                        )
                    )
                ),
                'attributes' => array(
                    'data-product_id'  => $product->get_id(),
                    'data-product_sku' => $product->get_sku(),
                    'aria-label'       => $product->add_to_cart_description(),
                    'rel'              => 'nofollow',
                ),
            );

            $args = wp_parse_args( $args, $defaults );

            if ( isset( $args['attributes']['aria-label'] ) ) {
                $args['attributes']['aria-label'] = wp_strip_all_tags( $args['attributes']['aria-label'] );
            }
        }


         // check product type 
         if( $product->is_type( 'simple' ) ){
            $btntext = esc_html__("Add to Cart",'printx');
         } elseif( $product->is_type( 'variable' ) ){
            $btntext = esc_html__("Select Options",'printx');
         } elseif( $product->is_type( 'external' ) ){
            $btntext = esc_html__("Buy Now",'printx');
         } elseif( $product->is_type( 'grouped' ) ){
            $btntext = esc_html__("View Products",'printx');
         }
         else{
            $btntext = "Add to Cart";
         } 

        echo sprintf( '<a href="%s" data-quantity="%s" class="%s tp-product-add-cart-btn" %s>%s</a>',
            esc_url( $product->add_to_cart_url() ),
            esc_attr( isset( $args['quantity'] ) ? $args['quantity'] : 1 ),
            esc_attr( isset( $args['class'] ) ? $args['class'] : 'cart-button icon-btn button product-action product-action-1 '.$stock_class ),
            isset( $args['attributes'] ) ? wc_implode_html_attributes( $args['attributes'] ) : '',
            '<svg width="15" height="14" viewBox="0 0 15 14" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M14.6534 4.70315V6.89066C14.6534 7.19273 14.402 7.43754 14.0918 7.43754H13.7225L13.486 9.48802C13.4537 9.76744 13.2107 9.9738 12.9286 9.97391C12.9076 9.97391 12.8865 9.97274 12.8652 9.97039C12.557 9.93674 12.3352 9.66597 12.3698 9.36593L12.6625 6.82967C12.6944 6.55303 12.9346 6.34379 13.2205 6.34379H13.5304V5.25003H1.40048V6.34379H10.9752C11.2854 6.34379 11.5368 6.58871 11.5368 6.89066C11.5368 7.19273 11.2854 7.43754 10.9752 7.43754H2.34879L2.90334 11.9428C2.9709 12.4921 3.45032 12.9063 4.01847 12.9063H10.9574C11.5297 12.9063 12.0095 12.4886 12.0735 11.9347C12.108 11.6345 12.386 11.4187 12.6942 11.4523C13.0024 11.4861 13.2241 11.7567 13.1896 12.0569C13.0617 13.1646 12.1021 14.0001 10.9574 14.0001H4.01847C2.88217 14.0001 1.92333 13.1716 1.7881 12.0729L1.21764 7.43754H0.838913C0.528734 7.43754 0.277344 7.19273 0.277344 6.89066V4.70315C0.277344 4.40108 0.528734 4.15627 0.838913 4.15627H2.83073L5.79816 0.223117C5.98177 -0.0202016 6.33319 -0.0726465 6.58315 0.106264C6.83312 0.285068 6.88686 0.627295 6.70325 0.87072L4.22445 4.15627H10.7271L8.24823 0.87072C8.06462 0.627295 8.11836 0.285068 8.36833 0.106264C8.61829 -0.0726465 8.96971 -0.0203085 9.15343 0.223117L12.1208 4.15627H14.0918C14.402 4.15627 14.6534 4.40119 14.6534 4.70315ZM6.90386 9.07818V11.2657C6.90386 11.5678 7.15525 11.8126 7.46543 11.8126C7.7755 11.8126 8.027 11.5678 8.027 11.2657V9.07818C8.027 8.77612 7.7755 8.5313 7.46543 8.5313C7.15525 8.5313 6.90386 8.77612 6.90386 9.07818ZM9.15014 9.07818V11.2657C9.15014 11.5678 9.40153 11.8126 9.71171 11.8126C10.0218 11.8126 10.2733 11.5678 10.2733 11.2657V9.07818C10.2733 8.77612 10.0218 8.5313 9.71171 8.5313C9.40153 8.5313 9.15014 8.77612 9.15014 9.07818ZM4.65758 9.07818V11.2657C4.65758 11.5678 4.90897 11.8126 5.21915 11.8126C5.52922 11.8126 5.78072 11.5678 5.78072 11.2657V9.07818C5.78072 8.77612 5.52922 8.5313 5.21915 8.5313C4.90897 8.5313 4.65758 8.77612 4.65758 9.07818Z" fill="currentcolor"/>
            </svg>'
        );
}


add_action( 'wp_footer' , 'custom_quantity_fields_script' );

// custom_quantity_fields_script
function custom_quantity_fields_script(){
    ?>
<script type='text/javascript'>
jQuery(function($) {
    if (!String.prototype.getDecimals) {
        String.prototype.getDecimals = function() {
            var num = this,
                match = ('' + num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
            if (!match) {
                return 0;
            }
            return Math.max(0, (match[1] ? match[1].length : 0) - (match[2] ? +match[2] : 0));
        }
    }
    // Quantity "plus" and "minus" buttons
    $(document.body).on('click', '.plus, .minus', function() {
        var $qty = $(this).closest('.quantity').find('.qty'),
            currentVal = parseFloat($qty.val()),
            max = parseFloat($qty.attr('max')),
            min = parseFloat($qty.attr('min')),
            step = $qty.attr('step');

        // Format values
        if (!currentVal || currentVal === '' || currentVal === 'NaN') currentVal = 0;
        if (max === '' || max === 'NaN') max = '';
        if (min === '' || min === 'NaN') min = 0;
        if (step === 'any' || step === '' || step === undefined || parseFloat(step) === 'NaN') step = 1;

        // Change the value
        if ($(this).is('.plus')) {
            if (max && (currentVal >= max)) {
                $qty.val(max);
            } else {
                $qty.val((currentVal + parseFloat(step)).toFixed(step.getDecimals()));
            }
        } else {
            if (min && (currentVal <= min)) {
                $qty.val(min);
            } else if (currentVal > 0) {
                $qty.val((currentVal - parseFloat(step)).toFixed(step.getDecimals()));
            }
        }

        // Trigger change event
        $qty.trigger('change');
    });
});
</script>
<?php
}


// woocommerce_breadcrumb modilfy
if ( ! function_exists( 'woocommerce_breadcrumb' ) ) {

    /**
     * Output the WooCommerce Breadcrumb.
     *
     * @param array $args Arguments.
     */
    function woocommerce_breadcrumb( $args = array() ) {
        $args = wp_parse_args(
            $args,
            apply_filters(
                'woocommerce_breadcrumb_defaults',
                array(
                    'delimiter'   => '&nbsp;&#47;&nbsp;',
                    'wrap_before' => '<nav class="woocommerce-breadcrumb">',
                    'wrap_after'  => '</nav>',
                    'before'      => '',
                    'after'       => '',
                    'home'        => _x( 'Home', 'breadcrumb', 'printx' ),
                )
            )
        );

        $breadcrumbs = new WC_Breadcrumb();

        if ( ! empty( $args['home'] ) ) {
            $breadcrumbs->add_crumb( $args['home'], apply_filters( 'woocommerce_breadcrumb_home_url', home_url() ) );
        }

        $args['breadcrumb'] = $breadcrumbs->generate();

        /**
         * WooCommerce Breadcrumb hook
         *
         * @hooked WC_Structured_Data::generate_breadcrumblist_data() - 10
         */
        do_action( 'woocommerce_breadcrumb', $breadcrumbs, $args );

        wc_get_template( 'global/breadcrumb.php', $args );
    }
}

/*************************************************
## printx Woo Search Form
*************************************************/ 

add_filter( 'get_product_search_form' , 'printx_custom_product_searchform' );

function printx_custom_product_searchform( $form ) {

	$form = '<div class="search-form p-relative">
                <form action="' . esc_url( home_url( '/shop'  ) ) . '" role="search" method="get" id="searchform">
                <input type="search" value="' . get_search_query() . '" name="s" placeholder="'.esc_attr__('Search Product','printx').'" autocomplete="off">
                <button type="submit"><i class="fa-regular fa-arrow-right-long"></i></button> 
                </form>
            </div>';

	return $form;
}

Youez - 2016 - github.com/yon3zu
LinuXploit