403Webshell
Server IP : 104.171.130.249  /  Your IP : 216.73.216.146
Web Server : nginx/1.25.5
System : Linux 0dac65491b7e 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : root ( 0)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/html/wp-content/themes/matreshka/woocommerce/cart/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/themes/matreshka/woocommerce/cart/cart.php
<?php
/**
 * Cart Page
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/cart/cart.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see     https://woocommerce.com/document/template-structure/
 * @package WooCommerce\Templates
 * @version 10.1.0
 */

defined( 'ABSPATH' ) || exit;

do_action( 'woocommerce_before_cart' ); ?>

<!-- MATRESHKA CUSTOM CART TEMPLATE LOADED -->

<!-- navigation -->
<section>
    <div class="container navigation d-md-flex d-none">
        <div class="d-flex">
            <h2 class="montserrat-bold">Корзина</h2>
            <h3 class="montserrat-semibold"><?php echo sprintf( _n( '%d товар', '%d товара', WC()->cart->get_cart_contents_count(), 'matreshka' ), WC()->cart->get_cart_contents_count() ); ?></h3>
        </div>
        <a href="<?php echo esc_url( wc_get_cart_url() ); ?>?empty-cart=true" class="btn btn-link montserrat-semibold">
            Очистить
        </a>
    </div>
    <div class="container navigation d-flex d-md-none">
        <img src="<?php echo esc_url( get_template_directory_uri() . '/assets/icons/AltArrowLeft.svg' ); ?>" alt="like icon" style="width: 8px; height: 16px; max-width: 10px;">
        <div class="">
            <h2 class="montserrat-semibold">Корзина</h2>
            <h3 class="montserrat-regular"><?php echo sprintf( _n( '%d товар', '%d товара', WC()->cart->get_cart_contents_count(), 'matreshka' ), WC()->cart->get_cart_contents_count() ); ?></h3>
        </div>
        <a href="<?php echo esc_url( wc_get_cart_url() ); ?>?empty-cart=true" class=" montserrat-semibold">
            <img src="<?php echo esc_url( get_template_directory_uri() . '/assets/icons/Trash.svg' ); ?>" alt="like icon" style="width: 24px; height: 24px; max-width: 24px;">
        </a>
    </div>
</section>

<!-- cart -->
<section>
    <div class="container cart d-md-flex d-block">
        <form class="woocommerce-cart-form cart-products d-block" action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
            <?php do_action( 'woocommerce_before_cart_table' ); ?>

            <?php
            foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
                $_product   = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
                $product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
                $product_name = apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key );

                if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
                    $product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );
                    ?>
                    <div class="cart-product-item d-flex woocommerce-cart-form__cart-item <?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
                        <div class="cart-product-img">
                            <?php
                            $thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
                            if ( ! $product_permalink ) {
                                echo $thumbnail;
                            } else {
                                printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $thumbnail );
                            }
                            ?>
                        </div>
                        <div class="cart-product-name">
                            <p class="montserrat-medium mb-1 me-2 me-md-0">
                                <?php
                                if ( ! $product_permalink ) {
                                    echo wp_kses_post( $product_name );
                                } else {
                                    echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key ) );
                                }
                                ?>
                            </p>
                            <span class="montserrat-semibold d-block" >
                                <?php
                                // Get product unit (weight, volume, or piece)
                                $unit_meta = get_post_meta( $product_id, '_unit', true );
                                if ( $unit_meta ) {
                                    echo esc_html( $unit_meta );
                                } else {
                                    // Display price per unit if available
                                    echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
                                }
                                ?>
                            </span>

                            <div class="d-md-none d-block">
                                <?php
                                if ( $_product->is_sold_individually() ) {
                                    $min_quantity = 1;
                                    $max_quantity = 1;
                                } else {
                                    $min_quantity = 0;
                                    $max_quantity = $_product->get_max_purchase_quantity();
                                }

                                $product_quantity = woocommerce_quantity_input(
                                    array(
                                        'input_name'   => "cart[{$cart_item_key}][qty]",
                                        'input_value'  => $cart_item['quantity'],
                                        'max_value'    => $max_quantity,
                                        'min_value'    => $min_quantity,
                                        'product_name' => $product_name,
                                    ),
                                    $_product,
                                    false
                                );

                                echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item );
                                ?>
                            </div>
                        </div>
                        <div class="cart-product-count d-grid ms-auto text-end" >
                            <?php
                            // Get prices using WooCommerce methods
                            $product_price = $_product->get_price();
                            $regular_price = $_product->get_regular_price();
                            $quantity = $cart_item['quantity'];
                            
                            // Use WooCommerce built-in method to get subtotal (handles everything properly)
                            $subtotal_html = WC()->cart->get_product_subtotal( $_product, $quantity );
                            
                            // Check if product is on sale
                            $is_on_sale = $_product->is_on_sale() && $regular_price > $product_price;
                            
                            if ( $is_on_sale ) {
                                // Calculate regular price total for comparison
                                $regular_total = floatval( $regular_price ) * $quantity;
                                ?>
                                <span class="montserrat-bold text-red-primary">
                                    <span class="montserrat-semibold text-dark-opacity price-old d-inline-flex"><?php echo wc_price( $regular_total ); ?></span>
                                    <?php echo $subtotal_html; ?>
                                </span>
                                <?php
                            } else {
                                ?>
                                <span class="montserrat-bold">
                                    <?php echo $subtotal_html; ?>
                                </span>
                                <?php
                            }
                            ?>
                            <div class="d-none d-md-block">
                                <?php
                                if ( $_product->is_sold_individually() ) {
                                    $min_quantity = 1;
                                    $max_quantity = 1;
                                } else {
                                    $min_quantity = 0;
                                    $max_quantity = $_product->get_max_purchase_quantity();
                                }

                                $product_quantity = woocommerce_quantity_input(
                                    array(
                                        'input_name'   => "cart[{$cart_item_key}][qty]",
                                        'input_value'  => $cart_item['quantity'],
                                        'max_value'    => $max_quantity,
                                        'min_value'    => $min_quantity,
                                        'product_name' => $product_name,
                                    ),
                                    $_product,
                                    false
                                );

                                echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item );
                                ?>
                            </div>
                            
                            
                        </div>
                    </div>
                    <?php
                }
            }
            ?>

            <?php do_action( 'woocommerce_cart_contents' ); ?>
            
            <!-- Hidden update cart button -->
            <button type="submit" class="d-none" name="update_cart" value="<?php esc_attr_e( 'Update cart', 'woocommerce' ); ?>">
                <?php esc_html_e( 'Update cart', 'woocommerce' ); ?>
            </button>
            
            <?php wp_nonce_field( 'woocommerce-cart', 'woocommerce-cart-nonce' ); ?>
            
            <?php do_action( 'woocommerce_after_cart_table' ); ?>
        </form>

        <?php do_action( 'woocommerce_before_cart_collaterals' ); ?>

        <div class="cart-collaterals">
            <?php
                /**
                 * Cart collaterals hook.
                 *
                 * @hooked woocommerce_cross_sell_display
                 * @hooked woocommerce_cart_totals - 10
                 */
                do_action( 'woocommerce_cart_collaterals' );
            ?>
        </div>
    </div>
