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/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/themes/matreshka//page-wishlist.php
<?php
/*
Template Name: Избранные товары
*/

$wishlist = matreshka_get_wishlist( true );

// Pagination
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$per_page = 50;
$total_items = count( $wishlist );
$total_pages = ceil( $total_items / $per_page );
$paged = $total_pages > 0 ? min( $paged, $total_pages ) : 1;
$offset = ( $paged - 1 ) * $per_page;
$wishlist_paged = array_slice( $wishlist, $offset, $per_page );

get_header();
?>

<!-- bread-crumb -->
<section class="bread-crumb d-none d-md-flex mt-4">
	<div class="container">
		<p class="montserrat-medium">
			<a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="text-decoration-none text-dark">Главная</a> 
            <span class="dot">●</span>
            <span class="bread-crumb-product">Избранные товары</span>
		</p>
	</div>
</section>

<!-- header -->
<section>
	<div class="container mt-3">
		<div class="d-flex align-items-center justify-content-between">
			<div class="d-flex align-items-center">
				<a href="javascript:history.back()" class="d-block d-md-none me-3">
					<img src="<?php echo esc_url( get_template_directory_uri() . '/assets/icons/AltArrowLeft.svg' ); ?>" alt="arrow left icon">
				</a>
				<h2 class="montserrat-semibold mb-0" style="font-size: 18px !important;">Избранные товары</h2>
			</div>
			<?php if ( $total_items > 0 ) : ?>
				<span class="montserrat-medium text-dark-opacity">
					<?php echo esc_html( $total_items ); ?> товаров
				</span>
			<?php endif; ?>
		</div>
	</div>
</section>

<!-- products -->
<section>
	<div class="container mb-5 mt-4">
		<?php if ( ! empty( $wishlist_paged ) ) : ?>
			<div class="new-products-grid">
				<?php
				foreach ( $wishlist_paged as $product_id ) :
					$product = wc_get_product( $product_id );
					
					if ( ! $product || ! $product->is_visible() ) {
						continue;
					}
					
					$product_link = get_permalink( $product_id );
					$product_image = wp_get_attachment_image_url( $product->get_image_id(), 'woocommerce_thumbnail' );
					$product_title = $product->get_name();
					
					$weight = $product->get_weight();
					$weight_text = $weight ? $weight . 'г' : '';
					
					// Check if product is in wishlist
					$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';
					
					// Get sale percentage
					$sale_badge = matreshka_get_sale_badge( $product, 'card' );
				?>
					<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 ); ?>
								
								<?php echo $sale_badge; ?>
							</div>
							<p class="montserrat-medium product-title">
								<?php echo esc_html( $product_title ); ?>
							</p>
							<?php if ( $weight_text ) : ?>
								<span class="montserrat-medium text-dark-opacity"><?php echo esc_html( $weight_text ); ?></span>
							<?php endif; ?>
						</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 endforeach; ?>
			</div>

			<!-- Pagination -->
			<?php if ( $total_pages > 1 ) : ?>
				<nav class="matreshka-pagination mt-5" aria-label="Page navigation">
					<ul class="pagination justify-content-center">
						<?php
						$current_page = max( 1, $paged );
						
						// Previous page link
						if ( $current_page > 1 ) :
							$prev_link = get_pagenum_link( $current_page - 1 );
						?>
							<li class="page-item">
								<a class="page-link" href="<?php echo esc_url( $prev_link ); ?>" aria-label="Previous">
									<span aria-hidden="true">«</span>
								</a>
							</li>
						<?php else : ?>
							<li class="page-item disabled">
								<span class="page-link">«</span>
							</li>
						<?php endif; ?>

						<?php
						// Page numbers
						$range = 2; // How many pages to show on each side of current page
						
						for ( $i = 1; $i <= $total_pages; $i++ ) :
							// Show first page, last page, current page and pages around current
							if ( $i == 1 || $i == $total_pages || ( $i >= $current_page - $range && $i <= $current_page + $range ) ) :
								if ( $i == $current_page ) :
						?>
									<li class="page-item active" aria-current="page">
										<span class="page-link"><?php echo $i; ?></span>
									</li>
								<?php else : ?>
									<li class="page-item">
										<a class="page-link" href="<?php echo esc_url( get_pagenum_link( $i ) ); ?>">
											<?php echo $i; ?>
										</a>
									</li>
								<?php endif; ?>
							<?php
							// Show ellipsis
							elseif ( $i == $current_page - $range - 1 || $i == $current_page + $range + 1 ) :
							?>
								<li class="page-item disabled">
									<span class="page-link">...</span>
								</li>
							<?php
							endif;
						endfor;
						?>

						<?php
						// Next page link
						if ( $current_page < $total_pages ) :
							$next_link = get_pagenum_link( $current_page + 1 );
						?>
							<li class="page-item">
								<a class="page-link" href="<?php echo esc_url( $next_link ); ?>" aria-label="Next">
									<span aria-hidden="true">»</span>
								</a>
							</li>
						<?php else : ?>
							<li class="page-item disabled">
								<span class="page-link">»</span>
							</li>
						<?php endif; ?>
					</ul>
				</nav>
			<?php endif; ?>
			
		<?php else : ?>
			<div class="text-center py-5">
				<img src="<?php echo esc_url( get_template_directory_uri() . '/assets/img/notfount.png' ); ?>" alt="No products" class="mb-3" style="max-width: 200px;">
				<h3 class="montserrat-semibold mb-3">Список избранных товаров пуст</h3>
				<p class="montserrat-medium text-dark-opacity mb-4">Добавьте товары в избранное, нажав на иконку сердца</p>
				<a href="<?php echo esc_url( wc_get_page_permalink( 'shop' ) ); ?>" class="btn btn-red-primary montserrat-bold">
					Перейти в каталог
				</a>
			</div>
		<?php endif; ?>
	</div>
</section>

<?php
get_footer();

Youez - 2016 - github.com/yon3zu
LinuXploit