HEX
Server: Apache
System: Linux web15f74.uni5.net 5.4.282-1.el8.elrepo.x86_64 #1 SMP Mon Aug 19 18:33:22 EDT 2024 x86_64
User: lucendi (859622)
PHP: 7.4.33
Disabled: apache_child_terminate,c99_buff_prepare,c99_sess_put,dl,exec,leak,link,myshellexec,openlog,passthru,pclose,pcntl_exec,php_check_syntax,php_strip_whitespace,popen,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,symlink,system,socket_listen,socket_create_listen,putenv
Upload Files
File: /home/lucendi/www/wp-content/themes/mesmerize/inc/woocommerce/list.php
<?php


// card item template start

remove_action('woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10);

remove_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10);
remove_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5);


function mesmerize_woocommerce_before_shop_loop_item()
{
    $class = apply_filters('mesmerize_woocommerce_archive_item_class', array());
    $class = implode(' ', array_unique($class));
    ?>

    <div class="ope-woo-card-item <?php echo esc_attr($class); ?>">
    
    <?php
}

// start card item
add_action('woocommerce_before_shop_loop_item', 'mesmerize_woocommerce_before_shop_loop_item', 0);
add_action('woocommerce_before_subcategory', 'mesmerize_woocommerce_before_shop_loop_item', 0);


// start header
add_action('woocommerce_before_shop_loop_item_title', function(){
    ?>
    <div class="ope-woo-card-header">
    <?php
}, 0);


//end header
add_action('woocommerce_before_shop_loop_item_title', function(){
    ?>
    </div>
    <?php
}, PHP_INT_MAX);


// start content
add_action('woocommerce_shop_loop_item_title', function(){
    ?>
    <div class="ope-woo-card-content">
    <?php
}, 0);


//end content
add_action('woocommerce_shop_loop_item_title', function(){
    ?>
    </div>
    <?php
}, PHP_INT_MAX);


// start footer section
add_action('woocommerce_after_shop_loop_item', function () {
    ?>
    <div class="ope-woo-card-footer">
    
    <?php
}, 0);


// end footer section
add_action('woocommerce_after_shop_loop_item', function () {
    ?>
    </div>
    <?php
}, PHP_INT_MAX);


// end card item
add_action('woocommerce_after_shop_loop_item', function () {
    ?>
    </div>
    <?php
}, PHP_INT_MAX);

add_action('woocommerce_after_subcategory', function () {
    ?>
    </div>
    <?php
}, PHP_INT_MAX);


// card item template end


//card item content

function mesmerize_woocommerce_product_list_print_categories()
{
    global $product;
    ?>
    <div class="ope-woo-card-content-section ope-woo-card-content-categories">
        <?php echo wc_get_product_category_list($product->get_id()); ?>
    </div>
    <?php
}

function mesmerize_woocommerce_product_list_print_title()
{
    ?>
    <div class="ope-woo-card-content-section ope-woo-card-content-title">
        <h3 class="ope-card-product-tile"><?php the_title() ?></h3>
    </div>
    <?php
}

function mesmerize_woocommerce_product_list_print_rating()
{
    ?>
    <div class="ope-woo-card-content-section ope-woo-card-content-rating">
        <?php woocommerce_template_loop_rating() ?>
    </div>
    
    <?php
}

function mesmerize_woocommerce_product_list_print_price()
{
    ?>
    <div class="ope-woo-card-content-section ope-woo-card-content-price">
        <?php woocommerce_template_loop_price() ?>
    </div>
    <?php
}

function mesmerize_woocommerce_product_list_print_description()
{
    $description_in_archive_only = get_theme_mod('mesmerize_woocommerce_description_in_archive_only', true);
    
    if ( ! is_archive() && intval($description_in_archive_only)) {
        return;
    }
    
    ?>
    <div class="ope-woo-card-content-section ope-woo-card-content-description">
        <?php the_excerpt() ?>
    </div>
    <?php
}


function mesmerize_woocommerce_card_item_get_print_order()
{
    
    $order  = get_theme_mod('woocommerce_card_item_get_print_order', false);
    $result = array();
    
    if ($order === false) {
        $result = array('title', 'rating', 'price', 'categories');
    } else {
        $result = $order;
    }
    
    
    return $result;
}


add_action('woocommerce_shop_loop_item_title', function () {
    $toPrint = mesmerize_woocommerce_card_item_get_print_order();
    
    foreach ($toPrint as $item) {
        if (function_exists("mesmerize_woocommerce_product_list_print_{$item}")) {
            call_user_func("mesmerize_woocommerce_product_list_print_{$item}");
        }
        
    }
});


add_filter('woocommerce_product_loop_start', function ($loop_html) {
    $display_type = woocommerce_get_loop_display_mode();
    
    // If displaying categories, append to the loop.
    if ('subcategories' === $display_type || 'both' === $display_type) {
    
        $loop_html .='<li class="col-xs-12 col-sm-12 space-bottom space-top"></li>';
       
    }
    
    return $loop_html;
}, 20);