</section>

<!-- section-interesting -->
<?php
// Показываем товары из wishlist (Избранные товары).
$wishlist_ids = matreshka_get_wishlist( true );
$wishlist_ids = array_filter( array_map( 'absint', (array) $wishlist_ids ) );

if ( ! empty( $wishlist_ids ) ) :
    $args = array(
        'post_type'      => 'product',
        'post_status'    => 'publish',
        'posts_per_page' => 10,
        'post__in'       => $wishlist_ids,
        'orderby'        => 'post__in',
    );
    $q = new WP_Query( $args );
    
    if ( $q->have_posts() ) :
        ?>
        <section>
            <div class="container mb-5 d-none d-md-block">
                <div class="container-interesting">
                    <h2 class="montserrat-bold mb-5">
                        <a href="<?php echo esc_url( home_url( '/wishlist/' ) ); ?>" class="text-decoration-none text-dark">
                            Не забудьте купить
                            <img src="<?php echo esc_url( get_template_directory_uri() . '/assets/icons/AltArrowRight.svg' ); ?>" alt="arrow right icon">
                        </a>
                    </h2>
                    <div class="product-cards container-products">
                        <?php
                        while ( $q->have_posts() ) :
                            $q->the_post();
                            $product = wc_get_product( get_the_ID() );
                            if ( ! $product ) {
                                continue;
                            }
                            
                            $product_id    = $product->get_id();
                            $product_link  = get_permalink( $product_id );
                            $product_image = wp_get_attachment_image_url( $product->get_image_id(), 'woocommerce_thumbnail' );
                            $product_title = get_the_title( $product_id );
                            $regular_price = $product->get_regular_price();
                            $sale_price    = $product->get_sale_price();
                            $price         = $sale_price ? $sale_price : $regular_price;
                            
                            $weight = $product->get_weight();
                            $weight_text = $weight ? $weight . 'г' : '200г';
                            
                            $is_liked = matreshka_is_in_wishlist( $product_id );
                            $like_icon = $is_liked ? get_template_directory_uri() . '/assets/icons/Heart.svg' : get_template_directory_uri() . '/assets/icons/like.svg';
                            ?>
                            <div class="product-card" data-product-id="<?php echo esc_attr( $product_id ); ?>">
                                <a class="link-product" href="<?php echo esc_url( $product_link ); ?>">
                                    <div class="product-card-img">
                                        <?php echo matreshka_get_product_card_image_html( $product, $product_title ); ?>
                                    </div>
                                    <p class="montserrat-medium"><?php echo esc_html( $product_title ); ?></p>
                                    <span class="montserrat-medium"><?php echo esc_html( $weight_text ); ?></span>
                                </a>
                                <div class="product-card-bottom">
                                    <?php echo matreshka_get_product_price_html( $product ); ?>
                                    <img src="<?php echo esc_url( $like_icon ); ?>" alt="like icon" class="like-icon <?php echo $is_liked ? 'active' : ''; ?>">
                                </div>
                                <button class="btn w-100 btn-secondary montserrat-bold add-to-cart-btn" data-product_id="<?php echo esc_attr( $product_id ); ?>" data-product_sku="<?php echo esc_attr( $product->get_sku() ); ?>">
                                    В корзину
                                </button>
                            </div>
                            <?php
                        endwhile;
                        ?>
                    </div>
                </div>
            </div>
        </section>
        <?php
        wp_reset_postdata();
    else :
        wp_reset_postdata();
    endif;
endif;
?>

<?php do_action( 'woocommerce_after_cart' ); ?>

Youez - 2016 - github.com/yon3zu
LinuXploit