Compare commits

...

2 Commits

  1. 10
      wp-content/themes/cosmopet/archive-blog_author.php
  2. 420
      wp-content/themes/cosmopet/comments.php
  3. 2
      wp-content/themes/cosmopet/functions.php
  4. 3070
      wp-content/themes/cosmopet/global-functions/multilang-functions.php
  5. 6
      wp-content/themes/cosmopet/global-functions/multisite-functions.php
  6. 90
      wp-content/themes/cosmopet/modules/author/assets/js/author-posts-ajax.js
  7. 108
      wp-content/themes/cosmopet/modules/author/components/author-archive/component-controller.php
  8. 80
      wp-content/themes/cosmopet/modules/author/components/author-single/component-controller.php
  9. 68
      wp-content/themes/cosmopet/modules/author/module-ajax-controller.php
  10. 396
      wp-content/themes/cosmopet/modules/blog/assets/js/comments.js
  11. 398
      wp-content/themes/cosmopet/modules/blog/components/editorial/assets/css/style.css
  12. 292
      wp-content/themes/cosmopet/modules/blog/components/single/assets/js/post-likes.js
  13. 1916
      wp-content/themes/cosmopet/modules/footer/assets/js/footer.js
  14. 8006
      wp-content/themes/cosmopet/modules/forms/components/discount/assets/css/discount-form.css
  15. 192
      wp-content/themes/cosmopet/modules/profile/assets/js/profile.js
  16. 386
      wp-content/themes/cosmopet/modules/profile/components/profile/component-controller.php
  17. 286
      wp-content/themes/cosmopet/modules/profile/components/subscription_single/component-controller.php
  18. 214
      wp-content/themes/cosmopet/modules/profile/components/subscriptions/component-controller.php
  19. 405
      wp-content/themes/cosmopet/modules/profile/module-ajax-controller.php
  20. 760
      wp-content/themes/cosmopet/modules/shop/components/cart/assets/js/cart.js
  21. 24
      wp-content/themes/cosmopet/modules/shop/components/cart/component-controller.php
  22. 2684
      wp-content/themes/cosmopet/modules/shop/components/checkout/assets/css/checkout.css
  23. 664
      wp-content/themes/cosmopet/modules/shop/components/checkout/assets/js/script.js
  24. 146
      wp-content/themes/cosmopet/modules/shop/components/single-product/component-controller.php
  25. 886
      wp-content/themes/cosmopet/modules/shop/components/single-product/component-template.twig
  26. 282
      wp-content/themes/cosmopet/modules/shop/module-ajax-controller.php
  27. 772
      wp-content/themes/cosmopet/modules/shop/module-controller.php
  28. 60
      wp-content/themes/cosmopet/page.php
  29. 118
      wp-content/themes/cosmopet/single-product.php
  30. 6
      wp-content/themes/cosmopet/static/front-page/css/style.css
  31. 1676
      wp-content/themes/cosmopet/templates/blog/blog-page.twig
  32. 118
      wp-content/themes/cosmopet/templates/blog_author/author-archive.twig
  33. 70
      wp-content/themes/cosmopet/templates/blog_author/author-posts-list.twig
  34. 182
      wp-content/themes/cosmopet/templates/blog_author/author-single.twig
  35. 62
      wp-content/themes/cosmopet/templates/comment/comment.twig
  36. 88
      wp-content/themes/cosmopet/templates/forms/discount.twig
  37. 1
      wp-content/themes/cosmopet/templates/header.twig
  38. 236
      wp-content/themes/cosmopet/templates/layout.twig
  39. 134
      wp-content/themes/cosmopet/templates/modal.twig
  40. 86
      wp-content/themes/cosmopet/templates/modal/basket.twig
  41. 100
      wp-content/themes/cosmopet/templates/modal/login.twig
  42. 18
      wp-content/themes/cosmopet/templates/page.twig
  43. 160
      wp-content/themes/cosmopet/templates/pet-card.twig
  44. 1220
      wp-content/themes/cosmopet/templates/profile/profile-base.twig
  45. 210
      wp-content/themes/cosmopet/templates/profile/profile-orders.twig
  46. 264
      wp-content/themes/cosmopet/templates/profile/profile-subs-single.twig
  47. 154
      wp-content/themes/cosmopet/templates/profile/profile-subs.twig
  48. 830
      wp-content/themes/cosmopet/templates/profile/profile.twig
  49. 160
      wp-content/themes/cosmopet/templates/shop/bestsellers.twig
  50. 90
      wp-content/themes/cosmopet/templates/shop/cart-contents.twig
  51. 300
      wp-content/themes/cosmopet/templates/shop/checkout.twig
  52. 130
      wp-content/themes/cosmopet/templates/shop/review-order.twig
  53. 124
      wp-content/themes/cosmopet/templates/shop/single-product.php
  54. 272
      wp-content/themes/cosmopet/templates/where_to_buy/template_wtb.php
  55. 16
      wp-content/themes/cosmopet/woocommerce/archive-product/archive-product-ajaxload.twig
  56. 440
      wp-content/themes/cosmopet/woocommerce/archive-product/archive-product-modal.twig
  57. 240
      wp-content/themes/cosmopet/woocommerce/archive-product/archive-product-tease.twig
  58. 218
      wp-content/themes/cosmopet/woocommerce/assets/js/core.js
  59. 240
      wp-content/themes/cosmopet/woocommerce/cart/cart-shipping.php
  60. 56
      wp-content/themes/cosmopet/woocommerce/checkout/form-checkout.php
  61. 36
      wp-content/themes/cosmopet/woocommerce/single-product.php

@ -1,6 +1,6 @@
<?php <?php
include_module('author'); include_module('author');
include_component('author', 'author-archive'); include_component('author', 'author-archive');
?> ?>

@ -1,211 +1,211 @@
<?php <?php
if (!defined('ABSPATH')) { if (!defined('ABSPATH')) {
exit; exit;
} }
function count_nested_replies($comment_id) { function count_nested_replies($comment_id) {
$count = 0; $count = 0;
$replies = get_comments(array( $replies = get_comments(array(
'post_id' => get_the_ID(), 'post_id' => get_the_ID(),
'status' => 'approve', 'status' => 'approve',
'parent' => $comment_id, 'parent' => $comment_id,
'order' => 'ASC' 'order' => 'ASC'
)); ));
if ($replies) { if ($replies) {
$count += count($replies); $count += count($replies);
foreach ($replies as $reply) { foreach ($replies as $reply) {
$count += count_nested_replies($reply->comment_ID); $count += count_nested_replies($reply->comment_ID);
} }
} }
return $count; return $count;
} }
if (post_password_required()) { if (post_password_required()) {
return; return;
} }
if (!is_user_logged_in()) { if (!is_user_logged_in()) {
?> ?>
<div class="comment-block"> <div class="comment-block">
<p class="comment-block_text"> <p class="comment-block_text">
<a href="#modal"><?php pll_e('Войдите'); ?></a>, <?php pll_e('чтобы оставлять комментарии'); ?> <a href="#modal"><?php pll_e('Войдите'); ?></a>, <?php pll_e('чтобы оставлять комментарии'); ?>
</p> </p>
</div> </div>
<?php <?php
} }
$top_level_comments = get_comments(array( $top_level_comments = get_comments(array(
'post_id' => get_the_ID(), 'post_id' => get_the_ID(),
'status' => 'approve', 'status' => 'approve',
'parent' => 0, 'parent' => 0,
'order' => 'ASC' 'order' => 'ASC'
)); ));
if ($top_level_comments) { if ($top_level_comments) {
echo '<div class="comment-block_wrapper">'; echo '<div class="comment-block_wrapper">';
foreach ($top_level_comments as $comment) { foreach ($top_level_comments as $comment) {
?> ?>
<div class="comment-block" id="comment-<?php echo $comment->comment_ID; ?>"> <div class="comment-block" id="comment-<?php echo $comment->comment_ID; ?>">
<div class="comment-user"> <div class="comment-user">
<?php echo get_avatar($comment, 50); ?> <?php echo get_avatar($comment, 50); ?>
<div class="comment-user_text"> <div class="comment-user_text">
<h6><?php echo get_comment_author($comment); ?></h6> <h6><?php echo get_comment_author($comment); ?></h6>
<span><?php echo get_comment_date('d F Y', $comment); ?></span> <span><?php echo get_comment_date('d F Y', $comment); ?></span>
</div> </div>
</div> </div>
<p><?php echo get_comment_text($comment); ?></p> <p><?php echo get_comment_text($comment); ?></p>
<div class="comment-btns"> <div class="comment-btns">
<button class="reply-to-comment" data-comment-id="<?php echo $comment->comment_ID; ?>" data-post-id="<?php echo get_the_ID(); ?>" data-reply-to="<?php echo esc_attr(get_comment_author($comment)); ?>"> <button class="reply-to-comment" data-comment-id="<?php echo $comment->comment_ID; ?>" data-post-id="<?php echo get_the_ID(); ?>" data-reply-to="<?php echo esc_attr(get_comment_author($comment)); ?>">
<svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.5 3H3.25C2.00736 3 1 4.00736 1 5.25V5.25C1 6.49264 2.00736 7.5 3.25 7.5H3.5" stroke="#666666"></path> <path d="M9.5 3H3.25C2.00736 3 1 4.00736 1 5.25V5.25C1 6.49264 2.00736 7.5 3.25 7.5H3.5" stroke="#666666"></path>
<path d="M7 0.5L9.5 3L7 5.5" stroke="#666666"></path> <path d="M7 0.5L9.5 3L7 5.5" stroke="#666666"></path>
</svg> </svg>
<?php pll_e('Ответить'); ?> <?php pll_e('Ответить'); ?>
</button> </button>
<button class="comment-like-btn<?php echo is_user_liked_comment($comment->comment_ID) ? ' active' : ''; ?>" data-comment-id="<?php echo $comment->comment_ID; ?>"> <button class="comment-like-btn<?php echo is_user_liked_comment($comment->comment_ID) ? ' active' : ''; ?>" data-comment-id="<?php echo $comment->comment_ID; ?>">
<svg width="15" height="13" viewBox="0 0 15 13" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="15" height="13" viewBox="0 0 15 13" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.7745 1C8.67239 1 7.7426 2.5355 7.54047 3.30325C7.39224 2.5355 6.49748 1 4.10427 1C1.11276 1 -0.221288 4.85199 2.40639 8.14801C4.50853 10.7848 6.705 11.8147 7.54047 12C8.47026 11.8279 10.8311 10.761 12.8363 7.87004C15.3427 4.25632 13.4022 1 10.7745 1Z" <?php echo is_user_liked_comment($comment->comment_ID) ? 'stroke="#ff0000" fill="rgba(255, 0, 0, 0.7)"' : 'stroke="#666666"'; ?>></path> <path d="M10.7745 1C8.67239 1 7.7426 2.5355 7.54047 3.30325C7.39224 2.5355 6.49748 1 4.10427 1C1.11276 1 -0.221288 4.85199 2.40639 8.14801C4.50853 10.7848 6.705 11.8147 7.54047 12C8.47026 11.8279 10.8311 10.761 12.8363 7.87004C15.3427 4.25632 13.4022 1 10.7745 1Z" <?php echo is_user_liked_comment($comment->comment_ID) ? 'stroke="#ff0000" fill="rgba(255, 0, 0, 0.7)"' : 'stroke="#666666"'; ?>></path>
</svg> </svg>
<?php echo get_comment_likes_count($comment->comment_ID); ?> <?php echo get_comment_likes_count($comment->comment_ID); ?>
</button> </button>
<?php <?php
comment_reply_link(array( comment_reply_link(array(
'reply_text' => pll__('Ответить'), 'reply_text' => pll__('Ответить'),
'depth' => 1, 'depth' => 1,
'max_depth' => get_option('thread_comments_depth'), 'max_depth' => get_option('thread_comments_depth'),
'before' => '<span style="display:none;">', 'before' => '<span style="display:none;">',
'after' => '</span>', 'after' => '</span>',
), $comment->comment_ID, get_the_ID()); ), $comment->comment_ID, get_the_ID());
?> ?>
</div> </div>
<div class="reply-form-container" id="reply-form-<?php echo $comment->comment_ID; ?>" style="display: none;"></div> <div class="reply-form-container" id="reply-form-<?php echo $comment->comment_ID; ?>" style="display: none;"></div>
</div> </div>
<?php <?php
$all_nested_replies = get_all_nested_replies($comment->comment_ID); $all_nested_replies = get_all_nested_replies($comment->comment_ID);
if (!empty($all_nested_replies)) { if (!empty($all_nested_replies)) {
$total_reply_count = count($all_nested_replies); $total_reply_count = count($all_nested_replies);
?> ?>
<button class="answer-btn"> <button class="answer-btn">
<svg width="15" height="10" viewBox="0 0 15 10" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="15" height="10" viewBox="0 0 15 10" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14 1.41406L7.5 7.91406L1 1.41406" stroke="#76CE75" stroke-width="2"></path> <path d="M14 1.41406L7.5 7.91406L1 1.41406" stroke="#76CE75" stroke-width="2"></path>
</svg> </svg>
<?php echo $total_reply_count; ?> <?php echo $total_reply_count; ?>
<span> <span>
<?php echo ($total_reply_count == 1) ? pll__('ответ') : pll__('ответа'); ?> <?php echo ($total_reply_count == 1) ? pll__('ответ') : pll__('ответа'); ?>
</span> </span>
</button> </button>
<?php <?php
foreach ($all_nested_replies as $reply) { foreach ($all_nested_replies as $reply) {
?> ?>
<div class="comment-block answer-block" id="comment-<?php echo $reply->comment_ID; ?>"> <div class="comment-block answer-block" id="comment-<?php echo $reply->comment_ID; ?>">
<div class="comment-user"> <div class="comment-user">
<?php echo get_avatar($reply, 50); ?> <?php echo get_avatar($reply, 50); ?>
<div class="comment-user_text"> <div class="comment-user_text">
<h6><?php echo get_comment_author($reply); ?></h6> <h6><?php echo get_comment_author($reply); ?></h6>
<span><?php echo get_comment_date('d F Y', $reply); ?></span> <span><?php echo get_comment_date('d F Y', $reply); ?></span>
</div> </div>
</div> </div>
<p><?php echo get_comment_text($reply); ?></p> <p><?php echo get_comment_text($reply); ?></p>
<div class="comment-btns"> <div class="comment-btns">
<button class="reply-to-comment" data-comment-id="<?php echo $reply->comment_ID; ?>" data-post-id="<?php echo get_the_ID(); ?>" data-reply-to="<?php echo esc_attr(get_comment_author($reply)); ?>"> <button class="reply-to-comment" data-comment-id="<?php echo $reply->comment_ID; ?>" data-post-id="<?php echo get_the_ID(); ?>" data-reply-to="<?php echo esc_attr(get_comment_author($reply)); ?>">
<svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.5 3H3.25C2.00736 3 1 4.00736 1 5.25V5.25C1 6.49264 2.00736 7.5 3.25 7.5H3.5" stroke="#666666"></path> <path d="M9.5 3H3.25C2.00736 3 1 4.00736 1 5.25V5.25C1 6.49264 2.00736 7.5 3.25 7.5H3.5" stroke="#666666"></path>
<path d="M7 0.5L9.5 3L7 5.5" stroke="#666666"></path> <path d="M7 0.5L9.5 3L7 5.5" stroke="#666666"></path>
</svg> </svg>
<?php pll_e('Ответить'); ?> <?php pll_e('Ответить'); ?>
</button> </button>
<button class="comment-like-btn<?php echo is_user_liked_comment($reply->comment_ID) ? ' active' : ''; ?>" data-comment-id="<?php echo $reply->comment_ID; ?>"> <button class="comment-like-btn<?php echo is_user_liked_comment($reply->comment_ID) ? ' active' : ''; ?>" data-comment-id="<?php echo $reply->comment_ID; ?>">
<svg width="15" height="13" viewBox="0 0 15 13" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="15" height="13" viewBox="0 0 15 13" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.7745 1C8.67239 1 7.7426 2.5355 7.54047 3.30325C7.39224 2.5355 6.49748 1 4.10427 1C1.11276 1 -0.221288 4.85199 2.40639 8.14801C4.50853 10.7848 6.705 11.8147 7.54047 12C8.47026 11.8279 10.8311 10.761 12.8363 7.87004C15.3427 4.25632 13.4022 1 10.7745 1Z" <?php echo is_user_liked_comment($reply->comment_ID) ? 'stroke="#ff0000" fill="rgba(255, 0, 0, 0.7)"' : 'stroke="#666666"'; ?>></path> <path d="M10.7745 1C8.67239 1 7.7426 2.5355 7.54047 3.30325C7.39224 2.5355 6.49748 1 4.10427 1C1.11276 1 -0.221288 4.85199 2.40639 8.14801C4.50853 10.7848 6.705 11.8147 7.54047 12C8.47026 11.8279 10.8311 10.761 12.8363 7.87004C15.3427 4.25632 13.4022 1 10.7745 1Z" <?php echo is_user_liked_comment($reply->comment_ID) ? 'stroke="#ff0000" fill="rgba(255, 0, 0, 0.7)"' : 'stroke="#666666"'; ?>></path>
</svg> </svg>
<?php echo get_comment_likes_count($reply->comment_ID); ?> <?php echo get_comment_likes_count($reply->comment_ID); ?>
</button> </button>
<?php <?php
comment_reply_link(array( comment_reply_link(array(
'reply_text' => pll__('Ответить'), 'reply_text' => pll__('Ответить'),
'depth' => 2, 'depth' => 2,
'max_depth' => get_option('thread_comments_depth'), 'max_depth' => get_option('thread_comments_depth'),
'before' => '<span style="display:none;">', 'before' => '<span style="display:none;">',
'after' => '</span>', 'after' => '</span>',
), $reply->comment_ID, get_the_ID()); ), $reply->comment_ID, get_the_ID());
?> ?>
</div> </div>
<div class="reply-form-container" id="reply-form-<?php echo $reply->comment_ID; ?>" style="display: none;"></div> <div class="reply-form-container" id="reply-form-<?php echo $reply->comment_ID; ?>" style="display: none;"></div>
</div> </div>
<?php <?php
} }
} }
} }
echo '</div>'; echo '</div>';
} }
function get_all_nested_replies($comment_id) { function get_all_nested_replies($comment_id) {
$all_replies = array(); $all_replies = array();
$direct_replies = get_comments(array( $direct_replies = get_comments(array(
'post_id' => get_the_ID(), 'post_id' => get_the_ID(),
'status' => 'approve', 'status' => 'approve',
'parent' => $comment_id, 'parent' => $comment_id,
'order' => 'ASC' 'order' => 'ASC'
)); ));
$all_replies = array_merge($all_replies, $direct_replies); $all_replies = array_merge($all_replies, $direct_replies);
foreach ($direct_replies as $reply) { foreach ($direct_replies as $reply) {
$deeper_replies = get_all_nested_replies_recursive($reply->comment_ID); $deeper_replies = get_all_nested_replies_recursive($reply->comment_ID);
$all_replies = array_merge($all_replies, $deeper_replies); $all_replies = array_merge($all_replies, $deeper_replies);
} }
return $all_replies; return $all_replies;
} }
function get_all_nested_replies_recursive($comment_id) { function get_all_nested_replies_recursive($comment_id) {
$replies = get_comments(array( $replies = get_comments(array(
'post_id' => get_the_ID(), 'post_id' => get_the_ID(),
'status' => 'approve', 'status' => 'approve',
'parent' => $comment_id, 'parent' => $comment_id,
'order' => 'ASC' 'order' => 'ASC'
)); ));
$all_replies = $replies; $all_replies = $replies;
foreach ($replies as $reply) { foreach ($replies as $reply) {
$deeper_replies = get_all_nested_replies_recursive($reply->comment_ID); $deeper_replies = get_all_nested_replies_recursive($reply->comment_ID);
$all_replies = array_merge($all_replies, $deeper_replies); $all_replies = array_merge($all_replies, $deeper_replies);
} }
return $all_replies; return $all_replies;
} }
if (is_user_logged_in()) { if (is_user_logged_in()) {
$commenter = wp_get_current_commenter(); $commenter = wp_get_current_commenter();
$args = array( $args = array(
'fields' => array( 'fields' => array(
'author' => '', 'author' => '',
'email' => '', 'email' => '',
'url' => '', 'url' => '',
'cookies' => '', 'cookies' => '',
), ),
'comment_field' => '<div class="comment-form-comment"><textarea id="comment" name="comment" placeholder="' . pll__('Ваш комментарий') . '" required></textarea></div>', 'comment_field' => '<div class="comment-form-comment"><textarea id="comment" name="comment" placeholder="' . pll__('Ваш комментарий') . '" required></textarea></div>',
'title_reply' => pll__('Оставить комментарий'), 'title_reply' => pll__('Оставить комментарий'),
'title_reply_to' => pll__('Ответить %s'), 'title_reply_to' => pll__('Ответить %s'),
'class_submit' => 'comment-submit-btn', 'class_submit' => 'comment-submit-btn',
'submit_button' => '<button name="%1$s" type="submit" id="%2$s" class="%3$s">%4$s</button>', 'submit_button' => '<button name="%1$s" type="submit" id="%2$s" class="%3$s">%4$s</button>',
'submit_field' => '<div class="form-submit">%1$s %2$s</div>', 'submit_field' => '<div class="form-submit">%1$s %2$s</div>',
'cancel_reply_link' => pll__('Отменить'), 'cancel_reply_link' => pll__('Отменить'),
'id_form' => 'commentform', 'id_form' => 'commentform',
'id_submit' => 'submit', 'id_submit' => 'submit',
'title_reply_before' => '<h3 id="reply-title" class="comment-reply-title">', 'title_reply_before' => '<h3 id="reply-title" class="comment-reply-title">',
'title_reply_after' => '</h3>', 'title_reply_after' => '</h3>',
); );
comment_form($args); comment_form($args);
} }
?> ?>

@ -1339,4 +1339,4 @@ function custom_handle_activation_request() {
} }
} }
} }

@ -426,4 +426,8 @@ function woocommerce_ajax_add_to_cart() {
} }
wp_die(); wp_die();
}}
}
}

@ -1,46 +1,46 @@
jQuery(document).ready(function ($) { jQuery(document).ready(function ($) {
$('#ajax-load-author').on('submit', function (e) { $('#ajax-load-author').on('submit', function (e) {
e.preventDefault(); e.preventDefault();
var form = $(this); var form = $(this);
var currentPage = parseInt($('#page_num').val()); var currentPage = parseInt($('#page_num').val());
var totalPosts = parseInt(form.data('total')); var totalPosts = parseInt(form.data('total'));
var postsPerPage = 9; var postsPerPage = 9;
console.log('Current page before load:', currentPage); console.log('Current page before load:', currentPage);
console.log('Total posts:', totalPosts); console.log('Total posts:', totalPosts);
console.log('Posts loaded before request:', postsPerPage); console.log('Posts loaded before request:', postsPerPage);
var data = { var data = {
action: 'get_author_posts', action: 'get_author_posts',
page_num: currentPage, page_num: currentPage,
author_id: form.data('author') author_id: form.data('author')
}; };
console.log('Sending AJAX request with data:', data); console.log('Sending AJAX request with data:', data);
$.ajax({ $.ajax({
url: '/wp-admin/admin-ajax.php', url: '/wp-admin/admin-ajax.php',
type: 'POST', type: 'POST',
data: data, data: data,
success: function (response) { success: function (response) {
console.log('AJAX response received'); console.log('AJAX response received');
$(".anons-article__card-wrap").append(response); $(".anons-article__card-wrap").append(response);
$('#page_num').val(currentPage + 1); $('#page_num').val(currentPage + 1);
console.log('New page number:', currentPage + 1); console.log('New page number:', currentPage + 1);
// Считаем общее количество загруженных постов // Считаем общее количество загруженных постов
var currentlyDisplayed = $('.anons-article__card-wrap .anons-best__card').length; var currentlyDisplayed = $('.anons-article__card-wrap .anons-best__card').length;
console.log('Actually displayed posts:', currentlyDisplayed); console.log('Actually displayed posts:', currentlyDisplayed);
if (currentlyDisplayed >= totalPosts) { if (currentlyDisplayed >= totalPosts) {
console.log('Hiding load more button - all posts loaded'); console.log('Hiding load more button - all posts loaded');
form.hide(); form.hide();
} }
}, },
error: function (error) { error: function (error) {
console.error('AJAX error:', error); console.error('AJAX error:', error);
} }
}); });
}); });
}); });

@ -1,54 +1,54 @@
<?php <?php
include_component('blog', 'featured-slider'); include_component('blog', 'featured-slider');
include_module('forms'); include_module('forms');
include_component('forms', 'discount'); include_component('forms', 'discount');
$context = Timber::context(); $context = Timber::context();
$context['blog_title'] = get_field('blog_title', 'options'); $context['blog_title'] = get_field('blog_title', 'options');
$context['blog_desc'] = get_field('blog_desc', 'options'); $context['blog_desc'] = get_field('blog_desc', 'options');
$context['post_count'] = wp_count_posts()->publish; $context['post_count'] = wp_count_posts()->publish;
$context['total_pages'] = ceil($context['post_count'] / get_option('posts_per_page')); $context['total_pages'] = ceil($context['post_count'] / get_option('posts_per_page'));
$context['sub_title'] = get_field('sub_title', 383); $context['sub_title'] = get_field('sub_title', 383);
$context['sub_text'] = get_field('sub_text', 383); $context['sub_text'] = get_field('sub_text', 383);
$authors = Timber::get_posts([ $authors = Timber::get_posts([
'post_type' => 'blog_author', 'post_type' => 'blog_author',
'posts_per_page' => -1, 'posts_per_page' => -1,
'orderby' => 'menu_order', 'orderby' => 'menu_order',
'order' => 'ASC', 'order' => 'ASC',
]); ]);
$authors_arr = iterator_to_array($authors); $authors_arr = iterator_to_array($authors);
foreach ($authors_arr as $author) { foreach ($authors_arr as $author) {
$author_id = $author->ID; $author_id = $author->ID;
$query = new WP_Query([ $query = new WP_Query([
'post_type' => 'post', 'post_type' => 'post',
'posts_per_page' => -1, 'posts_per_page' => -1,
'meta_query' => [ 'meta_query' => [
[ [
'key' => 'post_author', 'key' => 'post_author',
'value' => $author_id, 'value' => $author_id,
'compare' => '=' 'compare' => '='
] ]
] ]
]); ]);
$author->post_count = $query->found_posts; $author->post_count = $query->found_posts;
$author->position = get_field('post', $author_id); $author->position = get_field('post', $author_id);
$author->posts = Timber::get_posts([ $author->posts = Timber::get_posts([
'post_type' => 'post', 'post_type' => 'post',
'posts_per_page' => -1, 'posts_per_page' => -1,
'meta_query' => [ 'meta_query' => [
[ [
'key' => 'post_author', 'key' => 'post_author',
'value' => $author_id, 'value' => $author_id,
'compare' => '=' 'compare' => '='
] ]
] ]
]); ]);
} }
$context['authors'] = $authors_arr; $context['authors'] = $authors_arr;
Timber::render('blog_author/author-archive.twig', $context); Timber::render('blog_author/author-archive.twig', $context);

@ -1,41 +1,41 @@
<?php <?php
$context = Timber::get_context(); $context = Timber::get_context();
$author = Timber::get_post(); $author = Timber::get_post();
$author_id = $author->ID; $author_id = $author->ID;
$author->position = get_field('post', $author_id); $author->position = get_field('post', $author_id);
$count_query = new WP_Query([ $count_query = new WP_Query([
'post_type' => 'post', 'post_type' => 'post',
'post_status' => 'publish', 'post_status' => 'publish',
'posts_per_page' => -1, 'posts_per_page' => -1,
'meta_query' => [ 'meta_query' => [
[ [
'key' => 'post_author', 'key' => 'post_author',
'value' => $author_id, 'value' => $author_id,
'compare' => '=' 'compare' => '='
] ]
] ]
]); ]);
$author->post_count = $count_query->found_posts; $author->post_count = $count_query->found_posts;
$author->posts = Timber::get_posts([ $author->posts = Timber::get_posts([
'post_type' => 'post', 'post_type' => 'post',
'post_status' => 'publish', 'post_status' => 'publish',
'posts_per_page' => 9, 'posts_per_page' => 9,
'meta_query' => [ 'meta_query' => [
[ [
'key' => 'post_author', 'key' => 'post_author',
'value' => $author_id, 'value' => $author_id,
'compare' => '=' 'compare' => '='
] ]
] ]
]); ]);
$context['author'] = $author; $context['author'] = $author;
$context['total_pages'] = ceil($author->post_count / 9); $context['total_pages'] = ceil($author->post_count / 9);
Timber::render('blog_author/author-single.twig', $context); Timber::render('blog_author/author-single.twig', $context);

@ -1,35 +1,35 @@
<?php <?php
include_module('author'); include_module('author');
function get_author_posts() { function get_author_posts() {
$author_id = isset($_POST['author_id']) ? sanitize_text_field($_POST['author_id']) : ''; $author_id = isset($_POST['author_id']) ? sanitize_text_field($_POST['author_id']) : '';
$all_posts = Timber::get_posts([ $all_posts = Timber::get_posts([
'post_type' => 'post', 'post_type' => 'post',
'post_status' => 'publish', 'post_status' => 'publish',
'posts_per_page' => -1, 'posts_per_page' => -1,
'meta_query' => [ 'meta_query' => [
[ [
'key' => 'post_author', 'key' => 'post_author',
'value' => $author_id, 'value' => $author_id,
'compare' => '=' 'compare' => '='
] ]
] ]
]); ]);
if ($all_posts instanceof \Timber\PostQuery || $all_posts instanceof \Timber\PostCollection) { if ($all_posts instanceof \Timber\PostQuery || $all_posts instanceof \Timber\PostCollection) {
$all_posts = $all_posts->get_posts(); $all_posts = $all_posts->get_posts();
} }
$remaining_posts = array_slice($all_posts, 9); $remaining_posts = array_slice($all_posts, 9);
$context = Timber::context(); $context = Timber::context();
$context['posts'] = $remaining_posts; $context['posts'] = $remaining_posts;
Timber::render('blog_author/author-posts-list.twig', $context); Timber::render('blog_author/author-posts-list.twig', $context);
wp_die(); wp_die();
} }
add_action('wp_ajax_get_author_posts', 'get_author_posts'); add_action('wp_ajax_get_author_posts', 'get_author_posts');
add_action('wp_ajax_nopriv_get_author_posts', 'get_author_posts'); add_action('wp_ajax_nopriv_get_author_posts', 'get_author_posts');

@ -1,198 +1,198 @@
// comment // comment
let answerbtns = document.querySelectorAll('.answer-btn'); let answerbtns = document.querySelectorAll('.answer-btn');
let answerbtnicons = document.querySelectorAll('.answer-btn svg'); let answerbtnicons = document.querySelectorAll('.answer-btn svg');
// При загрузке страницы проверяем активные кнопки // При загрузке страницы проверяем активные кнопки
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
// Для каждой кнопки ответов // Для каждой кнопки ответов
answerbtns.forEach((answerbtn) => { answerbtns.forEach((answerbtn) => {
// Находим родительский контейнер, чтобы искать ответы только для этого комментария // Находим родительский контейнер, чтобы искать ответы только для этого комментария
const buttonParent = answerbtn.parentElement; const buttonParent = answerbtn.parentElement;
// Находим все блоки ответов для этого комментария (после текущей кнопки) // Находим все блоки ответов для этого комментария (после текущей кнопки)
const answerBlocks = getRelatedAnswerBlocks(answerbtn); const answerBlocks = getRelatedAnswerBlocks(answerbtn);
if (answerBlocks.length === 0) return; if (answerBlocks.length === 0) return;
// Проверяем, должны ли быть ответы развернуты (если у кнопки или любого ответа есть класс active) // Проверяем, должны ли быть ответы развернуты (если у кнопки или любого ответа есть класс active)
const shouldBeActive = answerbtn.querySelector('svg').classList.contains('active') || const shouldBeActive = answerbtn.querySelector('svg').classList.contains('active') ||
Array.from(answerBlocks).some(block => block.classList.contains('active')); Array.from(answerBlocks).some(block => block.classList.contains('active'));
if (shouldBeActive) { if (shouldBeActive) {
// Активируем все ответы только для этого комментария // Активируем все ответы только для этого комментария
answerBlocks.forEach(block => { answerBlocks.forEach(block => {
block.classList.add('active'); block.classList.add('active');
}); });
// Обновляем состояние кнопки // Обновляем состояние кнопки
answerbtn.querySelector('svg').classList.add('active'); answerbtn.querySelector('svg').classList.add('active');
// Обновляем текст кнопки // Обновляем текст кнопки
let buttonText = answerbtn.querySelector('span'); let buttonText = answerbtn.querySelector('span');
if (buttonText) { if (buttonText) {
buttonText.textContent = 'Свернуть'; buttonText.textContent = 'Свернуть';
} }
} else { } else {
// Скрываем все ответы // Скрываем все ответы
answerBlocks.forEach(block => { answerBlocks.forEach(block => {
block.classList.remove('active'); block.classList.remove('active');
}); });
// Обновляем состояние кнопки // Обновляем состояние кнопки
answerbtn.querySelector('svg').classList.remove('active'); answerbtn.querySelector('svg').classList.remove('active');
// Обновляем текст кнопки в зависимости от количества ответов // Обновляем текст кнопки в зависимости от количества ответов
let buttonText = answerbtn.querySelector('span'); let buttonText = answerbtn.querySelector('span');
if (buttonText) { if (buttonText) {
const count = answerBlocks.length; const count = answerBlocks.length;
buttonText.textContent = count === 1 ? 'ответ' : 'ответа'; buttonText.textContent = count === 1 ? 'ответ' : 'ответа';
} }
} }
}); });
}); });
// Функция для получения блоков ответов, связанных с данной кнопкой // Функция для получения блоков ответов, связанных с данной кнопкой
function getRelatedAnswerBlocks(answerBtn) { function getRelatedAnswerBlocks(answerBtn) {
// Получаем следующий блок комментариев (если он есть) // Получаем следующий блок комментариев (если он есть)
let currentElement = answerBtn; let currentElement = answerBtn;
let answerBlocks = []; let answerBlocks = [];
// Собираем все блоки ответов до следующего основного комментария или кнопки ответов // Собираем все блоки ответов до следующего основного комментария или кнопки ответов
while ((currentElement = currentElement.nextElementSibling) !== null) { while ((currentElement = currentElement.nextElementSibling) !== null) {
if (currentElement.classList.contains('comment-block') && !currentElement.classList.contains('answer-block')) { if (currentElement.classList.contains('comment-block') && !currentElement.classList.contains('answer-block')) {
// Достигли следующего основного комментария, прерываем сбор // Достигли следующего основного комментария, прерываем сбор
break; break;
} else if (currentElement.classList.contains('answer-btn')) { } else if (currentElement.classList.contains('answer-btn')) {
// Достигли следующей кнопки ответов, прерываем сбор // Достигли следующей кнопки ответов, прерываем сбор
break; break;
} else if (currentElement.classList.contains('answer-block')) { } else if (currentElement.classList.contains('answer-block')) {
// Это блок ответа, добавляем в коллекцию // Это блок ответа, добавляем в коллекцию
answerBlocks.push(currentElement); answerBlocks.push(currentElement);
} }
} }
return answerBlocks; return answerBlocks;
} }
// Обработчики нажатия на кнопки ответов // Обработчики нажатия на кнопки ответов
answerbtns.forEach((answerbtn) => { answerbtns.forEach((answerbtn) => {
answerbtn.addEventListener('click', () => { answerbtn.addEventListener('click', () => {
// Получаем все блоки ответов для этого комментария // Получаем все блоки ответов для этого комментария
const answerBlocks = getRelatedAnswerBlocks(answerbtn); const answerBlocks = getRelatedAnswerBlocks(answerbtn);
if (answerBlocks.length === 0) return; if (answerBlocks.length === 0) return;
// Определяем, развернуты ли ответы сейчас // Определяем, развернуты ли ответы сейчас
const isCurrentlyActive = answerbtn.querySelector('svg').classList.contains('active'); const isCurrentlyActive = answerbtn.querySelector('svg').classList.contains('active');
// Переключаем состояние // Переключаем состояние
if (isCurrentlyActive) { if (isCurrentlyActive) {
// Скрываем все ответы // Скрываем все ответы
answerBlocks.forEach(block => { answerBlocks.forEach(block => {
block.classList.remove('active'); block.classList.remove('active');
}); });
// Обновляем состояние кнопки // Обновляем состояние кнопки
answerbtn.querySelector('svg').classList.remove('active'); answerbtn.querySelector('svg').classList.remove('active');
// Обновляем текст кнопки // Обновляем текст кнопки
let buttonText = answerbtn.querySelector('span'); let buttonText = answerbtn.querySelector('span');
if (buttonText) { if (buttonText) {
const count = answerBlocks.length; const count = answerBlocks.length;
buttonText.textContent = count === 1 ? 'ответ' : 'ответа'; buttonText.textContent = count === 1 ? 'ответ' : 'ответа';
} }
} else { } else {
// Показываем все ответы // Показываем все ответы
answerBlocks.forEach(block => { answerBlocks.forEach(block => {
block.classList.add('active'); block.classList.add('active');
}); });
// Обновляем состояние кнопки // Обновляем состояние кнопки
answerbtn.querySelector('svg').classList.add('active'); answerbtn.querySelector('svg').classList.add('active');
// Обновляем текст кнопки // Обновляем текст кнопки
let buttonText = answerbtn.querySelector('span'); let buttonText = answerbtn.querySelector('span');
if (buttonText) { if (buttonText) {
buttonText.textContent = 'Свернуть'; buttonText.textContent = 'Свернуть';
} }
} }
}); });
}); });
// Обработка нажатия на кнопку "Ответить" на комментарий // Обработка нажатия на кнопку "Ответить" на комментарий
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
// Получаем все кнопки "Ответить" на странице // Получаем все кнопки "Ответить" на странице
const replyButtons = document.querySelectorAll('.reply-to-comment'); const replyButtons = document.querySelectorAll('.reply-to-comment');
// Добавляем обработчик на каждую кнопку // Добавляем обработчик на каждую кнопку
replyButtons.forEach(button => { replyButtons.forEach(button => {
button.addEventListener('click', function() { button.addEventListener('click', function() {
// Получаем ID комментария, на который отвечаем // Получаем ID комментария, на который отвечаем
const commentId = this.getAttribute('data-comment-id'); const commentId = this.getAttribute('data-comment-id');
const postId = this.getAttribute('data-post-id'); const postId = this.getAttribute('data-post-id');
const replyToName = this.getAttribute('data-reply-to'); const replyToName = this.getAttribute('data-reply-to');
// Получаем контейнер для формы ответа // Получаем контейнер для формы ответа
const replyFormContainer = document.getElementById('reply-form-' + commentId); const replyFormContainer = document.getElementById('reply-form-' + commentId);
// Если форма уже открыта, скрываем её // Если форма уже открыта, скрываем её
if (replyFormContainer.style.display !== 'none') { if (replyFormContainer.style.display !== 'none') {
replyFormContainer.style.display = 'none'; replyFormContainer.style.display = 'none';
return; return;
} }
// Скрываем все открытые формы ответов // Скрываем все открытые формы ответов
document.querySelectorAll('.reply-form-container').forEach(container => { document.querySelectorAll('.reply-form-container').forEach(container => {
container.style.display = 'none'; container.style.display = 'none';
}); });
// Клонируем основную форму комментариев // Клонируем основную форму комментариев
const originalForm = document.getElementById('commentform'); const originalForm = document.getElementById('commentform');
if (originalForm) { if (originalForm) {
const clonedForm = originalForm.cloneNode(true); const clonedForm = originalForm.cloneNode(true);
// Изменяем атрибуты формы для ответа // Изменяем атрибуты формы для ответа
clonedForm.id = 'commentform-reply-' + commentId; clonedForm.id = 'commentform-reply-' + commentId;
// Добавляем скрытое поле с ID родительского комментария // Добавляем скрытое поле с ID родительского комментария
const hiddenInput = document.createElement('input'); const hiddenInput = document.createElement('input');
hiddenInput.type = 'hidden'; hiddenInput.type = 'hidden';
hiddenInput.name = 'comment_parent'; hiddenInput.name = 'comment_parent';
hiddenInput.value = commentId; hiddenInput.value = commentId;
clonedForm.appendChild(hiddenInput); clonedForm.appendChild(hiddenInput);
// Изменяем заголовок формы // Изменяем заголовок формы
const formTitle = clonedForm.querySelector('.comment-reply-title'); const formTitle = clonedForm.querySelector('.comment-reply-title');
if (formTitle) { if (formTitle) {
formTitle.textContent = 'Ответить ' + replyToName; formTitle.textContent = 'Ответить ' + replyToName;
} }
// Добавляем кнопку отмены // Добавляем кнопку отмены
const cancelButton = document.createElement('button'); const cancelButton = document.createElement('button');
cancelButton.type = 'button'; cancelButton.type = 'button';
cancelButton.className = 'cancel-reply-btn'; cancelButton.className = 'cancel-reply-btn';
cancelButton.textContent = 'Отменить'; cancelButton.textContent = 'Отменить';
cancelButton.addEventListener('click', function() { cancelButton.addEventListener('click', function() {
replyFormContainer.style.display = 'none'; replyFormContainer.style.display = 'none';
}); });
// Добавляем кнопку отмены в форму // Добавляем кнопку отмены в форму
const submitContainer = clonedForm.querySelector('.form-submit'); const submitContainer = clonedForm.querySelector('.form-submit');
if (submitContainer) { if (submitContainer) {
submitContainer.appendChild(cancelButton); submitContainer.appendChild(cancelButton);
} }
// Очищаем контейнер и добавляем клонированную форму // Очищаем контейнер и добавляем клонированную форму
replyFormContainer.innerHTML = ''; replyFormContainer.innerHTML = '';
replyFormContainer.appendChild(clonedForm); replyFormContainer.appendChild(clonedForm);
// Показываем форму // Показываем форму
replyFormContainer.style.display = 'block'; replyFormContainer.style.display = 'block';
// Фокусируемся на текстовой области // Фокусируемся на текстовой области
const textarea = clonedForm.querySelector('textarea'); const textarea = clonedForm.querySelector('textarea');
if (textarea) { if (textarea) {
textarea.focus(); textarea.focus();
} }
} }
}); });
}); });
}); });

@ -1,200 +1,200 @@
/* Editorial */ /* Editorial */
.editorial { .editorial {
padding-bottom: 68px; padding-bottom: 68px;
} }
.editorial-head { .editorial-head {
position: relative; position: relative;
z-index: 1; z-index: 1;
max-width: 841px; max-width: 841px;
margin-bottom: 37px; margin-bottom: 37px;
} }
.editorial-head__title { .editorial-head__title {
font-size: 82px; font-size: 82px;
line-height: 96px; line-height: 96px;
font-weight: bold; font-weight: bold;
color: var(--main_white); color: var(--main_white);
text-transform: uppercase; text-transform: uppercase;
} }
.editorial-head__img { .editorial-head__img {
position: absolute; position: absolute;
z-index: -1; z-index: -1;
top: -14px; top: -14px;
right: -20px; right: -20px;
width: 221px; width: 221px;
} }
.editorial-head__star { .editorial-head__star {
position: absolute; position: absolute;
top: 8.26px; top: 8.26px;
right: -13.5px; right: -13.5px;
transform: translateX(100%); transform: translateX(100%);
width: 87.5px; width: 87.5px;
} }
.editorial-card__wrap { .editorial-card__wrap {
display: grid; display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 31px 25px; gap: 31px 25px;
position: relative; position: relative;
z-index: 1; z-index: 1;
} }
.editorial-card { .editorial-card {
border: 2px solid var(--creme-white); border: 2px solid var(--creme-white);
border-radius: 30px; border-radius: 30px;
display: flex; display: flex;
align-items: stretch; align-items: stretch;
overflow: hidden; overflow: hidden;
background: var(--linear); background: var(--linear);
backdrop-filter: blur(28px); backdrop-filter: blur(28px);
} }
.editorial-card .main-img { .editorial-card .main-img {
min-height: 282px; min-height: 282px;
width: 207px; width: 207px;
border-radius: 29px; border-radius: 29px;
overflow: hidden; overflow: hidden;
flex-shrink: 0; flex-shrink: 0;
} }
.editorial-card:hover .main-img img{ .editorial-card:hover .main-img img{
width: 120%; width: 120%;
height: 120%; height: 120%;
} }
.editorial-card .main-img img { .editorial-card .main-img img {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
transition: all .5s; transition: all .5s;
} }
.editorial-card__content { .editorial-card__content {
padding: 42px 19px 19px 35px; padding: 42px 19px 19px 35px;
} }
.editorial-card__content-alerts { .editorial-card__content-alerts {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-items: center; align-items: center;
gap: 7px; gap: 7px;
margin-bottom: 17px; margin-bottom: 17px;
} }
.editorial-card__content-alerts a { .editorial-card__content-alerts a {
background: var(--main_black); background: var(--main_black);
border-radius: 16px; border-radius: 16px;
padding: 6px 8px; padding: 6px 8px;
font-size: 16px; font-size: 16px;
font-weight: 500; font-weight: 500;
line-height: 20px; line-height: 20px;
color: var(--background); color: var(--background);
} }
.editorial-card__content-title { .editorial-card__content-title {
font-size: 28px; font-size: 28px;
font-weight: bold; font-weight: bold;
line-height: 32px; line-height: 32px;
color: var(--grey-black); color: var(--grey-black);
text-transform: uppercase; text-transform: uppercase;
margin-bottom: 17px; margin-bottom: 17px;
} }
.editorial-card__content-data { .editorial-card__content-data {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 5px 16px; gap: 5px 16px;
color: var(--interface_hover); color: var(--interface_hover);
font-size: 16px; font-size: 16px;
font-weight: 500; font-weight: 500;
line-height: 20px; line-height: 20px;
} }
.editorial-card__content-data ul { .editorial-card__content-data ul {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 16px; gap: 16px;
} }
.editorial-card__content-data li { .editorial-card__content-data li {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 5px; gap: 5px;
} }
.editorial-card__content-data .logo img { .editorial-card__content-data .logo img {
width: 24px; width: 24px;
height: 24px; height: 24px;
border-radius: 50%; border-radius: 50%;
object-fit: cover; object-fit: cover;
} }
/* Editorial end */ /* Editorial end */
@media (max-width: 1200px) { @media (max-width: 1200px) {
.editorial-card__wrap { .editorial-card__wrap {
grid-template-columns: repeat(1, minmax(0, 1fr)); grid-template-columns: repeat(1, minmax(0, 1fr));
} }
} }
@media (max-width: 992px) { @media (max-width: 992px) {
.editorial { .editorial {
padding-bottom: 36px; padding-bottom: 36px;
} }
.editorial-head { .editorial-head {
margin-bottom: 36px; margin-bottom: 36px;
max-width: 313px; max-width: 313px;
} }
.editorial-head__title { .editorial-head__title {
font-size: 32px; font-size: 32px;
line-height: 38px; line-height: 38px;
} }
.editorial-head__img { .editorial-head__img {
width: 100px; width: 100px;
top: -14px; top: -14px;
right: -22.5px; right: -22.5px;
} }
.editorial-head__star { .editorial-head__star {
display: none; display: none;
} }
} }
@media (max-width: 576px) { @media (max-width: 576px) {
.editorial-card { .editorial-card {
flex-direction: column; flex-direction: column;
border-radius: 30px; border-radius: 30px;
position: relative; position: relative;
} }
.editorial-card .main-img { .editorial-card .main-img {
width: 100%; width: 100%;
height: 203px; height: 203px;
} }
.editorial-card__content { .editorial-card__content {
padding: 17px 13px 24px; padding: 17px 13px 24px;
} }
.editorial-card__content-alerts { .editorial-card__content-alerts {
position: absolute; position: absolute;
top: 13px; top: 13px;
left: 8px; left: 8px;
width: calc(100% - 16px); width: calc(100% - 16px);
} }
.editorial-card__content-title { .editorial-card__content-title {
font-size: 20px; font-size: 20px;
line-height: 24px; line-height: 24px;
margin-bottom: 17px; margin-bottom: 17px;
} }
.editorial-card__content-data { .editorial-card__content-data {
gap: 5px 16px; gap: 5px 16px;
} }
} }

@ -1,147 +1,147 @@
jQuery(document).ready(function ($) { jQuery(document).ready(function ($) {
$(".comment-btn button").on("click", function () { $(".comment-btn button").on("click", function () {
var postId = $(this).data("post-id"); var postId = $(this).data("post-id");
var $button = $(this); var $button = $(this);
$.ajax({ $.ajax({
url: "/wp-admin/admin-ajax.php", url: "/wp-admin/admin-ajax.php",
type: "POST", type: "POST",
data: { data: {
action: "add_post_like", action: "add_post_like",
post_id: postId, post_id: postId,
}, },
success: function (response) { success: function (response) {
if (response.error) { if (response.error) {
alert(response.error); alert(response.error);
window.location.href = "/wp-login.php"; window.location.href = "/wp-login.php";
return; return;
} }
$(".comment-btn span").text(response.count); $(".comment-btn span").text(response.count);
if (response.is_liked) { if (response.is_liked) {
$button.addClass("active"); $button.addClass("active");
$button.find("svg path").attr({ $button.find("svg path").attr({
fill: "rgba(255, 0, 0, 0.7)", fill: "rgba(255, 0, 0, 0.7)",
stroke: "#ff0000", stroke: "#ff0000",
}); });
} else { } else {
$button.removeClass("active"); $button.removeClass("active");
$button.find("svg path").attr({ $button.find("svg path").attr({
fill: "rgb(18, 18, 18)", fill: "rgb(18, 18, 18)",
stroke: "#666666", stroke: "#666666",
}); });
} }
}, },
error: function (error) { error: function (error) {
if (error.responseJSON && error.responseJSON.data) { if (error.responseJSON && error.responseJSON.data) {
alert(error.responseJSON.data); alert(error.responseJSON.data);
window.location.href = "/wp-login.php"; window.location.href = "/wp-login.php";
} }
}, },
}); });
}); });
$(document).on("click", ".comment-like-btn", function () { $(document).on("click", ".comment-like-btn", function () {
var commentId = $(this).data("comment-id"); var commentId = $(this).data("comment-id");
var $button = $(this); var $button = $(this);
$.ajax({ $.ajax({
url: "/wp-admin/admin-ajax.php", url: "/wp-admin/admin-ajax.php",
type: "POST", type: "POST",
data: { data: {
action: "add_comment_like", action: "add_comment_like",
comment_id: commentId, comment_id: commentId,
}, },
success: function (response) { success: function (response) {
if (response.error) { if (response.error) {
alert(response.error); alert(response.error);
window.location.href = "/wp-login.php"; window.location.href = "/wp-login.php";
return; return;
} }
if (response.is_liked) { if (response.is_liked) {
$button $button
.empty() .empty()
.append( .append(
$( $(
'<svg width="15" height="13" viewBox="0 0 15 13" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.7745 1C8.67239 1 7.7426 2.5355 7.54047 3.30325C7.39224 2.5355 6.49748 1 4.10427 1C1.11276 1 -0.221288 4.85199 2.40639 8.14801C4.50853 10.7848 6.705 11.8147 7.54047 12C8.47026 11.8279 10.8311 10.761 12.8363 7.87004C15.3427 4.25632 13.4022 1 10.7745 1Z" stroke="#ff0000" fill="rgba(255, 0, 0, 0.7)"></path></svg>' '<svg width="15" height="13" viewBox="0 0 15 13" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.7745 1C8.67239 1 7.7426 2.5355 7.54047 3.30325C7.39224 2.5355 6.49748 1 4.10427 1C1.11276 1 -0.221288 4.85199 2.40639 8.14801C4.50853 10.7848 6.705 11.8147 7.54047 12C8.47026 11.8279 10.8311 10.761 12.8363 7.87004C15.3427 4.25632 13.4022 1 10.7745 1Z" stroke="#ff0000" fill="rgba(255, 0, 0, 0.7)"></path></svg>'
) )
) )
.append(response.count); .append(response.count);
$button.addClass("active"); $button.addClass("active");
} else { } else {
$button $button
.empty() .empty()
.append( .append(
$( $(
'<svg width="15" height="13" viewBox="0 0 15 13" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.7745 1C8.67239 1 7.7426 2.5355 7.54047 3.30325C7.39224 2.5355 6.49748 1 4.10427 1C1.11276 1 -0.221288 4.85199 2.40639 8.14801C4.50853 10.7848 6.705 11.8147 7.54047 12C8.47026 11.8279 10.8311 10.761 12.8363 7.87004C15.3427 4.25632 13.4022 1 10.7745 1Z" stroke="#666666" fill="none"></path></svg>' '<svg width="15" height="13" viewBox="0 0 15 13" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.7745 1C8.67239 1 7.7426 2.5355 7.54047 3.30325C7.39224 2.5355 6.49748 1 4.10427 1C1.11276 1 -0.221288 4.85199 2.40639 8.14801C4.50853 10.7848 6.705 11.8147 7.54047 12C8.47026 11.8279 10.8311 10.761 12.8363 7.87004C15.3427 4.25632 13.4022 1 10.7745 1Z" stroke="#666666" fill="none"></path></svg>'
) )
) )
.append(response.count); .append(response.count);
$button.removeClass("active"); $button.removeClass("active");
} }
}, },
error: function (error) { error: function (error) {
if (error.responseJSON && error.responseJSON.data) { if (error.responseJSON && error.responseJSON.data) {
alert(error.responseJSON.data); alert(error.responseJSON.data);
window.location.href = "/wp-login.php"; window.location.href = "/wp-login.php";
} }
}, },
}); });
}); });
function checkLikedPosts() { function checkLikedPosts() {
if (!document.body.classList.contains("logged-in")) { if (!document.body.classList.contains("logged-in")) {
return; return;
} }
$.ajax({ $.ajax({
url: "/wp-admin/admin-ajax.php", url: "/wp-admin/admin-ajax.php",
type: "POST", type: "POST",
data: { data: {
action: "check_user_likes", action: "check_user_likes",
}, },
success: function (response) { success: function (response) {
if (response.error) { if (response.error) {
return; return;
} }
try { try {
var data = JSON.parse(response); var data = JSON.parse(response);
if (data.posts && data.posts.length > 0) { if (data.posts && data.posts.length > 0) {
for (var i = 0; i < data.posts.length; i++) { for (var i = 0; i < data.posts.length; i++) {
var $button = $('.comment-btn button[data-post-id="' + data.posts[i] + '"]'); var $button = $('.comment-btn button[data-post-id="' + data.posts[i] + '"]');
$button.addClass("active"); $button.addClass("active");
$button.find("svg path").attr({ $button.find("svg path").attr({
fill: "rgba(255, 0, 0, 0.7)", fill: "rgba(255, 0, 0, 0.7)",
stroke: "#ff0000", stroke: "#ff0000",
}); });
} }
} }
if (data.comments && data.comments.length > 0) { if (data.comments && data.comments.length > 0) {
for (var j = 0; j < data.comments.length; j++) { for (var j = 0; j < data.comments.length; j++) {
var $commentButton = $('.comment-like-btn[data-comment-id="' + data.comments[j] + '"]'); var $commentButton = $('.comment-like-btn[data-comment-id="' + data.comments[j] + '"]');
$commentButton.addClass("active"); $commentButton.addClass("active");
$commentButton.find("svg path").attr({ $commentButton.find("svg path").attr({
fill: "rgba(255, 0, 0, 0.7)", fill: "rgba(255, 0, 0, 0.7)",
stroke: "#ff0000", stroke: "#ff0000",
}); });
} }
} }
} catch (e) {} } catch (e) {}
}, },
error: function (error) {}, error: function (error) {},
}); });
} }
if (document.body.classList.contains("logged-in")) { if (document.body.classList.contains("logged-in")) {
checkLikedPosts(); checkLikedPosts();
} }
}); });

File diff suppressed because one or more lines are too long

@ -1,96 +1,96 @@
'use strict'; 'use strict';
let widthPhoneCabinet = 1200; let widthPhoneCabinet = 1200;
toggleOpenX('.cabinet-card__order', '.cabinet-card-order__open-detail', '.cabinet-card-order__detail', '.cabinet-card-order__block-detail'); toggleOpenX('.cabinet-card__order', '.cabinet-card-order__open-detail', '.cabinet-card-order__detail', '.cabinet-card-order__block-detail');
function toggleOpenX(mainElement, buttonElement ,heightElement, contentElement, close) { function toggleOpenX(mainElement, buttonElement ,heightElement, contentElement, close) {
let elements = document.querySelectorAll(mainElement); let elements = document.querySelectorAll(mainElement);
elements.forEach(e => { elements.forEach(e => {
let thisMainElement = e, let thisMainElement = e,
thisButtonElement = e.querySelector(buttonElement), thisButtonElement = e.querySelector(buttonElement),
thisHeightElement = e.querySelector(heightElement), thisHeightElement = e.querySelector(heightElement),
thisContentElement = e.querySelector(contentElement); thisContentElement = e.querySelector(contentElement);
if (thisButtonElement){ if (thisButtonElement){
thisButtonElement.onclick = function (e) { thisButtonElement.onclick = function (e) {
let height = thisHeightElement.clientHeight; let height = thisHeightElement.clientHeight;
if (close == true && !thisMainElement.classList.contains('active')) { if (close == true && !thisMainElement.classList.contains('active')) {
elements.forEach(e => { elements.forEach(e => {
if (e.classList.contains('active')) { if (e.classList.contains('active')) {
e.classList.remove('active'); e.classList.remove('active');
e.querySelector(contentElement).style.height = null e.querySelector(contentElement).style.height = null
} }
}) })
} }
if (!thisMainElement.classList.contains('active')) { if (!thisMainElement.classList.contains('active')) {
thisContentElement.style.height = `${height}px`; thisContentElement.style.height = `${height}px`;
thisMainElement.classList.add('active'); thisMainElement.classList.add('active');
}else{ }else{
thisContentElement.style.height = null; thisContentElement.style.height = null;
thisMainElement.classList.remove('active'); thisMainElement.classList.remove('active');
} }
} }
} }
}); });
} }
jQuery('.cabinet-card__button').on('click', function(){ jQuery('.cabinet-card__button').on('click', function(){
var id = jQuery(this).data('edit') var id = jQuery(this).data('edit')
jQuery(`#pet_edit_` + id).addClass('active') jQuery(`#pet_edit_` + id).addClass('active')
}) })
jQuery('.form-sub__btn').on('click', function(){ jQuery('.form-sub__btn').on('click', function(){
jQuery(`#subForm`).addClass('active') jQuery(`#subForm`).addClass('active')
}) })
jQuery('.user-edit-open').on('click', function(){ jQuery('.user-edit-open').on('click', function(){
jQuery(`#user_edit`).addClass('active') jQuery(`#user_edit`).addClass('active')
}) })
jQuery('.cabinet-card__block-add-pets').on('click', function(){ jQuery('.cabinet-card__block-add-pets').on('click', function(){
jQuery(`#pet_add_form`).addClass('active') jQuery(`#pet_add_form`).addClass('active')
}) })
jQuery(document).ready(function ($) { jQuery(document).ready(function ($) {
$('.subscription-address-form').on('submit', function (e) { $('.subscription-address-form').on('submit', function (e) {
e.preventDefault(); e.preventDefault();
var $form = $(this); var $form = $(this);
var $message = $form.find('.form-message'); var $message = $form.find('.form-message');
var subscriptionId = $form.data('subscription-id'); var subscriptionId = $form.data('subscription-id');
var address = $form.find('input[name="address"]').val(); var address = $form.find('input[name="address"]').val();
var comment = $form.find('textarea[name="comment"]').val(); var comment = $form.find('textarea[name="comment"]').val();
var nonce = $form.find('input[name="address_nonce"]').val(); var nonce = $form.find('input[name="address_nonce"]').val();
$message.hide().removeClass('success error').empty(); $message.hide().removeClass('success error').empty();
$.ajax({ $.ajax({
url: '/wp-admin/admin-ajax.php', // Defined in wp_localize_script url: '/wp-admin/admin-ajax.php', // Defined in wp_localize_script
type: 'POST', type: 'POST',
data: { data: {
action: 'update_subscription_address', action: 'update_subscription_address',
subscription_id: subscriptionId, subscription_id: subscriptionId,
address: address, address: address,
comment: comment, comment: comment,
address_nonce: nonce address_nonce: nonce
}, },
success: function (response) { success: function (response) {
if (response.success) { if (response.success) {
$message.addClass('success').text(response.data.message).show(); $message.addClass('success').text(response.data.message).show();
} else { } else {
$message.addClass('error').text(response.data.message).show(); $message.addClass('error').text(response.data.message).show();
} }
}, },
error: function () { error: function () {
} }
}); });
}); });
}); });

@ -1,193 +1,193 @@
<?php <?php
// namespace Cdek\UI; // namespace Cdek\UI;
// use Cdek\UI\Cdek\CdekApi; // use Cdek\UI\Cdek\CdekApi;
// use Cdek\UI\Cdek\Config; // use Cdek\UI\Cdek\Config;
// use Cdek\UI\Cdek\Helpers\WeightCalc; // use Cdek\UI\Cdek\Helpers\WeightCalc;
// use Cdek\UI\Cdek\MetaKeys; // use Cdek\UI\Cdek\MetaKeys;
// use Cdek\UI\Exception; // use Cdek\UI\Exception;
// use Cdek\UI\WC_Order_Item_Shipping; // use Cdek\UI\WC_Order_Item_Shipping;
// $api = new CdekApi(); // $api = new CdekApi();
$context = Timber::get_context(); $context = Timber::get_context();
$current_user = wp_get_current_user(); $current_user = wp_get_current_user();
$context['current_user'] = $current_user; $context['current_user'] = $current_user;
$context['first_name'] = $current_user->user_firstname; $context['first_name'] = $current_user->user_firstname;
$context['last_name'] = $current_user->user_lastname; $context['last_name'] = $current_user->user_lastname;
$context['email'] = $current_user->user_email; $context['email'] = $current_user->user_email;
$context['phone'] = get_user_meta($current_user->ID, 'billing_phone', true); $context['phone'] = get_user_meta($current_user->ID, 'billing_phone', true);
$context['tg_account'] = get_user_meta($current_user->ID, 'tg_account', true); $context['tg_account'] = get_user_meta($current_user->ID, 'tg_account', true);
// ACF поля для пользователя // ACF поля для пользователя
$context['activated'] = get_field('activated', 'user_' . get_current_user_id()); $context['activated'] = get_field('activated', 'user_' . get_current_user_id());
$context['uuid'] = get_field('uuid', 'user_' . get_current_user_id()); $context['uuid'] = get_field('uuid', 'user_' . get_current_user_id());
// Запрос для питомцев // Запрос для питомцев
$current_user_id = get_current_user_id(); $current_user_id = get_current_user_id();
if ($current_user_id) { if ($current_user_id) {
$args = [ $args = [
'post_type' => 'pets', 'post_type' => 'pets',
'meta_query' => [ 'meta_query' => [
[ [
'key' => 'user', 'key' => 'user',
'value' => $current_user_id, 'value' => $current_user_id,
'compare' => '=' 'compare' => '='
] ]
] ]
]; ];
$context['pets'] = Timber::get_posts($args); $context['pets'] = Timber::get_posts($args);
} }
// Заказы пользователя // Заказы пользователя
$context['customer_orders'] = wc_get_orders(['customer_id' => $current_user->ID]); $context['customer_orders'] = wc_get_orders(['customer_id' => $current_user->ID]);
// В page-profile.php, внутри цикла заказов // В page-profile.php, внутри цикла заказов
// foreach ($context['customer_orders'] as &$order) { // foreach ($context['customer_orders'] as &$order) {
// $meta_data = get_post_meta($order->get_id(), 'order_data', true); // $meta_data = get_post_meta($order->get_id(), 'order_data', true);
// if (isset($meta_data['office_code'])) { // if (isset($meta_data['office_code'])) {
// $office_data = json_decode($api->getOffices(['code' => $meta_data['office_code']])['body'], true); // $office_data = json_decode($api->getOffices(['code' => $meta_data['office_code']])['body'], true);
// $order->office_name = $office_data[0]['name'] ?? ''; // $order->office_name = $office_data[0]['name'] ?? '';
// } // }
// } // }
$context['bot_username'] = defined('BOT_USERNAME') ? BOT_USERNAME : ''; $context['bot_username'] = defined('BOT_USERNAME') ? BOT_USERNAME : '';
// Текущий пользователь // Текущий пользователь
$current_user_id = get_current_user_id(); $current_user_id = get_current_user_id();
$context['current_user_id'] = $current_user_id; $context['current_user_id'] = $current_user_id;
// Запрос для питомцев // Запрос для питомцев
// if ($current_user_id) { // if ($current_user_id) {
// $args = [ // $args = [
// 'post_type' => 'pets', // 'post_type' => 'pets',
// 'meta_query' => [ // 'meta_query' => [
// [ // [
// 'key' => 'user', // 'key' => 'user',
// 'value' => $current_user_id, // 'value' => $current_user_id,
// 'compare' => '=' // 'compare' => '='
// ] // ]
// ] // ]
// ]; // ];
// $pets = Timber::get_posts($args); // $pets = Timber::get_posts($args);
// // Обработка ACF-полей для каждого питомца // // Обработка ACF-полей для каждого питомца
// foreach ($pets as &$pet) { // foreach ($pets as &$pet) {
// // ACF-поля // // ACF-поля
// $pet->weight = get_field('weight', $pet->ID); // $pet->weight = get_field('weight', $pet->ID);
// $pet->old = get_field('old', $pet->ID); // $pet->old = get_field('old', $pet->ID);
// $pet->activity = get_field('activity', $pet->ID); // $pet->activity = get_field('activity', $pet->ID);
// // Перевод веса // // Перевод веса
// switch ($pet->weight) { // switch ($pet->weight) {
// case 'below_1_5': // case 'below_1_5':
// $pet->weight_text = __('from 0,5 kg to 1,5 kg', 'woodmart'); // $pet->weight_text = __('from 0,5 kg to 1,5 kg', 'woodmart');
// break; // break;
// case '1_5-3': // case '1_5-3':
// $pet->weight_text = __('from 1.5 to 3 kg', 'woodmart'); // $pet->weight_text = __('from 1.5 to 3 kg', 'woodmart');
// break; // break;
// case '3-5': // case '3-5':
// $pet->weight_text = __('from 3 to 5 kg', 'woodmart'); // $pet->weight_text = __('from 3 to 5 kg', 'woodmart');
// break; // break;
// case '5-8': // case '5-8':
// $pet->weight_text = __('from 5 to 8 kg', 'woodmart'); // $pet->weight_text = __('from 5 to 8 kg', 'woodmart');
// break; // break;
// case '8-11': // case '8-11':
// $pet->weight_text = __('from 8 to 11 kg', 'woodmart'); // $pet->weight_text = __('from 8 to 11 kg', 'woodmart');
// break; // break;
// case '11-15': // case '11-15':
// $pet->weight_text = __('from 11 to 15 kg', 'woodmart'); // $pet->weight_text = __('from 11 to 15 kg', 'woodmart');
// break; // break;
// case '15-20': // case '15-20':
// $pet->weight_text = __('from 15 to 20 kg', 'woodmart'); // $pet->weight_text = __('from 15 to 20 kg', 'woodmart');
// break; // break;
// case '20-25': // case '20-25':
// $pet->weight_text = __('from 20 to 25 kg', 'woodmart'); // $pet->weight_text = __('from 20 to 25 kg', 'woodmart');
// break; // break;
// case '25-35': // case '25-35':
// $pet->weight_text = __('from 25 to 35 kg', 'woodmart'); // $pet->weight_text = __('from 25 to 35 kg', 'woodmart');
// break; // break;
// case 'more_35': // case 'more_35':
// $pet->weight_text = __('More than 35 kg', 'woodmart'); // $pet->weight_text = __('More than 35 kg', 'woodmart');
// break; // break;
// default: // default:
// $pet->weight_text = ''; // $pet->weight_text = '';
// } // }
// // Перевод возраста // // Перевод возраста
// switch ($pet->old) { // switch ($pet->old) {
// case 'normal': // case 'normal':
// $pet->old_text = __('Adult (from 1 year to 7 years)', 'woodmart'); // $pet->old_text = __('Adult (from 1 year to 7 years)', 'woodmart');
// break; // break;
// case 'old': // case 'old':
// $pet->old_text = __('Elderly (from 7 to 12 years)', 'woodmart'); // $pet->old_text = __('Elderly (from 7 to 12 years)', 'woodmart');
// break; // break;
// case 'very_old': // case 'very_old':
// $pet->old_text = __('Aging (12 years and older)', 'woodmart'); // $pet->old_text = __('Aging (12 years and older)', 'woodmart');
// break; // break;
// case 'baby': // case 'baby':
// $pet->old_text = __('Baby (from 0 to 1 year)', 'woodmart'); // $pet->old_text = __('Baby (from 0 to 1 year)', 'woodmart');
// break; // break;
// default: // default:
// $pet->old_text = ''; // $pet->old_text = '';
// } // }
// // Перевод активности // // Перевод активности
// switch ($pet->activity) { // switch ($pet->activity) {
// case 'low': // case 'low':
// $pet->activity_text = __('Low', 'woodmart'); // $pet->activity_text = __('Low', 'woodmart');
// break; // break;
// case 'moderate': // case 'moderate':
// $pet->activity_text = __('Moderate', 'woodmart'); // $pet->activity_text = __('Moderate', 'woodmart');
// break; // break;
// case 'high': // case 'high':
// $pet->activity_text = __('High', 'woodmart'); // $pet->activity_text = __('High', 'woodmart');
// break; // break;
// default: // default:
// $pet->activity_text = ''; // $pet->activity_text = '';
// } // }
// } // }
// $context['pets'] = $pets; // $context['pets'] = $pets;
// } // }
// Месяцы для локализации // Месяцы для локализации
$context['months'] = [ $context['months'] = [
__('january', 'woodmart'), __('january', 'woodmart'),
__('february', 'woodmart'), __('february', 'woodmart'),
__('march', 'woodmart'), __('march', 'woodmart'),
__('april', 'woodmart'), __('april', 'woodmart'),
__('may', 'woodmart'), // Исправлено 'mail' на 'may' __('may', 'woodmart'), // Исправлено 'mail' на 'may'
__('june', 'woodmart'), __('june', 'woodmart'),
__('july', 'woodmart'), __('july', 'woodmart'),
__('august', 'woodmart'), __('august', 'woodmart'),
__('september', 'woodmart'), __('september', 'woodmart'),
__('october', 'woodmart'), __('october', 'woodmart'),
__('november', 'woodmart'), __('november', 'woodmart'),
__('december', 'woodmart'), __('december', 'woodmart'),
]; ];
if ($orders_pg){ if ($orders_pg){
Timber::render('profile/profile-orders.twig', $context); Timber::render('profile/profile-orders.twig', $context);
} }
else{ else{
Timber::render('profile/profile.twig', $context); Timber::render('profile/profile.twig', $context);
} }
?> ?>

@ -1,143 +1,143 @@
<?php <?php
if (!defined('ABSPATH')) { if (!defined('ABSPATH')) {
exit; exit;
} }
use Timber\Timber; use Timber\Timber;
add_filter('timber/twig/filters', function ($filters) { add_filter('timber/twig/filters', function ($filters) {
$filters['wp_get_attachment_image_src'] = [ $filters['wp_get_attachment_image_src'] = [
'callable' => function ($attachment_id, $size = 'thumbnail', $icon = false) { 'callable' => function ($attachment_id, $size = 'thumbnail', $icon = false) {
$image = wp_get_attachment_image_src($attachment_id, $size, $icon); $image = wp_get_attachment_image_src($attachment_id, $size, $icon);
return $image ? $image[0] : ''; // Return the URL or empty string return $image ? $image[0] : ''; // Return the URL or empty string
}, },
]; ];
return $filters; return $filters;
}); });
add_filter('timber/twig/functions', function ($functions) { add_filter('timber/twig/functions', function ($functions) {
$functions['wc_get_page_permalink'] = [ $functions['wc_get_page_permalink'] = [
'callable' => 'wc_get_page_permalink', 'callable' => 'wc_get_page_permalink',
]; ];
$functions['wc_get_endpoint_url'] = [ $functions['wc_get_endpoint_url'] = [
'callable' => 'wc_get_endpoint_url', 'callable' => 'wc_get_endpoint_url',
]; ];
$functions['is_wc_endpoint_url'] = [ $functions['is_wc_endpoint_url'] = [
'callable' => 'is_wc_endpoint_url', 'callable' => 'is_wc_endpoint_url',
]; ];
$functions['get_permalink'] = [ $functions['get_permalink'] = [
'callable' => 'get_permalink', 'callable' => 'get_permalink',
]; ];
$functions['get_the_ID'] = [ $functions['get_the_ID'] = [
'callable' => 'get_the_ID', 'callable' => 'get_the_ID',
]; ];
$functions['pll_e'] = [ $functions['pll_e'] = [
'callable' => 'pll_e', 'callable' => 'pll_e',
]; ];
return $functions; return $functions;
}); });
// Get subscription ID from URL (e.g., /my-account/view-subscription/7632/) // Get subscription ID from URL (e.g., /my-account/view-subscription/7632/)
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; $request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
if (preg_match('/view-subscription\/(\d+)/', $request_uri, $matches)) { if (preg_match('/view-subscription\/(\d+)/', $request_uri, $matches)) {
$subscription_id = absint($matches[1]); $subscription_id = absint($matches[1]);
} }
$subscription = $subscription_id ? wcs_get_subscription($subscription_id) : null; $subscription = $subscription_id ? wcs_get_subscription($subscription_id) : null;
if (!$subscription || !wcs_is_subscription($subscription) || $subscription->get_user_id() !== get_current_user_id()) { if (!$subscription || !wcs_is_subscription($subscription) || $subscription->get_user_id() !== get_current_user_id()) {
error_log('Invalid or inaccessible subscription ID: ' . $subscription_id); error_log('Invalid or inaccessible subscription ID: ' . $subscription_id);
$subscription = null; $subscription = null;
} else { } else {
error_log('Subscription ID: ' . $subscription->get_id() . ' | Status: ' . $subscription->get_status()); error_log('Subscription ID: ' . $subscription->get_id() . ' | Status: ' . $subscription->get_status());
$items = array_map(function ($item) { $items = array_map(function ($item) {
$product_id = $item->get_product_id(); $product_id = $item->get_product_id();
$variation_id = $item->get_variation_id(); $variation_id = $item->get_variation_id();
$wc_product = $product_id ? wc_get_product($variation_id ?: $product_id) : null; $wc_product = $product_id ? wc_get_product($variation_id ?: $product_id) : null;
$product_name = $wc_product ? $wc_product->get_name() : 'Unknown Product'; $product_name = $wc_product ? $wc_product->get_name() : 'Unknown Product';
$image_id = $wc_product ? $wc_product->get_image_id() : 0; $image_id = $wc_product ? $wc_product->get_image_id() : 0;
$status = $product_id ? get_post_status($product_id) : 'N/A'; $status = $product_id ? get_post_status($product_id) : 'N/A';
$permalink = $wc_product && $wc_product->is_visible() ? get_permalink($product_id) : ''; $permalink = $wc_product && $wc_product->is_visible() ? get_permalink($product_id) : '';
$variation_details = $variation_id ? wc_get_formatted_variation($wc_product, true) : ''; $variation_details = $variation_id ? wc_get_formatted_variation($wc_product, true) : '';
error_log('Item ID: ' . $item->get_id() . ' | Product ID: ' . $product_id . ' | Variation ID: ' . $variation_id . ' | Name: ' . $product_name . ' | Permalink: ' . $permalink . ' | Status: ' . $status); error_log('Item ID: ' . $item->get_id() . ' | Product ID: ' . $product_id . ' | Variation ID: ' . $variation_id . ' | Name: ' . $product_name . ' | Permalink: ' . $permalink . ' | Status: ' . $status);
return [ return [
'product' => [ 'product' => [
'id' => $product_id ?: 0, 'id' => $product_id ?: 0,
'name' => $product_name, 'name' => $product_name,
'image_id' => $image_id, 'image_id' => $image_id,
'variation_details' => $variation_details, 'variation_details' => $variation_details,
], ],
'quantity' => $item->get_quantity(), 'quantity' => $item->get_quantity(),
'total' => $item->get_total(), 'total' => $item->get_total(),
]; ];
}, $subscription->get_items()); }, $subscription->get_items());
$cancel_url = ''; $cancel_url = '';
if ($subscription->can_be_updated_to('cancelled')) { if ($subscription->can_be_updated_to('cancelled')) {
$cancel_url = add_query_arg( $cancel_url = add_query_arg(
[ [
'subscription_id' => $subscription->get_id(), 'subscription_id' => $subscription->get_id(),
'change_subscription_to' => 'cancelled', 'change_subscription_to' => 'cancelled',
'_wpnonce' => wp_create_nonce('wcs_switch_request'), '_wpnonce' => wp_create_nonce('wcs_switch_request'),
], ],
wc_get_endpoint_url('view-subscription', $subscription->get_id(), wc_get_page_permalink('myaccount')) wc_get_endpoint_url('view-subscription', $subscription->get_id(), wc_get_page_permalink('myaccount'))
); );
} }
$subscription_data = [ $subscription_data = [
'id' => $subscription->get_id(), 'id' => $subscription->get_id(),
'status' => $subscription->get_status(), 'status' => $subscription->get_status(),
'date_created' => $subscription->get_date_created(), 'date_created' => $subscription->get_date_created(),
'last_order_date' => $subscription->get_date('last_order_date_created'), 'last_order_date' => $subscription->get_date('last_order_date_created'),
'next_payment_date' => $subscription->get_date('next_payment'), 'next_payment_date' => $subscription->get_date('next_payment'),
'payment_method_title' => $subscription->get_payment_method_title(), 'payment_method_title' => $subscription->get_payment_method_title(),
'total' => $subscription->get_total(), 'total' => $subscription->get_total(),
'currency' => $subscription->get_currency(), 'currency' => $subscription->get_currency(),
'items' => $items, 'items' => $items,
'cancel_url' => $cancel_url, 'cancel_url' => $cancel_url,
'shipping_address' => $subscription->get_formatted_shipping_address(), 'shipping_address' => $subscription->get_formatted_shipping_address(),
'shipping_comment' => $subscription->get_customer_note(), 'shipping_comment' => $subscription->get_customer_note(),
]; ];
} }
// Timber context // Timber context
$context = Timber::context(); $context = Timber::context();
$current_user = wp_get_current_user(); $current_user = wp_get_current_user();
$context['current_user'] = $current_user; $context['current_user'] = $current_user;
$context['first_name'] = $current_user->user_firstname; $context['first_name'] = $current_user->user_firstname;
$context['last_name'] = $current_user->user_lastname; $context['last_name'] = $current_user->user_lastname;
$context['email'] = $current_user->user_email; $context['email'] = $current_user->user_email;
$context['phone'] = get_user_meta($current_user->ID, 'billing_phone', true); $context['phone'] = get_user_meta($current_user->ID, 'billing_phone', true);
$context['tg_account'] = get_user_meta($current_user->ID, 'tg_account', true); $context['tg_account'] = get_user_meta($current_user->ID, 'tg_account', true);
// ACF поля для пользователя // ACF поля для пользователя
$context['activated'] = get_field('activated', 'user_' . get_current_user_id()); $context['activated'] = get_field('activated', 'user_' . get_current_user_id());
$context['uuid'] = get_field('uuid', 'user_' . get_current_user_id()); $context['uuid'] = get_field('uuid', 'user_' . get_current_user_id());
// Запрос для питомцев // Запрос для питомцев
$current_user_id = get_current_user_id(); $current_user_id = get_current_user_id();
if ($current_user_id) { if ($current_user_id) {
$args = [ $args = [
'post_type' => 'pets', 'post_type' => 'pets',
'meta_query' => [ 'meta_query' => [
[ [
'key' => 'user', 'key' => 'user',
'value' => $current_user_id, 'value' => $current_user_id,
'compare' => '=' 'compare' => '='
] ]
] ]
]; ];
$context['pets'] = Timber::get_posts($args); $context['pets'] = Timber::get_posts($args);
} }
$context['bot_username'] = defined('BOT_USERNAME') ? BOT_USERNAME : ''; $context['bot_username'] = defined('BOT_USERNAME') ? BOT_USERNAME : '';
$context['subscription'] = $subscription_data; $context['subscription'] = $subscription_data;
// Debug: Log subscription data // Debug: Log subscription data
error_log('Subscription Data: ' . print_r($subscription_data, true)); error_log('Subscription Data: ' . print_r($subscription_data, true));
// Render the Twig template // Render the Twig template
Timber::render('profile/profile-subs-single.twig', $context); Timber::render('profile/profile-subs-single.twig', $context);
?> ?>

@ -1,107 +1,107 @@
<?php <?php
if (!defined('ABSPATH')) { if (!defined('ABSPATH')) {
exit; exit;
} }
add_filter('timber/twig/filters', function ($filters) { add_filter('timber/twig/filters', function ($filters) {
$filters['wp_get_attachment_image_src'] = [ $filters['wp_get_attachment_image_src'] = [
'callable' => function ($attachment_id, $size = 'thumbnail', $icon = false) { 'callable' => function ($attachment_id, $size = 'thumbnail', $icon = false) {
$image = wp_get_attachment_image_src($attachment_id, $size, $icon); $image = wp_get_attachment_image_src($attachment_id, $size, $icon);
return $image ? $image[0] : ''; // Return the URL or empty string return $image ? $image[0] : ''; // Return the URL or empty string
}, },
]; ];
return $filters; return $filters;
}); });
use Timber\Timber; use Timber\Timber;
$context = Timber::context(); $context = Timber::context();
if (!class_exists('WC_Subscriptions')) { if (!class_exists('WC_Subscriptions')) {
error_log('WooCommerce Subscriptions plugin is not active.'); error_log('WooCommerce Subscriptions plugin is not active.');
return; return;
} }
// Get the current user’s subscriptions // Get the current user’s subscriptions
$user_id = get_current_user_id(); $user_id = get_current_user_id();
$subscriptions = wcs_get_users_subscriptions($user_id); $subscriptions = wcs_get_users_subscriptions($user_id);
$subscription_data = []; $subscription_data = [];
foreach ($subscriptions as $subscription) { foreach ($subscriptions as $subscription) {
$view_url = $subscription->get_view_order_url(); $view_url = $subscription->get_view_order_url();
// Debug: Log the view_url to check its value // Debug: Log the view_url to check its value
error_log('Subscription ID: ' . $subscription->get_id() . ' | View URL: ' . $view_url); error_log('Subscription ID: ' . $subscription->get_id() . ' | View URL: ' . $view_url);
$subscription_data[] = [ $subscription_data[] = [
'id' => $subscription->get_id(), 'id' => $subscription->get_id(),
'date_created' => $subscription->get_date_created(), 'date_created' => $subscription->get_date_created(),
'total' => $subscription->get_total(), 'total' => $subscription->get_total(),
'currency' => $subscription->get_currency(), 'currency' => $subscription->get_currency(),
'billing_period' => $subscription->get_billing_period(), 'billing_period' => $subscription->get_billing_period(),
'next_payment_date' => $subscription->get_date('next_payment'), 'next_payment_date' => $subscription->get_date('next_payment'),
'view_url' => esc_url($view_url), // Ensure URL is escaped for safety 'view_url' => esc_url($view_url), // Ensure URL is escaped for safety
'items' => array_map(function ($item) { 'items' => array_map(function ($item) {
$product = $item->get_product(); $product = $item->get_product();
return [ return [
'product' => [ 'product' => [
'name' => $product->get_name(), 'name' => $product->get_name(),
'image_id' => $product->get_image_id(), 'image_id' => $product->get_image_id(),
], ],
]; ];
}, $subscription->get_items()), }, $subscription->get_items()),
]; ];
} }
$context['subscriptions'] = $subscription_data; $context['subscriptions'] = $subscription_data;
// Debug: Log the entire subscriptions array // Debug: Log the entire subscriptions array
error_log('Subscriptions Data: ' . print_r($subscription_data, true)); error_log('Subscriptions Data: ' . print_r($subscription_data, true));
// Render the Twig template // Render the Twig template
$current_user = wp_get_current_user(); $current_user = wp_get_current_user();
$context['current_user'] = $current_user; $context['current_user'] = $current_user;
$context['first_name'] = $current_user->user_firstname; $context['first_name'] = $current_user->user_firstname;
$context['last_name'] = $current_user->user_lastname; $context['last_name'] = $current_user->user_lastname;
$context['email'] = $current_user->user_email; $context['email'] = $current_user->user_email;
$context['phone'] = get_user_meta($current_user->ID, 'billing_phone', true); $context['phone'] = get_user_meta($current_user->ID, 'billing_phone', true);
$context['tg_account'] = get_user_meta($current_user->ID, 'tg_account', true); $context['tg_account'] = get_user_meta($current_user->ID, 'tg_account', true);
// ACF поля для пользователя // ACF поля для пользователя
$context['activated'] = get_field('activated', 'user_' . get_current_user_id()); $context['activated'] = get_field('activated', 'user_' . get_current_user_id());
$context['uuid'] = get_field('uuid', 'user_' . get_current_user_id()); $context['uuid'] = get_field('uuid', 'user_' . get_current_user_id());
$context['bot_username'] = defined('BOT_USERNAME') ? BOT_USERNAME : ''; $context['bot_username'] = defined('BOT_USERNAME') ? BOT_USERNAME : '';
// Запрос для питомцев // Запрос для питомцев
$current_user_id = get_current_user_id(); $current_user_id = get_current_user_id();
if ($current_user_id) { if ($current_user_id) {
$args = [ $args = [
'post_type' => 'pets', 'post_type' => 'pets',
'meta_query' => [ 'meta_query' => [
[ [
'key' => 'user', 'key' => 'user',
'value' => $current_user_id, 'value' => $current_user_id,
'compare' => '=' 'compare' => '='
] ]
] ]
]; ];
$context['pets'] = Timber::get_posts($args); $context['pets'] = Timber::get_posts($args);
} }
// Месяцы для локализации // Месяцы для локализации
$context['months'] = [ $context['months'] = [
__('january', 'woodmart'), __('january', 'woodmart'),
__('february', 'woodmart'), __('february', 'woodmart'),
__('march', 'woodmart'), __('march', 'woodmart'),
__('april', 'woodmart'), __('april', 'woodmart'),
__('may', 'woodmart'), __('may', 'woodmart'),
__('june', 'woodmart'), __('june', 'woodmart'),
__('july', 'woodmart'), __('july', 'woodmart'),
__('august', 'woodmart'), __('august', 'woodmart'),
__('september', 'woodmart'), __('september', 'woodmart'),
__('october', 'woodmart'), __('october', 'woodmart'),
__('november', 'woodmart'), __('november', 'woodmart'),
__('december', 'woodmart'), __('december', 'woodmart'),
]; ];
Timber::render('profile/profile-subs.twig', $context); Timber::render('profile/profile-subs.twig', $context);
?> ?>

@ -1,134 +1,271 @@
<?php <<<<<<< HEAD
<?php
// include_module('profile');
// include_module('profile');
// Сохранить значения полей
add_action('wp_ajax_edit_user', 'save_custom_user_profile_fields'); // Сохранить значения полей
add_action('wp_ajax_nopriv_edit_user', 'save_custom_user_profile_fields'); // add_action('wp_ajax_edit_user', 'save_custom_user_profile_fields');
add_action('wp_ajax_nopriv_edit_user', 'save_custom_user_profile_fields'); //
function save_custom_user_profile_fields() {
// Проверка прав пользователя function save_custom_user_profile_fields() {
wp_update_user( array( // Проверка прав пользователя
'ID' => get_current_user_id(), wp_update_user( array(
'first_name' => $_POST['name'], 'ID' => get_current_user_id(),
'last_name' => $_POST['l_name'], 'first_name' => $_POST['name'],
'last_name' => $_POST['l_name'],
) );
) );
$phone = update_user_meta( get_current_user_id(), 'billing_phone', $_POST['phone'] );
$phone = update_user_meta( get_current_user_id(), 'billing_phone', $_POST['phone'] );
}
}
function ajax_add_pet() {
$current_user = wp_get_current_user(); function ajax_add_pet() {
// Подготовка данных $current_user = wp_get_current_user();
$pet_name = $_POST['name']; // Подготовка данных
$old_type = $_POST['old_type']; $pet_name = $_POST['name'];
if ($old_type == 'ex'){ $old_type = $_POST['old_type'];
$old= $_POST['old']; if ($old_type == 'ex'){
} $old= $_POST['old'];
}
$weight= $_POST['weight'];
$activity = $_POST['activity']; $weight= $_POST['weight'];
$pet = $_POST['pet']; $activity = $_POST['activity'];
$breed = $_POST['breed']; $pet = $_POST['pet'];
$sex = $_POST['sex']; $breed = $_POST['breed'];
$user = $current_user->ID; $sex = $_POST['sex'];
$user = $current_user->ID;
$post_data = array(
'post_title' => $pet_name, $post_data = array(
'post_type' => 'pets', 'post_title' => $pet_name,
'post_status' => 'publish', 'post_type' => 'pets',
); 'post_status' => 'publish',
);
$post_id = wp_insert_post($post_data);
var_dump($post_id); $post_id = wp_insert_post($post_data);
if ($post_id) { var_dump($post_id);
// Добавление мета-полей if ($post_id) {
if ($old_type == 'ex'){ // Добавление мета-полей
if ($old_type == 'ex'){
update_field( 'old', $old, $post_id );
update_field( 'old', $old, $post_id );
}
else{ }
else{
update_field( 'day', $_POST['day'], $post_id );
update_field( 'month', $_POST['month'], $post_id ); update_field( 'day', $_POST['day'], $post_id );
update_field( 'year', $_POST['year'], $post_id ); update_field( 'month', $_POST['month'], $post_id );
} update_field( 'year', $_POST['year'], $post_id );
update_field( 'weight', $weight, $post_id ); }
update_field( 'breed', $breed, $post_id ); update_field( 'weight', $weight, $post_id );
update_field( 'sex', $sex, $post_id ); update_field( 'breed', $breed, $post_id );
update_field( 'type', $pet, $post_id ); update_field( 'sex', $sex, $post_id );
update_field( 'user', $user, $post_id ); update_field( 'type', $pet, $post_id );
update_field( 'activity', $activity, $post_id ); update_field( 'user', $user, $post_id );
if($_POST['sterilized']=='1' && $pet=='cat'){ update_field( 'activity', $activity, $post_id );
update_field( 'sterilized', true ); if($_POST['sterilized']=='1' && $pet=='cat'){
} update_field( 'sterilized', true );
else{ }
update_field( 'sterilized', false ); else{
} update_field( 'sterilized', false );
wp_send_json_success('Питомец успешно добавлен!'); }
} else { wp_send_json_success('Питомец успешно добавлен!');
wp_send_json_error('Ошибка при добавлении питомца.'); } else {
} wp_send_json_error('Ошибка при добавлении питомца.');
}
wp_die(); // Завершение работы
} wp_die(); // Завершение работы
add_action('wp_ajax_add_pet', 'ajax_add_pet'); }
add_action('wp_ajax_nopriv_add_pet', 'ajax_add_pet'); // Если нужно разрешить для незалогиненных пользователей add_action('wp_ajax_add_pet', 'ajax_add_pet');
add_action('wp_ajax_nopriv_add_pet', 'ajax_add_pet'); // Если нужно разрешить для незалогиненных пользователей
function ajax_edit_pet() {
$current_user = wp_get_current_user(); function ajax_edit_pet() {
// Подготовка данных $current_user = wp_get_current_user();
$pet_name = $_POST['name']; // Подготовка данных
$old_type = $_POST['old_type']; $pet_name = $_POST['name'];
if ($old_type == 'ex'){ $old_type = $_POST['old_type'];
$old= $_POST['old']; if ($old_type == 'ex'){
} $old= $_POST['old'];
else{ }
$old_acc = $_POST['day'] . ' ' . $_POST['month'] . ' ' . $_POST['year']; else{
} $old_acc = $_POST['day'] . ' ' . $_POST['month'] . ' ' . $_POST['year'];
$weight= $_POST['weight']; }
$activity = $_POST['activity']; $weight= $_POST['weight'];
$pet = $_POST['pet']; $activity = $_POST['activity'];
$breed = $_POST['breed']; $pet = $_POST['pet'];
$sex = $_POST['sex']; $breed = $_POST['breed'];
$user = $current_user->ID; $sex = $_POST['sex'];
$user = $current_user->ID;
$post_id = intval($_POST['pet_id']);
$post_id = intval($_POST['pet_id']);
if (get_field('user', $post_id) == $user) {
// Добавление мета-полей if (get_field('user', $post_id) == $user) {
if ($old_type == 'ex'){ // Добавление мета-полей
update_field( 'old', $old, $post_id ); if ($old_type == 'ex'){
} update_field( 'old', $old, $post_id );
else{ }
update_field( 'old', '', $post_id ); else{
update_field( 'day', $_POST['day'], $post_id ); update_field( 'old', '', $post_id );
update_field( 'month', $_POST['month'], $post_id ); update_field( 'day', $_POST['day'], $post_id );
update_field( 'year', $_POST['year'], $post_id ); update_field( 'month', $_POST['month'], $post_id );
} update_field( 'year', $_POST['year'], $post_id );
update_field( 'weight', $weight, $post_id ); }
update_field( 'breed', $breed, $post_id ); update_field( 'weight', $weight, $post_id );
update_field( 'sex', $sex, $post_id ); update_field( 'breed', $breed, $post_id );
update_field( 'type', $pet, $post_id ); update_field( 'sex', $sex, $post_id );
update_field( 'activity', $activity, $post_id ); update_field( 'type', $pet, $post_id );
if($_POST['sterilized']=='1' && $pet=='cat'){ update_field( 'activity', $activity, $post_id );
update_field( 'sterilized', true ); if($_POST['sterilized']=='1' && $pet=='cat'){
} update_field( 'sterilized', true );
else{ }
update_field( 'sterilized', false ); else{
} update_field( 'sterilized', false );
wp_send_json_success('Питомец успешно отредактирован!'); }
} else { wp_send_json_success('Питомец успешно отредактирован!');
wp_send_json_error('Ошибка при редактировании питомца.'); } else {
} wp_send_json_error('Ошибка при редактировании питомца.');
}
wp_die(); // Завершение работы
} wp_die(); // Завершение работы
add_action('wp_ajax_edit_pet', 'ajax_edit_pet'); }
add_action('wp_ajax_nopriv_edit_pet', 'ajax_edit_pet'); add_action('wp_ajax_edit_pet', 'ajax_edit_pet');
add_action('wp_ajax_nopriv_edit_pet', 'ajax_edit_pet');
=======
<?php
// include_module('profile');
// Сохранить значения полей
add_action('wp_ajax_edit_user', 'save_custom_user_profile_fields');
add_action('wp_ajax_nopriv_edit_user', 'save_custom_user_profile_fields'); //
function save_custom_user_profile_fields() {
// Проверка прав пользователя
wp_update_user( array(
'ID' => get_current_user_id(),
'first_name' => $_POST['name'],
'last_name' => $_POST['l_name'],
) );
$phone = update_user_meta( get_current_user_id(), 'billing_phone', $_POST['phone'] );
}
function ajax_add_pet() {
$current_user = wp_get_current_user();
// Подготовка данных
$pet_name = $_POST['name'];
$old_type = $_POST['old_type'];
if ($old_type == 'ex'){
$old= $_POST['old'];
}
$weight= $_POST['weight'];
$activity = $_POST['activity'];
$pet = $_POST['pet'];
$breed = $_POST['breed'];
$sex = $_POST['sex'];
$user = $current_user->ID;
$post_data = array(
'post_title' => $pet_name,
'post_type' => 'pets',
'post_status' => 'publish',
);
$post_id = wp_insert_post($post_data);
var_dump($post_id);
if ($post_id) {
// Добавление мета-полей
if ($old_type == 'ex'){
update_field( 'old', $old, $post_id );
}
else{
update_field( 'day', $_POST['day'], $post_id );
update_field( 'month', $_POST['month'], $post_id );
update_field( 'year', $_POST['year'], $post_id );
}
update_field( 'weight', $weight, $post_id );
update_field( 'breed', $breed, $post_id );
update_field( 'sex', $sex, $post_id );
update_field( 'type', $pet, $post_id );
update_field( 'user', $user, $post_id );
update_field( 'activity', $activity, $post_id );
if($_POST['sterilized']=='1' && $pet=='cat'){
update_field( 'sterilized', true );
}
else{
update_field( 'sterilized', false );
}
wp_send_json_success('Питомец успешно добавлен!');
} else {
wp_send_json_error('Ошибка при добавлении питомца.');
}
wp_die(); // Завершение работы
}
add_action('wp_ajax_add_pet', 'ajax_add_pet');
add_action('wp_ajax_nopriv_add_pet', 'ajax_add_pet'); // Если нужно разрешить для незалогиненных пользователей
function ajax_edit_pet() {
$current_user = wp_get_current_user();
// Подготовка данных
$pet_name = $_POST['name'];
$old_type = $_POST['old_type'];
if ($old_type == 'ex'){
$old= $_POST['old'];
}
else{
$old_acc = $_POST['day'] . ' ' . $_POST['month'] . ' ' . $_POST['year'];
}
$weight= $_POST['weight'];
$activity = $_POST['activity'];
$pet = $_POST['pet'];
$breed = $_POST['breed'];
$sex = $_POST['sex'];
$user = $current_user->ID;
$post_id = intval($_POST['pet_id']);
if (get_field('user', $post_id) == $user) {
// Добавление мета-полей
if ($old_type == 'ex'){
update_field( 'old', $old, $post_id );
}
else{
update_field( 'old', '', $post_id );
update_field( 'day', $_POST['day'], $post_id );
update_field( 'month', $_POST['month'], $post_id );
update_field( 'year', $_POST['year'], $post_id );
}
update_field( 'weight', $weight, $post_id );
update_field( 'breed', $breed, $post_id );
update_field( 'sex', $sex, $post_id );
update_field( 'type', $pet, $post_id );
update_field( 'activity', $activity, $post_id );
if($_POST['sterilized']=='1' && $pet=='cat'){
update_field( 'sterilized', true );
}
else{
update_field( 'sterilized', false );
}
wp_send_json_success('Питомец успешно отредактирован!');
} else {
wp_send_json_error('Ошибка при редактировании питомца.');
}
wp_die(); // Завершение работы
}
add_action('wp_ajax_edit_pet', 'ajax_edit_pet');
add_action('wp_ajax_nopriv_edit_pet', 'ajax_edit_pet');
>>>>>>> e7e74da0bdd7c9b1db3979f0d5db0d07fafdd903

@ -1,381 +1,381 @@
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
// Открытие/закрытие модалки // Открытие/закрытие модалки
// $(document).on('click', '.cart-contents, .continue-shopping, .modal__close', function(e) { // $(document).on('click', '.cart-contents, .continue-shopping, .modal__close', function(e) {
// e.preventDefault(); // e.preventDefault();
// $('#modal-basket').toggleClass('active'); // $('#modal-basket').toggleClass('active');
// }); // });
// Обновление количества через input // Обновление количества через input
$(document).on('change', '.counter__input', function() { $(document).on('change', '.counter__input', function() {
const key = $(this).data('key'); const key = $(this).data('key');
const quantity = $(this).val(); const quantity = $(this).val();
if (quantity > 0) { if (quantity > 0) {
updateCart(key, quantity); updateCart(key, quantity);
} else { } else {
removeItem(key); removeItem(key);
} }
}); });
// Увеличение количества // Увеличение количества
$(document).on('click', '.modal__basket .counter__button.plus', function(e) { $(document).on('click', '.modal__basket .counter__button.plus', function(e) {
e.preventDefault(); e.preventDefault();
const key = $(this).data('key'); const key = $(this).data('key');
const input = $(this).siblings('.counter__input'); const input = $(this).siblings('.counter__input');
const quantity = parseInt(input.val()) + 1; const quantity = parseInt(input.val()) + 1;
input.val(quantity).trigger('change'); input.val(quantity).trigger('change');
}); });
// Уменьшение количества // Уменьшение количества
$(document).on('click', '.modal__basket .counter__button.minus', function(e) { $(document).on('click', '.modal__basket .counter__button.minus', function(e) {
e.preventDefault(); e.preventDefault();
const key = $(this).data('key'); const key = $(this).data('key');
const input = $(this).siblings('.counter__input'); const input = $(this).siblings('.counter__input');
let quantity = parseInt(input.val()) - 1; let quantity = parseInt(input.val()) - 1;
if (quantity <= 0) { if (quantity <= 0) {
removeItem(key); // Вызываем удаление, если количество становится 0 removeItem(key); // Вызываем удаление, если количество становится 0
} else { } else {
input.val(quantity).trigger('change'); // Обновляем количество, если больше 0 input.val(quantity).trigger('change'); // Обновляем количество, если больше 0
} }
}); });
$(document).on('click', '.remove-item', function() { $(document).on('click', '.remove-item', function() {
const key = $(this).data('key'); const key = $(this).data('key');
removeItem(key); removeItem(key);
}); });
// Удаление товара // Удаление товара
function formatMoney(amount) { function formatMoney(amount) {
if (typeof woocommerce_params !== 'undefined' && woocommerce_params.currency_format) { if (typeof woocommerce_params !== 'undefined' && woocommerce_params.currency_format) {
const format = woocommerce_params.currency_format; const format = woocommerce_params.currency_format;
return format return format
.replace('%1$s', woocommerce_params.currency_symbol) .replace('%1$s', woocommerce_params.currency_symbol)
.replace('%2$s', parseFloat(amount).toFixed(2)); .replace('%2$s', parseFloat(amount).toFixed(2));
} }
return woocommerce_params.currency_symbol + parseFloat(amount).toFixed(2); return woocommerce_params.currency_symbol + parseFloat(amount).toFixed(2);
} }
// Хранилище временно удалённых товаров // Хранилище временно удалённых товаров
const removedItemsStorageKey = 'woocommerce_removed_items'; const removedItemsStorageKey = 'woocommerce_removed_items';
function restoreRemovedItems() { function restoreRemovedItems() {
const removedItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || []; const removedItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || [];
if (removedItems.length === 0) return; if (removedItems.length === 0) return;
$('#modal-basket').addClass('loading'); $('#modal-basket').addClass('loading');
// Создаем копию массива для работы // Создаем копию массива для работы
let itemsToRemove = [...removedItems]; let itemsToRemove = [...removedItems];
function processNextItem() { function processNextItem() {
if (itemsToRemove.length === 0) { if (itemsToRemove.length === 0) {
// Все элементы обработаны // Все элементы обработаны
localStorage.removeItem(removedItemsStorageKey); localStorage.removeItem(removedItemsStorageKey);
updateCartFragment(); updateCartFragment();
$('#modal-basket').removeClass('loading'); $('#modal-basket').removeClass('loading');
return; return;
} }
const element = itemsToRemove.shift(); // Берем первый элемент const element = itemsToRemove.shift(); // Берем первый элемент
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: woocommerce_params.ajax_url, url: woocommerce_params.ajax_url,
data: { data: {
action: 'remove_cart_item', action: 'remove_cart_item',
cart_item_key: element.key cart_item_key: element.key
}, },
success: function(response) { success: function(response) {
if (response.success) { if (response.success) {
// Обновляем localStorage, удаляя только что обработанный элемент // Обновляем localStorage, удаляя только что обработанный элемент
const currentItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || []; const currentItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || [];
const updatedItems = currentItems.filter(item => item.key !== element.key); const updatedItems = currentItems.filter(item => item.key !== element.key);
localStorage.setItem(removedItemsStorageKey, JSON.stringify(updatedItems)); localStorage.setItem(removedItemsStorageKey, JSON.stringify(updatedItems));
} }
// Обрабатываем следующий элемент // Обрабатываем следующий элемент
processNextItem(); processNextItem();
}, },
error: function() { error: function() {
// Продолжаем даже при ошибке // Продолжаем даже при ошибке
processNextItem(); processNextItem();
} }
}); });
} }
// Начинаем обработку // Начинаем обработку
processNextItem(); processNextItem();
} }
// Инициализация при загрузке // Инициализация при загрузке
restoreRemovedItems(); restoreRemovedItems();
// Функция удаления товара с возможностью восстановления // Функция удаления товара с возможностью восстановления
function removeItem(key) { function removeItem(key) {
const $item = $(`[data-key="${key}"]`); const $item = $(`[data-key="${key}"]`);
const productId = $item.data('product_id'); const productId = $item.data('product_id');
const variationId = $item.data('variation_id') || 0; const variationId = $item.data('variation_id') || 0;
const quantity = parseInt($item.find('.counter__input').val()); const quantity = parseInt($item.find('.counter__input').val());
// Сохраняем во временное хранилище // Сохраняем во временное хранилище
const removedItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || []; const removedItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || [];
removedItems.push({ product_id: productId, variation_id: variationId, quantity: quantity, key: key }); removedItems.push({ product_id: productId, variation_id: variationId, quantity: quantity, key: key });
localStorage.setItem(removedItemsStorageKey, JSON.stringify(removedItems)); localStorage.setItem(removedItemsStorageKey, JSON.stringify(removedItems));
// Показываем кнопку восстановления // Показываем кнопку восстановления
$item.html(` $item.html(`
<p class="modal-basket-item__title"> <p class="modal-basket-item__title">
Removing an item from the cart: <span id="${key}_timer" class="timer_counter">5</span>с Removing an item from the cart: <span id="${key}_timer" class="timer_counter">5</span>с
</p> </p>
<div class="modal-basket-item__return-wrapper"> <div class="modal-basket-item__return-wrapper">
<button class="modal-basket-item__return" data-key="${key}"> <button class="modal-basket-item__return" data-key="${key}">
${woocommerce_params.i18n_restore_item || 'Restore'} ${woocommerce_params.i18n_restore_item || 'Restore'}
</button> </button>
</div> </div>
`); `);
// Проверяем количество товаров в корзине // Проверяем количество товаров в корзине
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: woocommerce_params.ajax_url, url: woocommerce_params.ajax_url,
data: { data: {
action: 'check_cart_count' action: 'check_cart_count'
}, },
success: function(response) { success: function(response) {
if (response.success && response.data.count <= 1) { if (response.success && response.data.count <= 1) {
// Если после удаления корзина станет пустой (1 товар сейчас, удаляем его) // Если после удаления корзина станет пустой (1 товар сейчас, удаляем его)
$('.proceed-to-checkout').css('display', 'none'); $('.proceed-to-checkout').css('display', 'none');
} }
} }
}); });
// Удаляем через 5 секунд, если не восстановили // Удаляем через 5 секунд, если не восстановили
const removeTimeout = setTimeout(() => { const removeTimeout = setTimeout(() => {
permanentRemoveItem(key, productId, variationId); permanentRemoveItem(key, productId, variationId);
}, 5000); }, 5000);
const product_remove_timer = setInterval(() => { const product_remove_timer = setInterval(() => {
let number = Number($(`#${key}_timer`).html()) - 1; let number = Number($(`#${key}_timer`).html()) - 1;
$(`#${key}_timer`).html(number); $(`#${key}_timer`).html(number);
}, 1000); }, 1000);
// Обработчик восстановления // Обработчик восстановления
$(document).off('click', `[data-key="${key}"] .modal-basket-item__return`).on('click', `[data-key="${key}"] .modal-basket-item__return`, function(e) { $(document).off('click', `[data-key="${key}"] .modal-basket-item__return`).on('click', `[data-key="${key}"] .modal-basket-item__return`, function(e) {
e.preventDefault(); e.preventDefault();
clearTimeout(removeTimeout); clearTimeout(removeTimeout);
clearInterval(product_remove_timer); // Очищаем интервал clearInterval(product_remove_timer); // Очищаем интервал
restoreItem(key, productId, variationId, quantity); restoreItem(key, productId, variationId, quantity);
}); });
} }
// Полное удаление товара // Полное удаление товара
function permanentRemoveItem(key, productId, variationId) { function permanentRemoveItem(key, productId, variationId) {
$('#modal-basket').addClass('loading'); $('#modal-basket').addClass('loading');
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: woocommerce_params.ajax_url, url: woocommerce_params.ajax_url,
data: { data: {
action: 'remove_cart_item', action: 'remove_cart_item',
cart_item_key: key cart_item_key: key
}, },
complete: function() { complete: function() {
$('#modal-basket').removeClass('loading'); $('#modal-basket').removeClass('loading');
}, },
success: function(response) { success: function(response) {
if (response.success) { if (response.success) {
// Удаляем из временного хранилища // Удаляем из временного хранилища
const removedItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || []; const removedItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || [];
const updatedItems = removedItems.filter(item => const updatedItems = removedItems.filter(item =>
!(item.product_id === productId && item.variation_id === variationId) !(item.product_id === productId && item.variation_id === variationId)
); );
localStorage.setItem(removedItemsStorageKey, JSON.stringify(updatedItems)); localStorage.setItem(removedItemsStorageKey, JSON.stringify(updatedItems));
updateCartFragment(); updateCartFragment();
} }
} }
}); });
} }
// Восстановление товара // Восстановление товара
function restoreItem(key, productId, variationId, quantity) { function restoreItem(key, productId, variationId, quantity) {
$('#modal-basket').addClass('loading'); $('#modal-basket').addClass('loading');
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: woocommerce_params.ajax_url, url: woocommerce_params.ajax_url,
data: { data: {
action: 'restore_cart_item', action: 'restore_cart_item',
product_id: productId, product_id: productId,
variation_id: variationId, variation_id: variationId,
quantity: quantity quantity: quantity
}, },
complete: function() { complete: function() {
$('#modal-basket').removeClass('loading'); $('#modal-basket').removeClass('loading');
}, },
success: function(response) { success: function(response) {
if (response.success) { if (response.success) {
// Удаляем из временного хранилища // Удаляем из временного хранилища
const removedItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || []; const removedItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || [];
const updatedItems = removedItems.filter(item => const updatedItems = removedItems.filter(item =>
!(item.product_id === productId && item.variation_id === variationId) !(item.product_id === productId && item.variation_id === variationId)
); );
localStorage.setItem(removedItemsStorageKey, JSON.stringify(updatedItems)); localStorage.setItem(removedItemsStorageKey, JSON.stringify(updatedItems));
// Показываем кнопку Proceed to checkout // Показываем кнопку Proceed to checkout
$('.proceed-to-checkout').css('display', ''); $('.proceed-to-checkout').css('display', '');
updateCartFragment(); updateCartFragment();
} }
} }
}); });
} }
// --- Работа с cookie --- // --- Работа с cookie ---
function setCookie(name, value, days) { function setCookie(name, value, days) {
let expires = ''; let expires = '';
if (days) { if (days) {
const date = new Date(); const date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = '; expires=' + date.toUTCString(); expires = '; expires=' + date.toUTCString();
} }
document.cookie = name + '=' + (value || '') + expires + '; path=/'; document.cookie = name + '=' + (value || '') + expires + '; path=/';
} }
function getCookie(name) { function getCookie(name) {
const nameEQ = name + '='; const nameEQ = name + '=';
const ca = document.cookie.split(';'); const ca = document.cookie.split(';');
for(let i=0;i < ca.length;i++) { for(let i=0;i < ca.length;i++) {
let c = ca[i]; let c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length); while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
} }
return null; return null;
} }
// --- Конец работы с cookie --- // --- Конец работы с cookie ---
// Открытие корзины при первом добавлении товара // Открытие корзины при первом добавлении товара
function openBasketOnFirstAdd() { function openBasketOnFirstAdd() {
if (!getCookie('basket_popup_shown')) { if (!getCookie('basket_popup_shown')) {
console.log('[openBasketOnFirstAdd] Срабатывает открытие корзины'); console.log('[openBasketOnFirstAdd] Срабатывает открытие корзины');
// Выбираем только модалку, в которой находится корзина // Выбираем только модалку, в которой находится корзина
var $basket = $('#modal-basket'); var $basket = $('#modal-basket');
var $modal = $basket.closest('.modal'); var $modal = $basket.closest('.modal');
var $aside = $modal.find('.modal__aside'); var $aside = $modal.find('.modal__aside');
var device = window.screen.width; var device = window.screen.width;
// Сброс только внутри этой модалки // Сброс только внутри этой модалки
var $items = $modal.find('.modal__item'); var $items = $modal.find('.modal__item');
console.log('[openBasketOnFirstAdd] modal:', $modal.get(), 'modal__item:', $items.get()); console.log('[openBasketOnFirstAdd] modal:', $modal.get(), 'modal__item:', $items.get());
$items.removeClass('active').attr('style', ''); $items.removeClass('active').attr('style', '');
$modal.addClass('active').show(); $modal.addClass('active').show();
$basket.addClass('active').css({opacity: 1, filter: 'blur(0px)'}); $basket.addClass('active').css({opacity: 1, filter: 'blur(0px)'});
console.log('[openBasketOnFirstAdd] basket:', $basket.get()); console.log('[openBasketOnFirstAdd] basket:', $basket.get());
var width = $basket[0] ? $basket[0].clientWidth : 600; var width = $basket[0] ? $basket[0].clientWidth : 600;
setTimeout(function() { setTimeout(function() {
if (device <= 720) { if (device <= 720) {
$aside.css('width', device + 'px'); $aside.css('width', device + 'px');
console.log('[openBasketOnFirstAdd] aside width:', device + 'px'); console.log('[openBasketOnFirstAdd] aside width:', device + 'px');
} else { } else {
$aside.css('width', width + 'px'); $aside.css('width', width + 'px');
console.log('[openBasketOnFirstAdd] aside width:', width + 'px'); console.log('[openBasketOnFirstAdd] aside width:', width + 'px');
} }
}, 10); }, 10);
setCookie('basket_popup_shown', '1', 30); setCookie('basket_popup_shown', '1', 30);
} else { } else {
console.log('[openBasketOnFirstAdd] Куки уже установлены, попап не открывается'); console.log('[openBasketOnFirstAdd] Куки уже установлены, попап не открывается');
} }
} }
// Обновление корзины при добавлении товара // Обновление корзины при добавлении товара
$(document.body).on('added_to_cart', function() { $(document.body).on('added_to_cart', function() {
updateCartFragment(); updateCartFragment();
openBasketOnFirstAdd(); openBasketOnFirstAdd();
}); });
// Функция обновления количества // Функция обновления количества
function updateCart(key, quantity) { function updateCart(key, quantity) {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '/wp-admin/admin-ajax.php', // Используем стандартный параметр WooCommerce url: '/wp-admin/admin-ajax.php', // Используем стандартный параметр WooCommerce
data: { data: {
action: 'update_cart_quantity', action: 'update_cart_quantity',
cart_item_key: key, cart_item_key: key,
quantity: quantity quantity: quantity
}, },
beforeSend: function() { beforeSend: function() {
$('#modal-basket').addClass('loading'); $('#modal-basket').addClass('loading');
}, },
complete: function() { complete: function() {
$('#modal-basket').removeClass('loading'); $('#modal-basket').removeClass('loading');
}, },
success: function(response) { success: function(response) {
if (response.success) { if (response.success) {
updateCartFragment(); updateCartFragment();
} else { } else {
console.error('Ошибка при обновлении корзины'); console.error('Ошибка при обновлении корзины');
} }
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error('AJAX ошибка:', error); console.error('AJAX ошибка:', error);
} }
}); });
} }
// Обновление фрагментов корзины // Обновление фрагментов корзины
function updateCartFragment() { function updateCartFragment() {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: woocommerce_params.ajax_url, url: woocommerce_params.ajax_url,
data: { data: {
action: 'get_cart_fragment' action: 'get_cart_fragment'
}, },
beforeSend: function() { beforeSend: function() {
$('#modal-basket').addClass('loading'); $('#modal-basket').addClass('loading');
}, },
complete: function() { complete: function() {
$('#modal-basket').removeClass('loading'); $('#modal-basket').removeClass('loading');
}, },
success: function(response) { success: function(response) {
console.log(response); console.log(response);
if (response.success) { if (response.success) {
$('#modal-basket-content').html(response.data.contents); $('#modal-basket-content').html(response.data.contents);
$('.modal-block-price__price').html(response.data.total); $('.modal-block-price__price').html(response.data.total);
$('.mini-profile__button--counter').text(response.data.count); $('.mini-profile__button--counter').text(response.data.count);
if (response.data.count > 0) { if (response.data.count > 0) {
$('.mini-profile__button--counter').removeClass('disabled'); $('.mini-profile__button--counter').removeClass('disabled');
$('.proceed-to-checkout').css('display', ''); // Показываем кнопку, если есть товары $('.proceed-to-checkout').css('display', ''); // Показываем кнопку, если есть товары
} else { } else {
$('.mini-profile__button--counter').addClass('disabled'); $('.mini-profile__button--counter').addClass('disabled');
$('.proceed-to-checkout').css('display', 'none'); // Скрываем кнопку, если корзина пуста $('.proceed-to-checkout').css('display', 'none'); // Скрываем кнопку, если корзина пуста
} }
} }
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error('AJAX error:', error); console.error('AJAX error:', error);
} }
}); });
} }
// Добавляем спиннер на кнопку 'Добавить в корзину' в корзине // Добавляем спиннер на кнопку 'Добавить в корзину' в корзине
$('body').on('click', '.add_to_cart_button', function() { $('body').on('click', '.add_to_cart_button', function() {
var btn = $(this); var btn = $(this);
if (!btn.hasClass('loading')) { if (!btn.hasClass('loading')) {
btn.addClass('loading'); btn.addClass('loading');
btn.data('original-text', btn.html()); btn.data('original-text', btn.html());
btn.css('position', 'relative'); btn.css('position', 'relative');
btn.html('<span class="spinner" style="width:20px;height:20px;display:inline-block;"><svg width="20" height="20" viewBox="0 0 50 50"><circle cx="25" cy="25" r="20" fill="none" stroke="#ffffff" stroke-width="5" stroke-linecap="round" stroke-dasharray="31.415, 31.415" transform="rotate(72.3246 25 25)"><animateTransform attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.7s" repeatCount="indefinite"/></circle></svg></span>'); btn.html('<span class="spinner" style="width:20px;height:20px;display:inline-block;"><svg width="20" height="20" viewBox="0 0 50 50"><circle cx="25" cy="25" r="20" fill="none" stroke="#ffffff" stroke-width="5" stroke-linecap="round" stroke-dasharray="31.415, 31.415" transform="rotate(72.3246 25 25)"><animateTransform attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.7s" repeatCount="indefinite"/></circle></svg></span>');
} }
}); });
// Убираем спиннер после завершения ajax WooCommerce // Убираем спиннер после завершения ajax WooCommerce
$(document.body).on('added_to_cart', function(e, fragments, cart_hash, $button) { $(document.body).on('added_to_cart', function(e, fragments, cart_hash, $button) {
if ($button && $button.length) { if ($button && $button.length) {
$button.removeClass('loading'); $button.removeClass('loading');
if ($button.data('original-text')) { if ($button.data('original-text')) {
$button.html($button.data('original-text')); $button.html($button.data('original-text'));
$button.removeData('original-text'); $button.removeData('original-text');
} }
} }
}); });
}); });

@ -1,13 +1,13 @@
<?php <?php
// add_filter('woocommerce_get_script_data', 'add_custom_woocommerce_params', 10, 2); // add_filter('woocommerce_get_script_data', 'add_custom_woocommerce_params', 10, 2);
// function add_custom_woocommerce_params($params, $handle) { // function add_custom_woocommerce_params($params, $handle) {
// // Добавляем только для скрипта корзины // // Добавляем только для скрипта корзины
// $params['i18n_restore_item'] = pll__('Восстановить'); // $params['i18n_restore_item'] = pll__('Восстановить');
// return $params; // return $params;
// } // }
add_filter('timber/context', function($context) { add_filter('timber/context', function($context) {
$context['cart_count'] = WC()->cart->get_cart_contents_count(); $context['cart_count'] = WC()->cart->get_cart_contents_count();
return $context; return $context;
}); });

@ -1,332 +1,332 @@
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
jQuery(document.body).on('updated_checkout', function() { jQuery(document.body).on('updated_checkout', function() {
// Найти новые методы доставки внутри shop_table // Найти новые методы доставки внутри shop_table
var shippingMethodsHtml = jQuery('.woocommerce-checkout-review-order-table .woocommerce-shipping-methods').html(); var shippingMethodsHtml = jQuery('.woocommerce-checkout-review-order-table .woocommerce-shipping-methods').html();
// Обновить кастомный блок // Обновить кастомный блок
if(!shippingMethodsHtml){ if(!shippingMethodsHtml){
shippingMethodsHtml ='<p>Не удалось получить доступные методы доставки! <br>Укажите свой город для получения доступных методов.</p>' shippingMethodsHtml ='<p>Не удалось получить доступные методы доставки! <br>Укажите свой город для получения доступных методов.</p>'
} }
jQuery('#custom-shipping-methods').html(shippingMethodsHtml); jQuery('#custom-shipping-methods').html(shippingMethodsHtml);
jQuery('.order-contacts__delivery').removeClass('loading'); jQuery('.order-contacts__delivery').removeClass('loading');
jQuery('.modal-map-control__item.active').click() jQuery('.modal-map-control__item.active').click()
}); });
$(document.body).on('update_checkout', function() { $(document.body).on('update_checkout', function() {
jQuery('.order-contacts__delivery').addClass('loading'); jQuery('.order-contacts__delivery').addClass('loading');
}); });
$('body').on('click', '.modal-map-control__item', function(){ $('body').on('click', '.modal-map-control__item', function(){
if (!$(this).hasClass('active')){ if (!$(this).hasClass('active')){
$('#addr_inp').val('') $('#addr_inp').val('')
$('#pvz_inp').val('') $('#pvz_inp').val('')
$('#billing_address_1').val('') $('#billing_address_1').val('')
$('#billing_address_2').val('') $('#billing_address_2').val('')
} }
$('.shipping-add-info').removeClass('active') $('.shipping-add-info').removeClass('active')
var remote = $(this).data('remote') var remote = $(this).data('remote')
$('.shipping-add-info[data-remote="' + remote + '"]').addClass('active') $('.shipping-add-info[data-remote="' + remote + '"]').addClass('active')
}) })
jQuery('#addr_inp').on('click', function(){ jQuery('#addr_inp').on('click', function(){
jQuery('#address_input').addClass('active') jQuery('#address_input').addClass('active')
}) })
}); });
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
// Перехват отправки формы купона // Перехват отправки формы купона
$(document).on('click', 'button[name="apply_coupon"]', function(e) { $(document).on('click', 'button[name="apply_coupon"]', function(e) {
e.preventDefault(); // Останавливаем отправку основной формы e.preventDefault(); // Останавливаем отправку основной формы
// Отправка данных купона через AJAX // Отправка данных купона через AJAX
var couponCode = $('#coupon_code').val(); var couponCode = $('#coupon_code').val();
if (!couponCode) { if (!couponCode) {
alert('Пожалуйста, введите код купона.'); alert('Пожалуйста, введите код купона.');
return; return;
} }
$.ajax({ $.ajax({
url: wc_checkout_params.ajax_url, // URL для AJAX-запроса WooCommerce url: wc_checkout_params.ajax_url, // URL для AJAX-запроса WooCommerce
type: 'POST', type: 'POST',
data: { data: {
action: 'apply_coupon', action: 'apply_coupon',
coupon_code: couponCode coupon_code: couponCode
}, },
success: function(response) { success: function(response) {
if (response.success) { if (response.success) {
$(document.body).trigger('update_checkout'); $(document.body).trigger('update_checkout');
$('#promo_form').hide() $('#promo_form').hide()
$('#promo_delete').show() $('#promo_delete').show()
$('#promo_err').hide() $('#promo_err').hide()
$('#coupon_code_app').val('Применен промокод: ' + couponCode) $('#coupon_code_app').val('Применен промокод: ' + couponCode)
$('#delete_coupon').data('coupon', couponCode) $('#delete_coupon').data('coupon', couponCode)
} else { } else {
$('#promo_err').show() $('#promo_err').show()
} }
}, },
error: function() { error: function() {
alert('Произошла ошибка. Попробуйте ещё раз.'); alert('Произошла ошибка. Попробуйте ещё раз.');
} }
}); });
}); });
jQuery('#pvz_inp').on('click', function(){ jQuery('#pvz_inp').on('click', function(){
jQuery('.open-pvz-btn').click() jQuery('.open-pvz-btn').click()
}) })
$('#address_input input').on('change, input, keyup', function(){ $('#address_input input').on('change, input, keyup', function(){
var address = $('#f_address').val() var address = $('#f_address').val()
var apart = $('#f_apartment').val() var apart = $('#f_apartment').val()
var floor = $('#f_floor').val() var floor = $('#f_floor').val()
var entrance = $('#f_entrance').val() var entrance = $('#f_entrance').val()
var number_phone = $('#f_number-phone').val() var number_phone = $('#f_number-phone').val()
var address_2 = '' var address_2 = ''
if (apart){ if (apart){
address_2 += ' кв ' + apart address_2 += ' кв ' + apart
} }
if (floor){ if (floor){
address_2 += ' этаж ' + floor address_2 += ' этаж ' + floor
} }
if (entrance){ if (entrance){
address_2 += ' подъезд ' + entrance address_2 += ' подъезд ' + entrance
} }
if (number_phone){ if (number_phone){
address_2 += ' домофон ' + number_phone address_2 += ' домофон ' + number_phone
} }
$('#addr_inp').val(address + address_2) $('#addr_inp').val(address + address_2)
$('#billing_address_1').val(address) $('#billing_address_1').val(address)
$('#billing_address_2').val(address_2) $('#billing_address_2').val(address_2)
}) })
}); });
jQuery(document).ready(function ($) { jQuery(document).ready(function ($) {
$(document.body).on('checkout_error', function () { $(document.body).on('checkout_error', function () {
// $('.woocommerce-error').remove(); // $('.woocommerce-error').remove();
$('.form-input__error').removeClass('active'); $('.form-input__error').removeClass('active');
// // Добавляем ошибки рядом с полями // // Добавляем ошибки рядом с полями
$('.woocommerce-error li').each(function () { $('.woocommerce-error li').each(function () {
var errorMessage = $(this).text().trim(); var errorMessage = $(this).text().trim();
var fieldKey = $(this).data('id'); // Предполагается, что ошибка содержит data-id var fieldKey = $(this).data('id'); // Предполагается, что ошибка содержит data-id
console.log(errorMessage) console.log(errorMessage)
console.log(fieldKey) console.log(fieldKey)
if (fieldKey) { if (fieldKey) {
var errorContainer = $('#' + fieldKey + '-error'); var errorContainer = $('#' + fieldKey + '-error');
if (errorContainer.length) { if (errorContainer.length) {
errorContainer.html('<span class="error-message">' + errorMessage + '</span>'); errorContainer.html('<span class="error-message">' + errorMessage + '</span>');
$('#' + fieldKey + '-error').addClass('active'); $('#' + fieldKey + '-error').addClass('active');
} }
} }
if (errorMessage == 'phone_err' || errorMessage == 'The string supplied did not seem to be a phone number.' || errorMessage.includes('Некорректный номер телефона')){ if (errorMessage == 'phone_err' || errorMessage == 'The string supplied did not seem to be a phone number.' || errorMessage.includes('Некорректный номер телефона')){
$('#billing_phone-error').html('Неправильно введен номер') $('#billing_phone-error').html('Неправильно введен номер')
$('#billing_phone-error').addClass('active'); $('#billing_phone-error').addClass('active');
} }
if (errorMessage == 'Order pickup point not selected.' || errorMessage == 'Не выбран ПВЗ для доставки заказа.'){ if (errorMessage == 'Order pickup point not selected.' || errorMessage == 'Не выбран ПВЗ для доставки заказа.'){
$('#pvz-error').html('Не выбран ПВЗ для доставки заказа.') $('#pvz-error').html('Не выбран ПВЗ для доставки заказа.')
$('#pvz-error').addClass('active'); $('#pvz-error').addClass('active');
} }
if (errorMessage == 'adress_error'){ if (errorMessage == 'adress_error'){
$('#adr-error').html('Не указан адрес доставки') $('#adr-error').html('Не указан адрес доставки')
$('#adr-error').addClass('active'); $('#adr-error').addClass('active');
} }
if (errorMessage == 'Неверный адрес эл. почты для выставления счета'){ if (errorMessage == 'Неверный адрес эл. почты для выставления счета'){
$('#billing_email-error').html(errorMessage).addClass('active'); $('#billing_email-error').html(errorMessage).addClass('active');
} }
if(errorMessage == 'Не выбран метод доставки. Пожалуйста перепроверьте ваш адрес или обратитесь за помощью к администрации сайта.'){ if(errorMessage == 'Не выбран метод доставки. Пожалуйста перепроверьте ваш адрес или обратитесь за помощью к администрации сайта.'){
$('#billing_city-error').html(errorMessage).addClass('active'); $('#billing_city-error').html(errorMessage).addClass('active');
} }
if(errorMessage == 'Этот email уже зарегистрирован.'){ if(errorMessage == 'Этот email уже зарегистрирован.'){
$('#acc-error').html('Этот email уже зарегистрирован. Войдите в свой аккаунт или укажите другой E-mail.').addClass('active'); $('#acc-error').html('Этот email уже зарегистрирован. Войдите в свой аккаунт или укажите другой E-mail.').addClass('active');
} }
}); });
}); });
$('#delete_coupon').on('click', function(){ $('#delete_coupon').on('click', function(){
$('.woocommerce-remove-coupon[data-coupon=' + $(this).data('coupon') + ']').click() $('.woocommerce-remove-coupon[data-coupon=' + $(this).data('coupon') + ']').click()
}) })
$('.woocommerce-remove-coupon').on('click', function(){ $('.woocommerce-remove-coupon').on('click', function(){
$('#promo_form').show() $('#promo_form').show()
$('#promo_delete').hide() $('#promo_delete').hide()
}) })
}); });
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
// Функция для получения активных фильтров из URL // Функция для получения активных фильтров из URL
function getActiveFilters() { function getActiveFilters() {
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search);
const filters = []; const filters = [];
params.forEach((value, key) => { params.forEach((value, key) => {
if (key.startsWith('filter_') || key === 'min_price' || key === 'max_price') { if (key.startsWith('filter_') || key === 'min_price' || key === 'max_price') {
let filterName = key.replace('filter_', '').replace('_', ' '); let filterName = key.replace('filter_', '').replace('_', ' ');
let filterValue = value.split(',').map(val => decodeURIComponent(val.replace(/\+/g, ' '))); let filterValue = value.split(',').map(val => decodeURIComponent(val.replace(/\+/g, ' ')));
if (key === 'min_price') { if (key === 'min_price') {
filterName = 'Цена от'; filterName = 'Цена от';
filterValue = [value + ' ₽']; filterValue = [value + ' ₽'];
} else if (key === 'max_price') { } else if (key === 'max_price') {
filterName = 'Цена до'; filterName = 'Цена до';
filterValue = [value + ' ₽']; filterValue = [value + ' ₽'];
} }
filters.push({ filters.push({
key: key, key: key,
name: filterName.charAt( W1).toUpperCase() + filterName.slice(1), name: filterName.charAt( W1).toUpperCase() + filterName.slice(1),
values: filterValue values: filterValue
}); });
} }
}); });
return filters; return filters;
} }
// Функция для отображения активных фильтров // Функция для отображения активных фильтров
function displayActiveFilters() { function displayActiveFilters() {
const $filterList = $('.active-filters__list'); const $filterList = $('.active-filters__list');
const $filterContainer = $('.active-filters'); const $filterContainer = $('.active-filters');
const $clearButton = $('.active-filters__clear'); const $clearButton = $('.active-filters__clear');
$filterList.empty(); $filterList.empty();
const activeFilters = getActiveFilters(); const activeFilters = getActiveFilters();
if (activeFilters.length > 0) { if (activeFilters.length > 0) {
$filterContainer.show(); $filterContainer.show();
$clearButton.show(); $clearButton.show();
activeFilters.forEach(filter => { activeFilters.forEach(filter => {
filter.values.forEach(value => { filter.values.forEach(value => {
const $filterTag = $('<span>', { const $filterTag = $('<span>', {
class: 'active-filters__tag', class: 'active-filters__tag',
html: `${filter.name}: ${value} <span class="active-filters__remove" data-key="${filter.key}" data-value="${value}">&times;</span>` html: `${filter.name}: ${value} <span class="active-filters__remove" data-key="${filter.key}" data-value="${value}">&times;</span>`
}); });
$filterList.append($filterTag); $filterList.append($filterTag);
}); });
}); });
W2 else { } else {
$filterContainer.hide(); $filterContainer.hide();
$clearButton.hide(); $clearButton.hide();
} }
} }
// Инициализация при загрузке страницы // Инициализация при загрузке страницы
displayActiveFilters(); displayActiveFilters();
// Обновление фильтров после AJAX-фильтрации // Обновление фильтров после AJAX-фильтрации
$(document).on('wcpf_after_filtering', function() { $(document).on('wcpf_after_filtering', function() {
displayActiveFilters(); displayActiveFilters();
}); });
// Удаление фильтра // Удаление фильтра
$(document).on('click', '.active-filters__remove', function() { $(document).on('click', '.active-filters__remove', function() {
const key = $(this).data('key'); const key = $(this).data('key');
const value = $(this).data('value'); const value = $(this).data('value');
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search);
if (key === 'min_price' || key === 'max_price') { if (key === 'min_price' || key === 'max_price') {
params.delete(key); params.delete(key);
} else { } else {
let values = params.get(key) ? params.get(key).split(',') : []; let values = params.get(key) ? params.get(key).split(',') : [];
values = values.filter(val => decodeURIComponent(val.replace(/\+/g, ' ')) !== value); values = values.filter(val => decodeURIComponent(val.replace(/\+/g, ' ')) !== value);
if (values.length > 0) { if (values.length > 0) {
params.set(key, values.join(',')); params.set(key, values.join(','));
} else { } else {
params.delete(key); params.delete(key);
} }
} }
const newUrl = window.location.pathname + (params.toString() ? '?' + params.toString() : ''); const newUrl = window.location.pathname + (params.toString() ? '?' + params.toString() : '');
window.history.pushState({}, '', newUrl); window.history.pushState({}, '', newUrl);
// Запуск AJAX-фильтрации // Запуск AJAX-фильтрации
$.ajax({ $.ajax({
url: wc_checkout_params.ajax_url, url: wc_checkout_params.ajax_url,
type: 'POST', type: 'POST',
data: { data: {
action: 'wcpf_filter', action: 'wcpf_filter',
query: params.toString(), query: params.toString(),
category_id: $('#load-more-products').data('category_id'), category_id: $('#load-more-products').data('category_id'),
category_type: $('#load-more-products').data('category_type') category_type: $('#load-more-products').data('category_type')
}, },
success: function(response) { success: function(response) {
if (response.success) { if (response.success) {
$('.product__main').html(response.data.products); $('.product__main').html(response.data.products);
displayActiveFilters(); displayActiveFilters();
$(document.body).trigger('wc_fragments_refreshed'); $(document.body).trigger('wc_fragments_refreshed');
} }
}, },
error: function() { error: function() {
alert('Ошибка при обновлении фильтров'); alert('Ошибка при обновлении фильтров');
} }
}); });
}); });
// Очистка всех фильтров // Очистка всех фильтров
$(document).on('click', '.active-filters__clear', function() { $(document).on('click', '.active-filters__clear', function() {
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search);
const newUrl = window.location.pathname; const newUrl = window.location.pathname;
window.history.pushState({}, '', newUrl); window.history.pushState({}, '', newUrl);
$.ajax({ $.ajax({
url: wc_checkout_params.ajax_url, url: wc_checkout_params.ajax_url,
type: 'POST', type: 'POST',
data: { data: {
action: 'wcpf_filter', action: 'wcpf_filter',
query: '', query: '',
category_id: $('#load-more-products').data('category_id'), category_id: $('#load-more-products').data('category_id'),
category_type: $('#load-more-products').data('category_type') category_type: $('#load-more-products').data('category_type')
}, },
success: function(response) { success: function(response) {
if (response.success) { if (response.success) {
$('.product__main').html(response.data.products); $('.product__main').html(response.data.products);
displayActiveFilters(); displayActiveFilters();
$(document.body).trigger('wc_fragments_refreshed'); $(document.body).trigger('wc_fragments_refreshed');
} }
}, },
error: function() { error: function() {
alert('Ошибка при очистке фильтров'); alert('Ошибка при очистке фильтров');
} }
}); });
}); });
// Обработка загрузки дополнительных продуктов // Обработка загрузки дополнительных продуктов
$(document).on('click', '#load-more-products', function() { $(document).on('click', '#load-more-products', function() {
const $button = $(this); const $button = $(this);
const categoryId = $button.data('category_id'); const categoryId = $button.data('category_id');
const categoryType = $button.data('category_type'); const categoryType = $button.data('category_type');
const page = parseInt($button.data('page') || 1) + 1; const page = parseInt($button.data('page') || 1) + 1;
$.ajax({ $.ajax({
url: wc_checkout_params.ajax_url, url: wc_checkout_params.ajax_url,
type: 'POST', type: 'POST',
data: { data: {
action: 'load_more_products', action: 'load_more_products',
category_id: categoryId, category_id: categoryId,
category_type: categoryType, category_type: categoryType,
page: page, page: page,
query: window.location.search query: window.location.search
}, },
success: function(response) { success: function(response) {
if (response.success) { if (response.success) {
$('.product__main').append(response.data.products); $('.product__main').append(response.data.products);
$button.data('page', page); $button.data('page', page);
if (!response.data.has_more) { if (!response.data.has_more) {
$button.hide(); $button.hide();
} }
} }
}, },
error: function() { error: function() {
alert('Ошибка при загрузке продуктов'); alert('Ошибка при загрузке продуктов');
} }
}); });
}); });
}); });

@ -1,74 +1,74 @@
<?php <?php
add_filter('timber/context', function($context) { add_filter('timber/context', function($context) {
if (function_exists('is_product') && is_product()) { if (function_exists('is_product') && is_product()) {
$product_id = get_the_ID(); $product_id = get_the_ID();
$product = wc_get_product($product_id); $product = wc_get_product($product_id);
if ($product) { if ($product) {
$attributes = []; $attributes = [];
$product_attributes = $product->get_attributes(); $product_attributes = $product->get_attributes();
if (!empty($product_attributes)) { if (!empty($product_attributes)) {
foreach ($product_attributes as $taxonomy => $attribute) { foreach ($product_attributes as $taxonomy => $attribute) {
if ($attribute->is_taxonomy()) { if ($attribute->is_taxonomy()) {
$terms = wc_get_product_terms($product_id, $taxonomy, ['fields' => 'all']); $terms = wc_get_product_terms($product_id, $taxonomy, ['fields' => 'all']);
if (!empty($terms)) { if (!empty($terms)) {
$attr_values = []; $attr_values = [];
foreach ($terms as $term) { foreach ($terms as $term) {
$attr_values[] = [ $attr_values[] = [
'name' => $term->name, 'name' => $term->name,
'slug' => $term->slug, 'slug' => $term->slug,
'term_id' => $term->term_id, 'term_id' => $term->term_id,
'link' => get_term_link($term->term_id, $taxonomy), 'link' => get_term_link($term->term_id, $taxonomy),
]; ];
} }
$attributes[wc_attribute_label($taxonomy)] = $attr_values; $attributes[wc_attribute_label($taxonomy)] = $attr_values;
} }
} else { } else {
$attributes[wc_attribute_label($taxonomy)] = $attribute->get_options(); $attributes[wc_attribute_label($taxonomy)] = $attribute->get_options();
} }
} }
} }
$context['product_attributes'] = $attributes; $context['product_attributes'] = $attributes;
if ($product->is_type('variable')) { if ($product->is_type('variable')) {
$available_variations = $product->get_available_variations(); $available_variations = $product->get_available_variations();
$variations_data = []; $variations_data = [];
foreach ($available_variations as $variation) { foreach ($available_variations as $variation) {
$variation_id = $variation['variation_id']; $variation_id = $variation['variation_id'];
$variation_obj = wc_get_product($variation_id); $variation_obj = wc_get_product($variation_id);
$variations_data[] = [ $variations_data[] = [
'variation_id' => $variation_id, 'variation_id' => $variation_id,
'price' => $variation_obj->get_price(), 'price' => $variation_obj->get_price(),
'regular_price' => $variation_obj->get_regular_price(), 'regular_price' => $variation_obj->get_regular_price(),
'sale_price' => $variation_obj->get_sale_price(), 'sale_price' => $variation_obj->get_sale_price(),
'attributes' => $variation['attributes'] 'attributes' => $variation['attributes']
]; ];
} }
$context['variations'] = $variations_data; $context['variations'] = $variations_data;
} }
$meta_fields = [ $meta_fields = [
'composition' => get_post_meta($product_id, '_composition', true), 'composition' => get_post_meta($product_id, '_composition', true),
'feeding_recommendations' => get_post_meta($product_id, '_feeding_recommendations', true), 'feeding_recommendations' => get_post_meta($product_id, '_feeding_recommendations', true),
'feeding_recommendations_table' => get_field('feeding_recommendations_table', $product_id), 'feeding_recommendations_table' => get_field('feeding_recommendations_table', $product_id),
'nutritional_value' => get_post_meta($product_id, '_nutritional_value', true), 'nutritional_value' => get_post_meta($product_id, '_nutritional_value', true),
'vitamins' => get_post_meta($product_id, '_vitamins', true), 'vitamins' => get_post_meta($product_id, '_vitamins', true),
'additives' => get_post_meta($product_id, '_additives', true), 'additives' => get_post_meta($product_id, '_additives', true),
'energy_value' => get_post_meta($product_id, '_energy_value', true), 'energy_value' => get_post_meta($product_id, '_energy_value', true),
'important' => get_post_meta($product_id, '_important', true), 'important' => get_post_meta($product_id, '_important', true),
]; ];
$context['product_meta'] = $meta_fields; $context['product_meta'] = $meta_fields;
} }
} }
return $context; return $context;
}); });

@ -1,444 +1,444 @@
{% set current_path = template_path ~ '/modules/shop/components/single-product' %} {% set current_path = template_path ~ '/modules/shop/components/single-product' %}
{% set bodyClass = 'bg-white' %} {% set bodyClass = 'bg-white' %}
{% set mainClass = 'wrapper' %} {% set mainClass = 'wrapper' %}
{% extends 'layout.twig' %} {% extends 'layout.twig' %}
{% block content %} {% block content %}
<div class="wrapper"> <div class="wrapper">
<div class="breadcrumbs"> <div class="breadcrumbs">
{% if wc_breadcrumbs %} {% if wc_breadcrumbs %}
{% for crumb in wc_breadcrumbs %} {% for crumb in wc_breadcrumbs %}
<a href="{{ crumb.url }}" class="breadcrumbs__item"> <a href="{{ crumb.url }}" class="breadcrumbs__item">
{{ crumb.text }} {{ crumb.text }}
</a> </a>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</div> </div>
<a href="{{ fn('get_permalink', fn('wc_get_page_id', 'shop')) }}" class="back back-detail"> <a href="{{ fn('get_permalink', fn('wc_get_page_id', 'shop')) }}" class="back back-detail">
{{ function('pll_e', 'к каталогу') }} {{ function('pll_e', 'к каталогу') }}
</a> </a>
<div class="detail"> <div class="detail">
<div class="detail__images"> <div class="detail__images">
{% for image in gallery_images %} {% for image in gallery_images %}
<div class="detail__image detail__image--width-perc-{% if loop.index == 1 or loop.index == 4 %}100{% else %}50{% endif %}" data-count-img="{{ loop.index0 }}"> <div class="detail__image detail__image--width-perc-{% if loop.index == 1 or loop.index == 4 %}100{% else %}50{% endif %}" data-count-img="{{ loop.index0 }}">
<img src="{{ image.src }}" alt="{{ image.alt }}" class=""> <img src="{{ image.src }}" alt="{{ image.alt }}" class="">
</div> </div>
{% endfor %} {% endfor %}
<div class="swiper-pagination"></div> <div class="swiper-pagination"></div>
</div> </div>
<div class="detail__content"> <div class="detail__content">
<div class="detail__label"> <div class="detail__label">
{% if product_attributes.Flavor is defined and product_attributes.Flavor|length > 0 %} {% if product_attributes.Flavor is defined and product_attributes.Flavor|length > 0 %}
<div class="product-item-label__tag product-item-label__tag--black"> <div class="product-item-label__tag product-item-label__tag--black">
{{ product_attributes.Flavor[0].name }} {{ product_attributes.Flavor[0].name }}
</div> </div>
{% endif %} {% endif %}
{% if product_attributes.Вкус is defined and product_attributes.Вкус|length > 0 %} {% if product_attributes.Вкус is defined and product_attributes.Вкус|length > 0 %}
<div class="product-item-label__tag product-item-label__tag--black"> <div class="product-item-label__tag product-item-label__tag--black">
<a href="{{ product_attributes.Вкус[0].link }}">{{ product_attributes.Вкус[0].name }}</a> <a href="{{ product_attributes.Вкус[0].link }}">{{ product_attributes.Вкус[0].name }}</a>
</div> </div>
{% endif %} {% endif %}
{% if product_attributes.Тег is defined and product_attributes.Тег|length > 0 %} {% if product_attributes.Тег is defined and product_attributes.Тег|length > 0 %}
<div class="product-item-label__tag product-item-label__tag--title"> <div class="product-item-label__tag product-item-label__tag--title">
<a href="{{ product_attributes.Тег[0].link }}">{{ product_attributes.Тег[0].name }}</a> <a href="{{ product_attributes.Тег[0].link }}">{{ product_attributes.Тег[0].name }}</a>
</div> </div>
{% endif %} {% endif %}
{% if product.is_on_sale() %} {% if product.is_on_sale() %}
<div class="product-item-label__tag product-item-label__tag--sale"> <div class="product-item-label__tag product-item-label__tag--sale">
{{ function('pll_e', 'Распродажа %') }} {{ function('pll_e', 'Распродажа %') }}
</div> </div>
{% endif %} {% endif %}
</div> </div>
<h1 class="detail__title"> <h1 class="detail__title">
{{ product.get_title }} {{ product.get_title }}
</h1> </h1>
<div class="detail__images-phone"> <div class="detail__images-phone">
<div class="swiper-wrapper"> <div class="swiper-wrapper">
{% for image in gallery_images %} {% for image in gallery_images %}
<div class="swiper-slide"> <div class="swiper-slide">
<div class="detail-images-phone__image-block" data-count-img="{{ loop.index0 }}"> <div class="detail-images-phone__image-block" data-count-img="{{ loop.index0 }}">
<img src="{{ image.src }}" alt="{{ image.alt }}"> <img src="{{ image.src }}" alt="{{ image.alt }}">
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
<div class="swiper-pagination"></div> <div class="swiper-pagination"></div>
</div> </div>
<div class="detail__block-price"> <div class="detail__block-price">
<p class="detail-block-price__price"> <p class="detail-block-price__price">
{{ product.get_price }} {{ fn('get_woocommerce_currency_symbol') }} {{ product.get_price }} {{ fn('get_woocommerce_currency_symbol') }}
</p> </p>
{% if product.is_on_sale() %} {% if product.is_on_sale() %}
<div class="detail-block-price__sale"> <div class="detail-block-price__sale">
<p class="detail-block-price-sale__text"> <p class="detail-block-price-sale__text">
{{ product.get_regular_price }} {{ fn('get_woocommerce_currency_symbol') }} {{ product.get_regular_price }} {{ fn('get_woocommerce_currency_symbol') }}
</p> </p>
<p class="detail-block-price-sale__perc"> <p class="detail-block-price-sale__perc">
{{ ((product.get_regular_price - product.get_price) / product.get_regular_price * 100)|round }} {{ ((product.get_regular_price - product.get_price) / product.get_regular_price * 100)|round }}
</p> </p>
</div> </div>
{% endif %} {% endif %}
</div> </div>
<form action="" class="detail-block__form" data-product-id="{{ product.id }}"> <form action="" class="detail-block__form" data-product-id="{{ product.id }}">
{% set collection = fn('wc_get_product_terms', product.id, 'pa_collection') %} {% set collection = fn('wc_get_product_terms', product.id, 'pa_collection') %}
{% if collection %} {% if collection %}
{% set siblings = function('get_collection_siblings', collection[0].term_id) %} {% set siblings = function('get_collection_siblings', collection[0].term_id) %}
{% if siblings %} {% if siblings %}
<div class="detail-block-form__item detail-block-form__item--radio radio-button"> <div class="detail-block-form__item detail-block-form__item--radio radio-button">
{% for sibling in siblings %} {% for sibling in siblings %}
{% set weight = sibling.post_title|split(', ')|last %} {% set weight = sibling.post_title|split(', ')|last %}
{% set current_weight = function('get_product_info', product.id, 'weight') %} {% set current_weight = function('get_product_info', product.id, 'weight') %}
{% set class = weight == current_weight ? 'active' : '' %} {% set class = weight == current_weight ? 'active' : '' %}
<a href="{{ function('get_permalink', sibling.ID) }}" class="button button--white button--red-48-px {{ class }}" data-product_id="{{ sibling.ID }}" data-product_price="{{ function('get_product_info', sibling.ID, 'price') }}"> <a href="{{ function('get_permalink', sibling.ID) }}" class="button button--white button--red-48-px {{ class }}" data-product_id="{{ sibling.ID }}" data-product_price="{{ function('get_product_info', sibling.ID, 'price') }}">
{{ weight|upper }} {{ weight|upper }}
</a> </a>
{% endfor %} {% endfor %}
<input type="text" class="radio-button__input" value="{{ current_weight|upper }}" readonly> <input type="text" class="radio-button__input" value="{{ current_weight|upper }}" readonly>
</div> </div>
{% endif %} {% endif %}
{% endif %} {% endif %}
</form> </form>
{{ function('do_action', 'woocommerce_' ~ product.get_type() ~ '_add_to_cart') }} {{ function('do_action', 'woocommerce_' ~ product.get_type() ~ '_add_to_cart') }}
<div class="detail__toggle"> <div class="detail__toggle">
<div class="toggle"> <div class="toggle">
<p class="toggle__title"> <p class="toggle__title">
{{ function('pll_e', 'ОПИСАНИЕ') }} {{ function('pll_e', 'ОПИСАНИЕ') }}
</p> </p>
<div class="toggle__block-content"> <div class="toggle__block-content">
<div class="toggle__content"> <div class="toggle__content">
<p class="toggle__text"> <p class="toggle__text">
{{ product.get_description() }} {{ product.get_description() }}
</p> </p>
</div> </div>
</div> </div>
</div> </div>
{% if product_meta.composition %} {% if product_meta.composition %}
<div class="toggle"> <div class="toggle">
<p class="toggle__title"> <p class="toggle__title">
{{ function('pll_e', 'СОСТАВ') }} {{ function('pll_e', 'СОСТАВ') }}
</p> </p>
<div class="toggle__block-content"> <div class="toggle__block-content">
<div class="toggle__content"> <div class="toggle__content">
<p class="toggle__text"> <p class="toggle__text">
{{ product_meta.composition }} {{ product_meta.composition }}
</p> </p>
</div> </div>
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% if product_meta.feeding_recommendations_table %} {% if product_meta.feeding_recommendations_table %}
<div class="toggle"> <div class="toggle">
<p class="toggle__title"> <p class="toggle__title">
{{ function('pll_e', 'РЕКОМЕНДАЦИИ ПО КОРМЛЕНИЮ') }} {{ function('pll_e', 'РЕКОМЕНДАЦИИ ПО КОРМЛЕНИЮ') }}
</p> </p>
<div class="toggle__block-content"> <div class="toggle__block-content">
<div class="toggle__content"> <div class="toggle__content">
<div class="toggle__table toggle__table--three"> <div class="toggle__table toggle__table--three">
{% if product_meta.feeding_recommendations_table.header %} {% if product_meta.feeding_recommendations_table.header %}
<div class="toggle-table__block"> <div class="toggle-table__block">
<p class="toggle-table__title">{{ product_meta.feeding_recommendations_table.header.0 is iterable ? product_meta.feeding_recommendations_table.header.0|join(', ') : product_meta.feeding_recommendations_table.header.0 }}</p> <p class="toggle-table__title">{{ product_meta.feeding_recommendations_table.header.0 is iterable ? product_meta.feeding_recommendations_table.header.0|join(', ') : product_meta.feeding_recommendations_table.header.0 }}</p>
{% for row in product_meta.feeding_recommendations_table.body %} {% for row in product_meta.feeding_recommendations_table.body %}
<div class="toggle-table__item"> <div class="toggle-table__item">
<p>{{ row.0 is iterable ? row.0|join(', ') : row.0 }}</p> <p>{{ row.0 is iterable ? row.0|join(', ') : row.0 }}</p>
<div class="toggle-table-item__line"></div> <div class="toggle-table-item__line"></div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
<div class="toggle-table__block"> <div class="toggle-table__block">
<p class="toggle-table__title">{{ product_meta.feeding_recommendations_table.header.1 is iterable ? product_meta.feeding_recommendations_table.header.1|join(', ') : product_meta.feeding_recommendations_table.header.1 }}</p> <p class="toggle-table__title">{{ product_meta.feeding_recommendations_table.header.1 is iterable ? product_meta.feeding_recommendations_table.header.1|join(', ') : product_meta.feeding_recommendations_table.header.1 }}</p>
{% for row in product_meta.feeding_recommendations_table.body %} {% for row in product_meta.feeding_recommendations_table.body %}
<div class="toggle-table__item"> <div class="toggle-table__item">
<p>{{ row.1 is iterable ? row.1|join(', ') : row.1 }}</p> <p>{{ row.1 is iterable ? row.1|join(', ') : row.1 }}</p>
<div class="toggle-table-item__line"></div> <div class="toggle-table-item__line"></div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
<div class="toggle-table__block"> <div class="toggle-table__block">
<p class="toggle-table__title">{{ product_meta.feeding_recommendations_table.header.2 is iterable ? product_meta.feeding_recommendations_table.header.2|join(', ') : product_meta.feeding_recommendations_table.header.2 }}</p> <p class="toggle-table__title">{{ product_meta.feeding_recommendations_table.header.2 is iterable ? product_meta.feeding_recommendations_table.header.2|join(', ') : product_meta.feeding_recommendations_table.header.2 }}</p>
{% for row in product_meta.feeding_recommendations_table.body %} {% for row in product_meta.feeding_recommendations_table.body %}
<div class="toggle-table__item"> <div class="toggle-table__item">
<p>{{ row.2 is iterable ? row.2|join(', ') : row.2 }}</p> <p>{{ row.2 is iterable ? row.2|join(', ') : row.2 }}</p>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% elseif product_meta.feeding_recommendations %} {% elseif product_meta.feeding_recommendations %}
<div class="toggle"> <div class="toggle">
<p class="toggle__title"> <p class="toggle__title">
{{ function('pll_e', 'РЕКОМЕНДАЦИИ ПО КОРМЛЕНИЮ') }} {{ function('pll_e', 'РЕКОМЕНДАЦИИ ПО КОРМЛЕНИЮ') }}
</p> </p>
<div class="toggle__block-content"> <div class="toggle__block-content">
<div class="toggle__content"> <div class="toggle__content">
{{ product_meta.feeding_recommendations }} {{ product_meta.feeding_recommendations }}
</div> </div>
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% if product_meta.nutritional_value or product_meta.vitamins or product_meta.additives or product_meta.energy_value %} {% if product_meta.nutritional_value or product_meta.vitamins or product_meta.additives or product_meta.energy_value %}
<div class="toggle"> <div class="toggle">
<p class="toggle__title"> <p class="toggle__title">
{{ function('pll_e', 'ПИЩЕВАЯ ЦЕННОСТЬ') }} {{ function('pll_e', 'ПИЩЕВАЯ ЦЕННОСТЬ') }}
</p> </p>
<div class="toggle__block-content"> <div class="toggle__block-content">
<div class="toggle__content"> <div class="toggle__content">
{% if product_meta.nutritional_value and product_meta.vitamins %} {% if product_meta.nutritional_value and product_meta.vitamins %}
<div class="toggle__table toggle__table--two"> <div class="toggle__table toggle__table--two">
<div class="toggle-table__block "> <div class="toggle-table__block ">
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ПИЩЕВАЯ ЦЕННОСТЬ') }}</p> <p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ПИЩЕВАЯ ЦЕННОСТЬ') }}</p>
{{ product_meta.nutritional_value }} {{ product_meta.nutritional_value }}
</div> </div>
<div class="toggle-table__block "> <div class="toggle-table__block ">
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ВИТАМИНЫ НА КГ') }}</p> <p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ВИТАМИНЫ НА КГ') }}</p>
{{ product_meta.vitamins }} {{ product_meta.vitamins }}
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% if product_meta.additives or product_meta.energy_value %} {% if product_meta.additives or product_meta.energy_value %}
<div class="toggle__table toggle__table--two"> <div class="toggle__table toggle__table--two">
{% if product_meta.additives %} {% if product_meta.additives %}
<div class="toggle-table__block "> <div class="toggle-table__block ">
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ПИТАТЕЛЬНЫЕ ДОБАВКИ НА КГ') }}</p> <p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ПИТАТЕЛЬНЫЕ ДОБАВКИ НА КГ') }}</p>
{{ product_meta.additives }} {{ product_meta.additives }}
</div> </div>
{% endif %} {% endif %}
{% if product_meta.energy_value %} {% if product_meta.energy_value %}
<div class="toggle-table__block "> <div class="toggle-table__block ">
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ЭНЕРГЕТИЧЕСКАЯ ЦЕННОСТЬ НА 100 ГРАММ') }}</p> <p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ЭНЕРГЕТИЧЕСКАЯ ЦЕННОСТЬ НА 100 ГРАММ') }}</p>
<div class="toggle-table__item"> <div class="toggle-table__item">
<div class="detail__warning warning"> <div class="detail__warning warning">
<div class="detail-warning__content"> <div class="detail-warning__content">
<p class="detail-warning__title">{{ product_meta.energy_value }}</p> <p class="detail-warning__title">{{ product_meta.energy_value }}</p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div> </div>
{% endif %} {% endif %}
</div> </div>
<div class="detail__warning"> <div class="detail__warning">
<div class="detail-warning__content"> <div class="detail-warning__content">
<p class="detail-warning__title">{{ function('pll_e', 'Важно') }}</p> <p class="detail-warning__title">{{ function('pll_e', 'Важно') }}</p>
<p class="detail-warning__text"> <p class="detail-warning__text">
{{ product_meta.important }} {{ product_meta.important }}
</p> </p>
</div> </div>
</div> </div>
</div> </div>
<div class="product__main"> <div class="product__main">
{% set recommended_products = function('get_field', 'recommended_products', product.id) %} {% set recommended_products = function('get_field', 'recommended_products', product.id) %}
{% set related_products = recommended_products ? recommended_products : function('wc_get_related_products', product.id, 4) %} {% set related_products = recommended_products ? recommended_products : function('wc_get_related_products', product.id, 4) %}
{% if related_products %} {% if related_products %}
<div class="detail__wrapper-catalot"> <div class="detail__wrapper-catalot">
<div class="detail__catalot"> <div class="detail__catalot">
<div class="detail-catalot__header"> <div class="detail-catalot__header">
<p class="detail-catalot__title"> <p class="detail-catalot__title">
{{ function('pll_e', 'вашему питомцу может понравиться') }} {{ function('pll_e', 'вашему питомцу может понравиться') }}
</p> </p>
<div class="detail-catalot__control"> <div class="detail-catalot__control">
<button class="detail-catalot-control__button prev"> <button class="detail-catalot-control__button prev">
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-left.svg" alt=""> <img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-left.svg" alt="">
</button> </button>
<button class="detail-catalot-control__button next"> <button class="detail-catalot-control__button next">
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-right.svg" alt=""> <img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-right.svg" alt="">
</button> </button>
</div> </div>
</div> </div>
<div class="detail-catalot__content swiper-wrapper"> <div class="detail-catalot__content swiper-wrapper">
{% for related_product in related_products %} {% for related_product in related_products %}
<div class="swiper-slide"> <div class="swiper-slide">
{% set post_id = related_product.ID is defined ? related_product.ID : related_product %} {% set post_id = related_product.ID is defined ? related_product.ID : related_product %}
{% set wc_product = fn('wc_get_product', post_id) %} {% set wc_product = fn('wc_get_product', post_id) %}
{% if wc_product %} {% if wc_product %}
<div class="product__item"> <div class="product__item">
<div class="product-item__label"> <div class="product-item__label">
{% if wc_product.get_date_created|date('Y-m-d') >= criteria_for_new_product %} {% if wc_product.get_date_created|date('Y-m-d') >= criteria_for_new_product %}
<span href="#" class="product-item-label__tag product-item-label__tag--new"> <span href="#" class="product-item-label__tag product-item-label__tag--new">
{{ function('pll_e', 'Новинка') }} {{ function('pll_e', 'Новинка') }}
</span> </span>
{% endif %} {% endif %}
{% if wc_product.is_on_sale() %} {% if wc_product.is_on_sale() %}
<span href="#" class="product-item-label__tag product-item-label__tag--sale"> <span href="#" class="product-item-label__tag product-item-label__tag--sale">
{{ function('pll_e', 'Распродажа %') }} {{ function('pll_e', 'Распродажа %') }}
</span> </span>
{% endif %} {% endif %}
</div> </div>
<a href="{{ wc_product.get_permalink() }}" class="product-item__product-card"> <a href="{{ wc_product.get_permalink() }}" class="product-item__product-card">
<img src="{{ fn('wp_get_attachment_url', wc_product.get_image_id()) }}" alt="{{ wc_product.get_name() }}" class="product-item__images"> <img src="{{ fn('wp_get_attachment_url', wc_product.get_image_id()) }}" alt="{{ wc_product.get_name() }}" class="product-item__images">
</a> </a>
<div class="product-item__content-card"> <div class="product-item__content-card">
<div class="compound"> <div class="compound">
{% set compound = fn('wc_get_product_terms', post_id, 'pa_compound') %} {% set compound = fn('wc_get_product_terms', post_id, 'pa_compound') %}
{% for option in compound %} {% for option in compound %}
{% set term = get_term(option) %} {% set term = get_term(option) %}
<a href="/compound/{{ term.slug }}" class="compound__item">{{ term.name }}</a> <a href="/compound/{{ term.slug }}" class="compound__item">{{ term.name }}</a>
{% endfor %} {% endfor %}
</div> </div>
<a href="{{ wc_product.get_permalink() }}" class="product-item__title">{{ wc_product.get_name() }}</a> <a href="{{ wc_product.get_permalink() }}" class="product-item__title">{{ wc_product.get_name() }}</a>
<div class="product-item__price"> <div class="product-item__price">
<p>{{ wc_product.get_price() }} {{ fn('get_woocommerce_currency_symbol') }}</p> <p>{{ wc_product.get_price() }} {{ fn('get_woocommerce_currency_symbol') }}</p>
</div> </div>
<div class="product-item__bye"> <div class="product-item__bye">
<button class="button button--white button--100-perc open-overlay"> <button class="button button--white button--100-perc open-overlay">
{{ function('pll_e', 'Купить') }} {{ function('pll_e', 'Купить') }}
</button> </button>
</div> </div>
</div> </div>
<div class="product-item__overlay"> <div class="product-item__overlay">
<div class="product-item-overlay__header"> <div class="product-item-overlay__header">
<a href="{{ wc_product.get_permalink() }}" class="product-item__title">{{ wc_product.get_name() }}</a> <a href="{{ wc_product.get_permalink() }}" class="product-item__title">{{ wc_product.get_name() }}</a>
<ul class="product-item-overlay__tags"> <ul class="product-item-overlay__tags">
{% set features = fn('wc_get_product_terms', post_id, 'pa_features') %} {% set features = fn('wc_get_product_terms', post_id, 'pa_features') %}
{% for option in features %} {% for option in features %}
{% set term = get_term(option) %} {% set term = get_term(option) %}
<li>{{ term.name }}</li> <li>{{ term.name }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
<form class="product-item__form" method="post" action="/send-telegram.php"> <form class="product-item__form" method="post" action="/send-telegram.php">
<div class="product-item-overlay__input-block"> <div class="product-item-overlay__input-block">
<div class="product-item-overlay__field"> <div class="product-item-overlay__field">
<p class="product-item-overlay-field__title">Объем</p> <p class="product-item-overlay-field__title">Объем</p>
<div class="select"> <div class="select">
{% set cur_weight = function('get_product_info', post_id, 'weight') %} {% set cur_weight = function('get_product_info', post_id, 'weight') %}
<input type="text" class="select__state" value="{{ cur_weight }}" readonly data-product_id="{{ post_id }}" data-product_price="{{ wc_product.get_price() }}"> <input type="text" class="select__state" value="{{ cur_weight }}" readonly data-product_id="{{ post_id }}" data-product_price="{{ wc_product.get_price() }}">
<div class="state__block"> <div class="state__block">
<ul class="state__content"> <ul class="state__content">
{% set collection = fn('wc_get_product_terms', post_id, 'pa_collection') %} {% set collection = fn('wc_get_product_terms', post_id, 'pa_collection') %}
{% for option in collection %} {% for option in collection %}
{% set term = get_term(option) %} {% set term = get_term(option) %}
{% if term %} {% if term %}
{% set siblings = function('get_collection_siblings', term.term_id) %} {% set siblings = function('get_collection_siblings', term.term_id) %}
{% for sibling in siblings %} {% for sibling in siblings %}
{% set weight = function('get_product_info', sibling.ID, 'weight') %} {% set weight = function('get_product_info', sibling.ID, 'weight') %}
{% set class = '' %} {% set class = '' %}
{% if weight == cur_weight %} {% if weight == cur_weight %}
{% set class = 'active' %} {% set class = 'active' %}
{% endif %} {% endif %}
<li> <li>
<button class="state__button {{ class }}" data-product_id="{{ sibling.ID }}" data-product_price="{{ function('get_product_info', sibling.ID, 'price') }}"> <button class="state__button {{ class }}" data-product_id="{{ sibling.ID }}" data-product_price="{{ function('get_product_info', sibling.ID, 'price') }}">
{{ weight }} {{ weight }}
</button> </button>
</li> </li>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
<div class="product-item-overlay__field"> <div class="product-item-overlay__field">
<p class="product-item-overlay-field__title">Количество</p> <p class="product-item-overlay-field__title">Количество</p>
<div class="counter"> <div class="counter">
<button class="counter__button minus"> <button class="counter__button minus">
<img src="{{ theme.uri }}/woocommerce/assets/img/svg/main/minus.svg" alt=""> <img src="{{ theme.uri }}/woocommerce/assets/img/svg/main/minus.svg" alt="">
</button> </button>
<input type="text" class="counter__input" value="1"> <input type="text" class="counter__input" value="1">
<button class="counter__button plus"> <button class="counter__button plus">
<img src="{{ theme.uri }}/woocommerce/assets/img/svg/main/plus.svg" alt=""> <img src="{{ theme.uri }}/woocommerce/assets/img/svg/main/plus.svg" alt="">
</button> </button>
</div> </div>
</div> </div>
</div> </div>
<p class="product-item-overlay__price"> <p class="product-item-overlay__price">
{{ wc_product.get_price() }} {{ wc_product.get_price() }}
</p> </p>
<div class="product-item-overlay__block-button"> <div class="product-item-overlay__block-button">
<div class="product-item-overlay__button"> <div class="product-item-overlay__button">
{{ function('get_add_to_cart_button', post_id) }} {{ function('get_add_to_cart_button', post_id) }}
</div> </div>
<div class="product-item-overlay__more_button"> <div class="product-item-overlay__more_button">
<a class="to-know button--100-perc" href="{{ wc_product.get_permalink() }}"> <a class="to-know button--100-perc" href="{{ wc_product.get_permalink() }}">
<p>{{ function('pll_e', 'Подробнее') }}</p> <p>{{ function('pll_e', 'Подробнее') }}</p>
</a> </a>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div> </div>
<div class="gallery"> <div class="gallery">
<button class="gallery__close gallery-button"> <button class="gallery__close gallery-button">
<img src="{{ theme.uri }}/static/shop/img/svg/main/black-x.svg" alt=""> <img src="{{ theme.uri }}/static/shop/img/svg/main/black-x.svg" alt="">
</button> </button>
<div class="gallery__wrapper"> <div class="gallery__wrapper">
<div class="gallery__pagination"> <div class="gallery__pagination">
{% for image in gallery_images %} {% for image in gallery_images %}
<button class="gallery-pagination__item" data-count-img="{{ loop.index0 }}"> <button class="gallery-pagination__item" data-count-img="{{ loop.index0 }}">
<img src="{{ image.src }}" alt="{{ image.alt }}"> <img src="{{ image.src }}" alt="{{ image.alt }}">
</button> </button>
{% endfor %} {% endfor %}
</div> </div>
<div class="gallery__slider swiper"> <div class="gallery__slider swiper">
<div class="swiper-wrapper"> <div class="swiper-wrapper">
{% for image in gallery_images %} {% for image in gallery_images %}
<div class="swiper-slide"> <div class="swiper-slide">
<div class="gallery__block"> <div class="gallery__block">
<img src="{{ image.src }}" alt="{{ image.alt }}"> <img src="{{ image.src }}" alt="{{ image.alt }}">
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
<div class="swiper-pagination"></div> <div class="swiper-pagination"></div>
<div class="swiper-button-prev gallery-button"> <div class="swiper-button-prev gallery-button">
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-left.svg" alt=""> <img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-left.svg" alt="">
</div> </div>
<div class="swiper-button-next gallery-button"> <div class="swiper-button-next gallery-button">
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-right.svg" alt=""> <img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-right.svg" alt="">
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

@ -1,142 +1,142 @@
<?php <?php
add_action( 'wp_ajax_apply_coupon', 'custom_apply_coupon' ); add_action( 'wp_ajax_apply_coupon', 'custom_apply_coupon' );
add_action( 'wp_ajax_nopriv_apply_coupon', 'custom_apply_coupon' ); add_action( 'wp_ajax_nopriv_apply_coupon', 'custom_apply_coupon' );
function custom_apply_coupon() { function custom_apply_coupon() {
$coupon_code = isset( $_POST['coupon_code'] ) ? sanitize_text_field( $_POST['coupon_code'] ) : ''; $coupon_code = isset( $_POST['coupon_code'] ) ? sanitize_text_field( $_POST['coupon_code'] ) : '';
if ( empty( $coupon_code ) ) { if ( empty( $coupon_code ) ) {
wp_send_json_error( array( 'message' => 'Код купона не указан.' ) ); wp_send_json_error( array( 'message' => 'Код купона не указан.' ) );
} }
// Применение купона // Применение купона
$applied = WC()->cart->apply_coupon( $coupon_code ); $applied = WC()->cart->apply_coupon( $coupon_code );
if ( $applied ) { if ( $applied ) {
wp_send_json_success(); wp_send_json_success();
} else { } else {
wp_send_json_error( array( 'message' => 'Купон не применён. Проверьте код.' ) ); wp_send_json_error( array( 'message' => 'Купон не применён. Проверьте код.' ) );
} }
} }
/** /**
* Обработчик AJAX для обновления количества товара в корзине * Обработчик AJAX для обновления количества товара в корзине
*/ */
add_action('wp_ajax_update_cart_quantity', 'update_cart_quantity_handler'); add_action('wp_ajax_update_cart_quantity', 'update_cart_quantity_handler');
add_action('wp_ajax_nopriv_update_cart_quantity', 'update_cart_quantity_handler'); add_action('wp_ajax_nopriv_update_cart_quantity', 'update_cart_quantity_handler');
function update_cart_quantity_handler() { function update_cart_quantity_handler() {
if (!isset($_POST['cart_item_key']) || !isset($_POST['quantity'])) { if (!isset($_POST['cart_item_key']) || !isset($_POST['quantity'])) {
wp_send_json_error('Недостаточно данных'); wp_send_json_error('Недостаточно данных');
return; return;
} }
$cart_item_key = sanitize_text_field($_POST['cart_item_key']); $cart_item_key = sanitize_text_field($_POST['cart_item_key']);
$quantity = intval($_POST['quantity']); $quantity = intval($_POST['quantity']);
if ($quantity <= 0) { if ($quantity <= 0) {
wp_send_json_error('Некорректное количество'); wp_send_json_error('Некорректное количество');
return; return;
} }
$cart = WC()->cart; $cart = WC()->cart;
$cart_item = $cart->get_cart_item($cart_item_key); $cart_item = $cart->get_cart_item($cart_item_key);
if (!$cart_item) { if (!$cart_item) {
wp_send_json_error('Товар не найден в корзине'); wp_send_json_error('Товар не найден в корзине');
return; return;
} }
$updated = $cart->set_quantity($cart_item_key, $quantity); $updated = $cart->set_quantity($cart_item_key, $quantity);
if ($updated) { if ($updated) {
wp_send_json_success(); wp_send_json_success();
} else { } else {
wp_send_json_error('Не удалось обновить количество'); wp_send_json_error('Не удалось обновить количество');
} }
} }
/** /**
* Обработчик AJAX для восстановления товара в корзине * Обработчик AJAX для восстановления товара в корзине
*/ */
add_action('wp_ajax_restore_cart_item', 'restore_cart_item_handler'); add_action('wp_ajax_restore_cart_item', 'restore_cart_item_handler');
add_action('wp_ajax_nopriv_restore_cart_item', 'restore_cart_item_handler'); add_action('wp_ajax_nopriv_restore_cart_item', 'restore_cart_item_handler');
function restore_cart_item_handler() { function restore_cart_item_handler() {
if (!isset($_POST['product_id']) || !isset($_POST['quantity'])) { if (!isset($_POST['product_id']) || !isset($_POST['quantity'])) {
wp_send_json_error('Недостаточно данных'); wp_send_json_error('Недостаточно данных');
return; return;
} }
$product_id = intval($_POST['product_id']); $product_id = intval($_POST['product_id']);
$variation_id = isset($_POST['variation_id']) ? intval($_POST['variation_id']) : 0; $variation_id = isset($_POST['variation_id']) ? intval($_POST['variation_id']) : 0;
$quantity = intval($_POST['quantity']); $quantity = intval($_POST['quantity']);
if ($quantity <= 0) { if ($quantity <= 0) {
wp_send_json_error('Некорректное количество'); wp_send_json_error('Некорректное количество');
return; return;
} }
$cart = WC()->cart; $cart = WC()->cart;
$cart_item_key = $cart->add_to_cart($product_id, $quantity, $variation_id); $cart_item_key = $cart->add_to_cart($product_id, $quantity, $variation_id);
if ($cart_item_key) { if ($cart_item_key) {
wp_send_json_success(); wp_send_json_success();
} else { } else {
wp_send_json_error('Не удалось восстановить товар'); wp_send_json_error('Не удалось восстановить товар');
} }
} }
/** /**
* Обработчик AJAX для получения фрагментов корзины * Обработчик AJAX для получения фрагментов корзины
*/ */
add_action('wp_ajax_get_cart_fragment', 'get_cart_fragment_handler'); add_action('wp_ajax_get_cart_fragment', 'get_cart_fragment_handler');
add_action('wp_ajax_nopriv_get_cart_fragment', 'get_cart_fragment_handler'); add_action('wp_ajax_nopriv_get_cart_fragment', 'get_cart_fragment_handler');
function get_cart_fragment_handler() { function get_cart_fragment_handler() {
ob_start(); ob_start();
Timber::render('shop/cart-contents.twig', Timber::context()); Timber::render('shop/cart-contents.twig', Timber::context());
$contents = ob_get_clean(); $contents = ob_get_clean();
$response = array( $response = array(
'contents' => $contents, 'contents' => $contents,
'total' => WC()->cart->get_cart_total(), 'total' => WC()->cart->get_cart_total(),
'count' => WC()->cart->get_cart_contents_count() 'count' => WC()->cart->get_cart_contents_count()
); );
wp_send_json_success($response); wp_send_json_success($response);
} }
/** /**
* Инициализация WooCommerce AJAX * Инициализация WooCommerce AJAX
*/ */
add_action('wp_enqueue_scripts', 'enqueue_woocommerce_ajax_scripts'); add_action('wp_enqueue_scripts', 'enqueue_woocommerce_ajax_scripts');
function enqueue_woocommerce_ajax_scripts() { function enqueue_woocommerce_ajax_scripts() {
wp_localize_script('jquery', 'woocommerce_params', array( wp_localize_script('jquery', 'woocommerce_params', array(
'ajax_url' => admin_url('admin-ajax.php'), 'ajax_url' => admin_url('admin-ajax.php'),
'currency_symbol' => get_woocommerce_currency_symbol(), 'currency_symbol' => get_woocommerce_currency_symbol(),
'currency_format' => str_replace(array('%1$s', '%2$s'), array('%s', '%v'), get_woocommerce_price_format()), 'currency_format' => str_replace(array('%1$s', '%2$s'), array('%s', '%v'), get_woocommerce_price_format()),
)); ));
} }
add_action('wp_ajax_remove_cart_item', 'handle_remove_cart_item'); add_action('wp_ajax_remove_cart_item', 'handle_remove_cart_item');
add_action('wp_ajax_nopriv_remove_cart_item', 'handle_remove_cart_item'); add_action('wp_ajax_nopriv_remove_cart_item', 'handle_remove_cart_item');
function handle_remove_cart_item() { function handle_remove_cart_item() {
if (!isset($_POST['cart_item_key'])) { if (!isset($_POST['cart_item_key'])) {
wp_send_json_error('Не указан ключ элемента корзины'); wp_send_json_error('Не указан ключ элемента корзины');
return; return;
} }
$cart_item_key = sanitize_text_field($_POST['cart_item_key']); $cart_item_key = sanitize_text_field($_POST['cart_item_key']);
$cart = WC()->cart; $cart = WC()->cart;
if ($cart->remove_cart_item($cart_item_key)) { if ($cart->remove_cart_item($cart_item_key)) {
wp_send_json_success(); wp_send_json_success();
} else { } else {
wp_send_json_error('Не удалось удалить товар из корзины'); wp_send_json_error('Не удалось удалить товар из корзины');
} }
} }

@ -1,387 +1,387 @@
<?php <?php
add_filter( 'woocommerce_cart_needs_shipping_address', '__return_false' ); add_filter( 'woocommerce_cart_needs_shipping_address', '__return_false' );
add_filter( 'woocommerce_shipping_calculator_enable_postcode', '__return_false' ); add_filter( 'woocommerce_shipping_calculator_enable_postcode', '__return_false' );
add_filter( 'woocommerce_shipping_calculator_enable_city', '__return_false' ); add_filter( 'woocommerce_shipping_calculator_enable_city', '__return_false' );
add_filter( 'woocommerce_shipping_calculator_enable_state', '__return_false' ); add_filter( 'woocommerce_shipping_calculator_enable_state', '__return_false' );
add_filter( 'woocommerce_shipping_packages', 'display_all_shipping_methods' ); add_filter( 'woocommerce_shipping_packages', 'display_all_shipping_methods' );
function display_all_shipping_methods( $packages ) { function display_all_shipping_methods( $packages ) {
foreach ( $packages as &$package ) { foreach ( $packages as &$package ) {
// Убираем ограничения по адресу // Убираем ограничения по адресу
$package['destination']['country'] = ''; $package['destination']['country'] = '';
$package['destination']['state'] = ''; $package['destination']['state'] = '';
$package['destination']['postcode'] = ''; $package['destination']['postcode'] = '';
$package['destination']['city'] = ''; $package['destination']['city'] = '';
} }
return $packages; return $packages;
} }
add_filter( 'woocommerce_checkout_fields', 'customize_billing_fields' ); add_filter( 'woocommerce_checkout_fields', 'customize_billing_fields' );
function customize_billing_fields( $fields ) { function customize_billing_fields( $fields ) {
// Удаляем все стандартные поля // Удаляем все стандартные поля
unset( $fields['billing']['billing_company'] ); unset( $fields['billing']['billing_company'] );
unset( $fields['billing']['billing_country'] ); unset( $fields['billing']['billing_country'] );
unset( $fields['billing']['billing_address_1'] ); unset( $fields['billing']['billing_address_1'] );
unset( $fields['billing']['billing_address_2'] ); unset( $fields['billing']['billing_address_2'] );
unset( $fields['billing']['billing_city'] ); unset( $fields['billing']['billing_city'] );
unset( $fields['billing']['billing_state'] ); unset( $fields['billing']['billing_state'] );
unset( $fields['billing']['billing_postcode'] ); unset( $fields['billing']['billing_postcode'] );
// Перенастраиваем только нужные поля // Перенастраиваем только нужные поля
$fields['billing']['billing_first_name'] = array( $fields['billing']['billing_first_name'] = array(
'type' => 'text', 'type' => 'text',
'label' => __('Имя', 'woocommerce'), 'label' => __('Имя', 'woocommerce'),
'placeholder' => __('Ваше имя', 'woocommerce'), 'placeholder' => __('Ваше имя', 'woocommerce'),
'required' => true, 'required' => true,
'class' => array('form-row-wide'), 'class' => array('form-row-wide'),
'priority' => 10, 'priority' => 10,
); );
$fields['billing']['billing_last_name'] = array( $fields['billing']['billing_last_name'] = array(
'type' => 'text', 'type' => 'text',
'label' => __('Фамилия', 'woocommerce'), 'label' => __('Фамилия', 'woocommerce'),
'placeholder' => __('Ваша фамилия', 'woocommerce'), 'placeholder' => __('Ваша фамилия', 'woocommerce'),
'required' => true, 'required' => true,
'class' => array('form-row-wide'), 'class' => array('form-row-wide'),
'priority' => 10, 'priority' => 10,
); );
$fields['billing']['billing_email'] = array( $fields['billing']['billing_email'] = array(
'type' => 'email', 'type' => 'email',
'label' => __('E-mail', 'woocommerce'), 'label' => __('E-mail', 'woocommerce'),
'placeholder' => __('Начните вводить ваш email', 'woocommerce'), 'placeholder' => __('Начните вводить ваш email', 'woocommerce'),
'required' => true, 'required' => true,
'class' => array('form-row-wide'), 'class' => array('form-row-wide'),
'priority' => 20, 'priority' => 20,
); );
$fields['billing']['billing_phone'] = array( $fields['billing']['billing_phone'] = array(
'type' => 'tel', 'type' => 'tel',
'label' => __('Телефон', 'woocommerce'), 'label' => __('Телефон', 'woocommerce'),
'placeholder' => __('+7 ___ ___ ____', 'woocommerce'), 'placeholder' => __('+7 ___ ___ ____', 'woocommerce'),
'required' => true, 'required' => true,
'class' => array('form-row-wide'), 'class' => array('form-row-wide'),
'priority' => 30, 'priority' => 30,
); );
$fields['billing']['billing_city'] = array( $fields['billing']['billing_city'] = array(
'type' => 'text', 'type' => 'text',
'label' => __('Населенный пункт', 'woocommerce'), 'label' => __('Населенный пункт', 'woocommerce'),
'placeholder' => __('Ваш город', 'woocommerce'), 'placeholder' => __('Ваш город', 'woocommerce'),
'required' => true, 'required' => true,
'class' => array('form-row-wide'), 'class' => array('form-row-wide'),
'priority' => 40, 'priority' => 40,
); );
$fields['billing']['billing_address_1'] = array( $fields['billing']['billing_address_1'] = array(
'type' => 'text', 'type' => 'text',
'label' => __('Адрес', 'woocommerce'), 'label' => __('Адрес', 'woocommerce'),
'placeholder' => __('Адрес', 'woocommerce'), 'placeholder' => __('Адрес', 'woocommerce'),
'required' => false, 'required' => false,
'class' => array('visually-hidden'), 'class' => array('visually-hidden'),
'priority' => 40, 'priority' => 40,
); );
$fields['billing']['billing_address_2'] = array( $fields['billing']['billing_address_2'] = array(
'type' => 'text', 'type' => 'text',
'label' => __('Адрес 2', 'woocommerce'), 'label' => __('Адрес 2', 'woocommerce'),
'placeholder' => __('Адрес 2', 'woocommerce'), 'placeholder' => __('Адрес 2', 'woocommerce'),
'required' => false, 'required' => false,
'class' => array('visually-hidden'), 'class' => array('visually-hidden'),
'priority' => 40, 'priority' => 40,
); );
return $fields; return $fields;
} }
// remove_action( 'woocommerce_review_order_before_payment', 'woocommerce_review_order_shipping' ); // remove_action( 'woocommerce_review_order_before_payment', 'woocommerce_review_order_shipping' );
add_action( 'init', function() { add_action( 'init', function() {
update_option( 'woocommerce_enable_coupons', 'yes' ); // Включение купонов update_option( 'woocommerce_enable_coupons', 'yes' ); // Включение купонов
} ); } );
add_filter( 'woocommerce_available_payment_gateways', 'set_default_payment_gateway' ); add_filter( 'woocommerce_available_payment_gateways', 'set_default_payment_gateway' );
function set_default_payment_gateway( $available_gateways ) { function set_default_payment_gateway( $available_gateways ) {
if ( is_cart() || is_checkout() ) { if ( is_cart() || is_checkout() ) {
// Устанавливаем способ оплаты по умолчанию // Устанавливаем способ оплаты по умолчанию
$default_payment_gateway = 'tbank'; // ID способа оплаты, например 'cod' для "наличными при доставке" $default_payment_gateway = 'tbank'; // ID способа оплаты, например 'cod' для "наличными при доставке"
// Проверяем, доступен ли этот способ оплаты // Проверяем, доступен ли этот способ оплаты
if ( isset( $available_gateways[ $default_payment_gateway ] ) ) { if ( isset( $available_gateways[ $default_payment_gateway ] ) ) {
foreach ( $available_gateways as $gateway_id => $gateway ) { foreach ( $available_gateways as $gateway_id => $gateway ) {
// Оставляем только выбранный способ оплаты // Оставляем только выбранный способ оплаты
if ( $gateway_id !== $default_payment_gateway ) { if ( $gateway_id !== $default_payment_gateway ) {
unset( $available_gateways[ $gateway_id ] ); unset( $available_gateways[ $gateway_id ] );
} }
} }
} }
} }
return $available_gateways; return $available_gateways;
} }
add_filter( 'woocommerce_checkout_terms_and_conditions_checkbox_enabled', '__return_false' ); add_filter( 'woocommerce_checkout_terms_and_conditions_checkbox_enabled', '__return_false' );
add_filter( 'woocommerce_checkout_terms_is_required', '__return_false' ); add_filter( 'woocommerce_checkout_terms_is_required', '__return_false' );
remove_action( 'woocommerce_checkout_before_terms_and_conditions', 'wc_checkout_privacy_policy_text', 20 ); remove_action( 'woocommerce_checkout_before_terms_and_conditions', 'wc_checkout_privacy_policy_text', 20 );
remove_action( 'woocommerce_checkout_terms_and_conditions', 'wc_terms_and_conditions_page_content', 30 ); remove_action( 'woocommerce_checkout_terms_and_conditions', 'wc_terms_and_conditions_page_content', 30 );
remove_action( 'woocommerce_checkout_after_terms_and_conditions', 'wc_privacy_policy_text', 20 ); remove_action( 'woocommerce_checkout_after_terms_and_conditions', 'wc_privacy_policy_text', 20 );
add_action( 'woocommerce_checkout_process', 'remove_terms_validation' ); add_action( 'woocommerce_checkout_process', 'remove_terms_validation' );
function remove_terms_validation() { function remove_terms_validation() {
remove_action( 'woocommerce_checkout_process', 'woocommerce_checkout_terms_and_conditions' ); remove_action( 'woocommerce_checkout_process', 'woocommerce_checkout_terms_and_conditions' );
} }
add_filter( 'woocommerce_order_button_html', 'custom_checkout_button_classes' ); add_filter( 'woocommerce_order_button_html', 'custom_checkout_button_classes' );
function custom_checkout_button_classes( $button ) { function custom_checkout_button_classes( $button ) {
// Заменяем стандартные классы // Заменяем стандартные классы
$button = '<div class="order-your-calculation__submit"> $button = '<div class="order-your-calculation__submit">
<button type="submit" class="button alt button--gradient button--high button--100-perc" name="woocommerce_checkout_place_order" id="place_order" value="Оплатить" data-value="Оплатить"><span>Оплатить</span></button> <button type="submit" class="button alt button--gradient button--high button--100-perc" name="woocommerce_checkout_place_order" id="place_order" value="Оплатить" data-value="Оплатить"><span>Оплатить</span></button>
</div>'; </div>';
return $button; return $button;
} }
add_filter( 'woocommerce_checkout_fields', 'customize_checkout_registration_fields' ); add_filter( 'woocommerce_checkout_fields', 'customize_checkout_registration_fields' );
function customize_checkout_registration_fields( $fields ) { function customize_checkout_registration_fields( $fields ) {
// Убираем поле ввода пароля // Убираем поле ввода пароля
unset( $fields['account']['account_password'] ); unset( $fields['account']['account_password'] );
return $fields; return $fields;
} }
// Автоматическая генерация пароля // Автоматическая генерация пароля
add_filter( 'woocommerce_checkout_posted_data', 'generate_password_for_registration' ); add_filter( 'woocommerce_checkout_posted_data', 'generate_password_for_registration' );
function generate_password_for_registration( $data ) { function generate_password_for_registration( $data ) {
$billing_first_name = isset( $_POST['billing_first_name'] ) ? sanitize_text_field( $_POST['billing_first_name'] ) : ''; $billing_first_name = isset( $_POST['billing_first_name'] ) ? sanitize_text_field( $_POST['billing_first_name'] ) : '';
$billing_last_name = isset( $_POST['billing_last_name'] ) ? sanitize_text_field( $_POST['billing_last_name'] ) : ''; $billing_last_name = isset( $_POST['billing_last_name'] ) ? sanitize_text_field( $_POST['billing_last_name'] ) : '';
$billing_address_1 = isset( $_POST['billing_address_1'] ) ? sanitize_text_field( $_POST['billing_address_1'] ) : ''; $billing_address_1 = isset( $_POST['billing_address_1'] ) ? sanitize_text_field( $_POST['billing_address_1'] ) : '';
$billing_address_2 = isset( $_POST['billing_address_2'] ) ? sanitize_text_field( $_POST['billing_address_2'] ) : ''; $billing_address_2 = isset( $_POST['billing_address_2'] ) ? sanitize_text_field( $_POST['billing_address_2'] ) : '';
$billing_city = isset( $_POST['billing_city'] ) ? sanitize_text_field( $_POST['billing_city'] ) : ''; $billing_city = isset( $_POST['billing_city'] ) ? sanitize_text_field( $_POST['billing_city'] ) : '';
$billing_postcode = isset( $_POST['billing_postcode'] ) ? sanitize_text_field( $_POST['billing_postcode'] ) : ''; $billing_postcode = isset( $_POST['billing_postcode'] ) ? sanitize_text_field( $_POST['billing_postcode'] ) : '';
$billing_country = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : ''; $billing_country = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
$billing_state = isset( $_POST['billing_state'] ) ? sanitize_text_field( $_POST['billing_state'] ) : ''; $billing_state = isset( $_POST['billing_state'] ) ? sanitize_text_field( $_POST['billing_state'] ) : '';
$billing_phone = isset( $_POST['billing_phone'] ) ? sanitize_text_field( $_POST['billing_phone'] ) : ''; $billing_phone = isset( $_POST['billing_phone'] ) ? sanitize_text_field( $_POST['billing_phone'] ) : '';
$billing_email = isset( $_POST['billing_email'] ) ? sanitize_email( $_POST['billing_email'] ) : ''; $billing_email = isset( $_POST['billing_email'] ) ? sanitize_email( $_POST['billing_email'] ) : '';
$data['shipping_first_name'] = $data['billing_first_name']; $data['shipping_first_name'] = $data['billing_first_name'];
$data['shipping_last_name'] = $data['billing_last_name']; $data['shipping_last_name'] = $data['billing_last_name'];
$data['shipping_address_1'] = $data['billing_address_1'] . $data['billing_address_2']; $data['shipping_address_1'] = $data['billing_address_1'] . $data['billing_address_2'];
$data['shipping_city'] = $data['billing_city']; $data['shipping_city'] = $data['billing_city'];
$data['shipping_postcode'] = $data['billing_postcode']; $data['shipping_postcode'] = $data['billing_postcode'];
$data['shipping_country'] = $data['billing_country']; $data['shipping_country'] = $data['billing_country'];
$data['shipping_state'] = $data['billing_state']; $data['shipping_state'] = $data['billing_state'];
return $data; return $data;
} }
function handle_user_registration_on_checkout() { function handle_user_registration_on_checkout() {
// Получаем данные из POST-запроса // Получаем данные из POST-запроса
if ( isset( $_POST['billing_email'] ) && isset( $_POST['reg'] )) { if ( isset( $_POST['billing_email'] ) && isset( $_POST['reg'] )) {
if ($_POST['reg'] == '1'){ if ($_POST['reg'] == '1'){
$email = sanitize_email( $_POST['billing_email'] ); $email = sanitize_email( $_POST['billing_email'] );
$pass = sanitize_text_field( $_POST['pass'] ); $pass = sanitize_text_field( $_POST['pass'] );
// Регистрация пользователя // Регистрация пользователя
$user_id = custom_register_user_from_post( $email, $pass ); $user_id = custom_register_user_from_post( $email, $pass );
if ( is_wp_error( $user_id ) ) { if ( is_wp_error( $user_id ) ) {
// Если email уже существует, выводим ошибку // Если email уже существует, выводим ошибку
wc_add_notice( $user_id->get_error_message(), 'error' ); wc_add_notice( $user_id->get_error_message(), 'error' );
} else { } else {
wp_set_current_user( $user_id ); // Устанавливаем текущего пользователя wp_set_current_user( $user_id ); // Устанавливаем текущего пользователя
wp_set_auth_cookie( $user_id ); // Устанавливаем куки для авторизации wp_set_auth_cookie( $user_id ); // Устанавливаем куки для авторизации
do_action( 'wp_login', $email, $user ); // Событие входа в систему do_action( 'wp_login', $email, $user ); // Событие входа в систему
}} }}
} }
} }
add_action( 'woocommerce_checkout_process', 'handle_user_registration_on_checkout' ); add_action( 'woocommerce_checkout_process', 'handle_user_registration_on_checkout' );
function custom_register_user_from_post( $email, $pass ) { function custom_register_user_from_post( $email, $pass ) {
// Проверяем, есть ли уже пользователь с таким email // Проверяем, есть ли уже пользователь с таким email
if ( email_exists( $email ) ) { if ( email_exists( $email ) ) {
return new WP_Error( 'email_exists', 'Этот email уже зарегистрирован.' ); return new WP_Error( 'email_exists', 'Этот email уже зарегистрирован.' );
} }
// Создаем пользователя в WordPress // Создаем пользователя в WordPress
$user_id = wp_create_user( $email, $pass, $email ); $user_id = wp_create_user( $email, $pass, $email );
if ( is_wp_error( $user_id ) ) { if ( is_wp_error( $user_id ) ) {
return $user_id; // Возвращаем ошибку, если не удалось создать пользователя return $user_id; // Возвращаем ошибку, если не удалось создать пользователя
} }
update_user_meta( $user_id, 'billing_email', $email ); // Устанавливаем email update_user_meta( $user_id, 'billing_email', $email ); // Устанавливаем email
update_user_meta( $user_id, 'user_email', $email ); // Устанавливаем email для входа update_user_meta( $user_id, 'user_email', $email ); // Устанавливаем email для входа
// Устанавливаем роль пользователя как 'customer' для WooCommerce // Устанавливаем роль пользователя как 'customer' для WooCommerce
$user = new WP_User( $user_id ); $user = new WP_User( $user_id );
$user->set_role( 'customer' ); $user->set_role( 'customer' );
return $user_id; return $user_id;
} }
add_filter( 'woocommerce_form_field', 'add_error_containers_to_checkout_fields', 10, 4 ); add_filter( 'woocommerce_form_field', 'add_error_containers_to_checkout_fields', 10, 4 );
function add_error_containers_to_checkout_fields( $field, $key, $args, $value ) { function add_error_containers_to_checkout_fields( $field, $key, $args, $value ) {
if ( is_checkout() ) { if ( is_checkout() ) {
// Добавляем контейнер для ошибок под полем // Добавляем контейнер для ошибок под полем
$error_container = '<div id="' . esc_attr( $key ) . '-error" class="form-input__error"></div>'; $error_container = '<div id="' . esc_attr( $key ) . '-error" class="form-input__error"></div>';
$field .= $error_container; $field .= $error_container;
} }
return $field; return $field;
} }
add_filter( 'woocommerce_add_error', 'remove_payments_word_from_errors_multilang' ); add_filter( 'woocommerce_add_error', 'remove_payments_word_from_errors_multilang' );
function remove_payments_word_from_errors_multilang( $error ) { function remove_payments_word_from_errors_multilang( $error ) {
// Слова для удаления в разных языках // Слова для удаления в разных языках
$translations = array( $translations = array(
'Платежи', // Русский 'Платежи', // Русский
'Billing', // Английский 'Billing', // Английский
); );
foreach ( $translations as $word ) { foreach ( $translations as $word ) {
$error = str_replace( $word, '', $error ); $error = str_replace( $word, '', $error );
} }
return trim( $error ); return trim( $error );
} }
add_action( 'woocommerce_checkout_process', 'validate_phone_field_with_li_data_id' ); add_action( 'woocommerce_checkout_process', 'validate_phone_field_with_li_data_id' );
function validate_phone_field_with_li_data_id() { function validate_phone_field_with_li_data_id() {
// Получаем значение телефона из формы // Получаем значение телефона из формы
$phone = isset( $_POST['billing_phone'] ) ? sanitize_text_field( $_POST['billing_phone'] ) : ''; $phone = isset( $_POST['billing_phone'] ) ? sanitize_text_field( $_POST['billing_phone'] ) : '';
// Проверяем формат телефона // Проверяем формат телефона
if ( ! preg_match( '/^\+?[0-9\s\-\(\)]+$/', $phone ) ) { if ( ! preg_match( '/^\+?[0-9\s\-\(\)]+$/', $phone ) ) {
wc_add_notice( 'phone_err', 'error', 'billing_phone' ); wc_add_notice( 'phone_err', 'error', 'billing_phone' );
} }
} }
add_action( 'woocommerce_checkout_process', 'make_address_required_for_specific_shipping' ); add_action( 'woocommerce_checkout_process', 'make_address_required_for_specific_shipping' );
function make_address_required_for_specific_shipping() { function make_address_required_for_specific_shipping() {
// Получаем выбранный метод доставки // Получаем выбранный метод доставки
$chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods' ); $chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods' );
$chosen_shipping = isset( $chosen_shipping_methods[0] ) ? $chosen_shipping_methods[0] : ''; $chosen_shipping = isset( $chosen_shipping_methods[0] ) ? $chosen_shipping_methods[0] : '';
// Проверяем, выбран ли метод доставки "official_cdek:137" // Проверяем, выбран ли метод доставки "official_cdek:137"
if ( $chosen_shipping === 'official_cdek:137' ) { if ( $chosen_shipping === 'official_cdek:137' ) {
// Проверяем, заполнен ли адрес // Проверяем, заполнен ли адрес
if ( empty( $_POST['billing_address_1'] ) ) { if ( empty( $_POST['billing_address_1'] ) ) {
wc_add_notice('adress_error', 'error' ); wc_add_notice('adress_error', 'error' );
} }
} }
} }
function auto_fill_shipping_fields_from_billing( $order_id ) { function auto_fill_shipping_fields_from_billing( $order_id ) {
// Получаем объект заказа // Получаем объект заказа
$order = wc_get_order( $order_id ); $order = wc_get_order( $order_id );
if ( ! $order ) { if ( ! $order ) {
return; // Если заказ недоступен, выходим return; // Если заказ недоступен, выходим
} }
// Получаем значения полей billing из глобального $_POST // Получаем значения полей billing из глобального $_POST
$billing_first_name = isset( $_POST['billing_first_name'] ) ? sanitize_text_field( $_POST['billing_first_name'] ) : ''; $billing_first_name = isset( $_POST['billing_first_name'] ) ? sanitize_text_field( $_POST['billing_first_name'] ) : '';
$billing_last_name = isset( $_POST['billing_last_name'] ) ? sanitize_text_field( $_POST['billing_last_name'] ) : ''; $billing_last_name = isset( $_POST['billing_last_name'] ) ? sanitize_text_field( $_POST['billing_last_name'] ) : '';
$billing_address_1 = isset( $_POST['billing_address_1'] ) ? sanitize_text_field( $_POST['billing_address_1'] ) : ''; $billing_address_1 = isset( $_POST['billing_address_1'] ) ? sanitize_text_field( $_POST['billing_address_1'] ) : '';
$billing_address_2 = isset( $_POST['billing_address_2'] ) ? sanitize_text_field( $_POST['billing_address_2'] ) : ''; $billing_address_2 = isset( $_POST['billing_address_2'] ) ? sanitize_text_field( $_POST['billing_address_2'] ) : '';
$billing_city = isset( $_POST['billing_city'] ) ? sanitize_text_field( $_POST['billing_city'] ) : ''; $billing_city = isset( $_POST['billing_city'] ) ? sanitize_text_field( $_POST['billing_city'] ) : '';
$billing_postcode = isset( $_POST['billing_postcode'] ) ? sanitize_text_field( $_POST['billing_postcode'] ) : ''; $billing_postcode = isset( $_POST['billing_postcode'] ) ? sanitize_text_field( $_POST['billing_postcode'] ) : '';
$billing_country = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : ''; $billing_country = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
$billing_state = isset( $_POST['billing_state'] ) ? sanitize_text_field( $_POST['billing_state'] ) : ''; $billing_state = isset( $_POST['billing_state'] ) ? sanitize_text_field( $_POST['billing_state'] ) : '';
$billing_phone = isset( $_POST['billing_phone'] ) ? sanitize_text_field( $_POST['billing_phone'] ) : ''; $billing_phone = isset( $_POST['billing_phone'] ) ? sanitize_text_field( $_POST['billing_phone'] ) : '';
$billing_email = isset( $_POST['billing_email'] ) ? sanitize_email( $_POST['billing_email'] ) : ''; $billing_email = isset( $_POST['billing_email'] ) ? sanitize_email( $_POST['billing_email'] ) : '';
// Копируем данные в поля доставки // Копируем данные в поля доставки
$order->set_shipping_first_name( $billing_first_name ); $order->set_shipping_first_name( $billing_first_name );
$order->set_shipping_last_name( $billing_last_name ); $order->set_shipping_last_name( $billing_last_name );
$order->set_shipping_address_1( $billing_address_1 ); $order->set_shipping_address_1( $billing_address_1 );
$order->set_shipping_address_2( $billing_address_2 ); $order->set_shipping_address_2( $billing_address_2 );
$order->set_shipping_city( $billing_city ); $order->set_shipping_city( $billing_city );
$order->set_shipping_postcode( $billing_postcode ); $order->set_shipping_postcode( $billing_postcode );
$order->set_shipping_country( $billing_country ); $order->set_shipping_country( $billing_country );
$order->set_shipping_state( $billing_state ); $order->set_shipping_state( $billing_state );
// Сохраняем изменения в заказе // Сохраняем изменения в заказе
$order->save(); $order->save();
} }
add_filter('timber/context', function($context) { add_filter('timber/context', function($context) {
if (function_exists('is_product') && is_product()) { if (function_exists('is_product') && is_product()) {
$product_id = get_the_ID(); $product_id = get_the_ID();
$product = wc_get_product($product_id); $product = wc_get_product($product_id);
if ($product) { if ($product) {
$context['product'] = $product; $context['product'] = $product;
$context['product_id'] = $product_id; $context['product_id'] = $product_id;
$terms = get_the_terms($product_id, 'product_cat'); $terms = get_the_terms($product_id, 'product_cat');
if ($terms && !is_wp_error($terms)) { if ($terms && !is_wp_error($terms)) {
$context['product_categories'] = $terms; $context['product_categories'] = $terms;
} }
$attachment_ids = $product->get_gallery_image_ids(); $attachment_ids = $product->get_gallery_image_ids();
$gallery_images = []; $gallery_images = [];
$main_image_id = $product->get_image_id(); $main_image_id = $product->get_image_id();
if ($main_image_id) { if ($main_image_id) {
$gallery_images[] = [ $gallery_images[] = [
'id' => $main_image_id, 'id' => $main_image_id,
'src' => wp_get_attachment_image_url($main_image_id, 'full'), 'src' => wp_get_attachment_image_url($main_image_id, 'full'),
'alt' => get_post_meta($main_image_id, '_wp_attachment_image_alt', true) 'alt' => get_post_meta($main_image_id, '_wp_attachment_image_alt', true)
]; ];
} }
foreach ($attachment_ids as $attachment_id) { foreach ($attachment_ids as $attachment_id) {
$gallery_images[] = [ $gallery_images[] = [
'id' => $attachment_id, 'id' => $attachment_id,
'src' => wp_get_attachment_image_url($attachment_id, 'full'), 'src' => wp_get_attachment_image_url($attachment_id, 'full'),
'alt' => get_post_meta($attachment_id, '_wp_attachment_image_alt', true) 'alt' => get_post_meta($attachment_id, '_wp_attachment_image_alt', true)
]; ];
} }
$context['gallery_images'] = $gallery_images; $context['gallery_images'] = $gallery_images;
$related_products_ids = wc_get_related_products($product_id, 5); $related_products_ids = wc_get_related_products($product_id, 5);
if (!empty($related_products_ids)) { if (!empty($related_products_ids)) {
$related_products = []; $related_products = [];
foreach ($related_products_ids as $related_id) { foreach ($related_products_ids as $related_id) {
$related_product = wc_get_product($related_id); $related_product = wc_get_product($related_id);
if ($related_product) { if ($related_product) {
$related_products[] = $related_product; $related_products[] = $related_product;
} }
} }
$context['related_products'] = $related_products; $context['related_products'] = $related_products;
} }
} }
} }
return $context; return $context;
}); });
function conditional_dequeue_woocommerce_styles() { function conditional_dequeue_woocommerce_styles() {
if (function_exists('is_woocommerce') && !is_woocommerce() && !is_cart() && !is_checkout() && !is_account_page()) { if (function_exists('is_woocommerce') && !is_woocommerce() && !is_cart() && !is_checkout() && !is_account_page()) {
wp_dequeue_style('woocommerce-general'); wp_dequeue_style('woocommerce-general');
wp_dequeue_style('woocommerce-layout'); wp_dequeue_style('woocommerce-layout');
wp_dequeue_style('woocommerce-smallscreen'); wp_dequeue_style('woocommerce-smallscreen');
} }
} }
add_action('wp_enqueue_scripts', 'conditional_dequeue_woocommerce_styles', 999); add_action('wp_enqueue_scripts', 'conditional_dequeue_woocommerce_styles', 999);

@ -1,31 +1,31 @@
<?php <?php
/** /**
* The template for displaying all pages. * The template for displaying all pages.
* *
* This is the template that renders pages using Timber (Twig). * This is the template that renders pages using Timber (Twig).
*/ */
if (is_account_page() && !is_wc_endpoint_url()){ if (is_account_page() && !is_wc_endpoint_url()){
include_module('profile'); include_module('profile');
$orders_pg = false; $orders_pg = false;
include_component('profile', 'profile'); include_component('profile', 'profile');
} }
else if (is_account_page() && isset($wp->query_vars['orders'])){ else if (is_account_page() && isset($wp->query_vars['orders'])){
include_module('profile'); include_module('profile');
$orders_pg = true; $orders_pg = true;
include_component('profile', 'profile'); include_component('profile', 'profile');
} }
elseif (is_account_page() && isset($wp->query_vars['subscriptions'])){ elseif (is_account_page() && isset($wp->query_vars['subscriptions'])){
include_module('profile'); include_module('profile');
include_component('profile', 'subscriptions'); include_component('profile', 'subscriptions');
} }
elseif (is_account_page() && isset($wp->query_vars['view-subscription'])){ elseif (is_account_page() && isset($wp->query_vars['view-subscription'])){
include_module('profile'); include_module('profile');
include_component('profile', 'subscription_single'); include_component('profile', 'subscription_single');
} }
$context = Timber::context(); $context = Timber::context();
$context['post'] = Timber::get_post(); $context['post'] = Timber::get_post();
Timber::render('page.twig', $context); Timber::render('page.twig', $context);

@ -1,60 +1,60 @@
<?php <?php
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
if (is_product()) { if (is_product()) {
include_module('shop'); include_module('shop');
include_component('shop', 'single-product'); include_component('shop', 'single-product');
$context = Timber::get_context(); $context = Timber::get_context();
$post = Timber::get_post(); $post = Timber::get_post();
$context['post'] = $post; $context['post'] = $post;
$context['wc_breadcrumbs'] = array(); $context['wc_breadcrumbs'] = array();
if (function_exists('woocommerce_breadcrumb')) { if (function_exists('woocommerce_breadcrumb')) {
$args = array( $args = array(
'delimiter' => '', 'delimiter' => '',
'wrap_before' => '', 'wrap_before' => '',
'wrap_after' => '', 'wrap_after' => '',
'before' => '', 'before' => '',
'after' => '', 'after' => '',
'home' => _x('Home', 'breadcrumb', 'woocommerce'), 'home' => _x('Home', 'breadcrumb', 'woocommerce'),
); );
$breadcrumbs = new WC_Breadcrumb(); $breadcrumbs = new WC_Breadcrumb();
$breadcrumbs->generate(); $breadcrumbs->generate();
$formatted_breadcrumbs = array(); $formatted_breadcrumbs = array();
foreach ($breadcrumbs->get_breadcrumb() as $crumb) { foreach ($breadcrumbs->get_breadcrumb() as $crumb) {
$formatted_breadcrumbs[] = array( $formatted_breadcrumbs[] = array(
'text' => $crumb[0], 'text' => $crumb[0],
'url' => $crumb[1] 'url' => $crumb[1]
); );
} }
$context['wc_breadcrumbs'] = $formatted_breadcrumbs; $context['wc_breadcrumbs'] = $formatted_breadcrumbs;
} }
$product_id = get_the_ID(); $product_id = get_the_ID();
$product = wc_get_product($product_id); $product = wc_get_product($product_id);
$context['product'] = $product; $context['product'] = $product;
$context['related_products'] = array(); $context['related_products'] = array();
$related_products_ids = wc_get_related_products($product_id, 5); $related_products_ids = wc_get_related_products($product_id, 5);
if ($related_products_ids) { if ($related_products_ids) {
foreach ($related_products_ids as $related_id) { foreach ($related_products_ids as $related_id) {
$related_product = wc_get_product($related_id); $related_product = wc_get_product($related_id);
if ($related_product) { if ($related_product) {
$context['related_products'][] = $related_product; $context['related_products'][] = $related_product;
} }
} }
} }
Timber::render('modules/shop/components/single-product/component-template.twig', $context); Timber::render('modules/shop/components/single-product/component-template.twig', $context);
} }

@ -1076,7 +1076,10 @@ border-bottom: 2px solid var(--interface-main_black, rgba(18, 18, 18, 1))
max-width: 778px; max-width: 778px;
margin-bottom: 27px; margin-bottom: 27px;
} }
<<<<<<< HEAD
=======
>>>>>>> e7e74da0bdd7c9b1db3979f0d5db0d07fafdd903
.discount_block .discount_text{ .discount_block .discount_text{
font-size: 20px; font-size: 20px;
line-height: 24px; line-height: 24px;
@ -4281,6 +4284,8 @@ color: #f4f1f0;
.invisible { .invisible {
visibility: hidden; visibility: hidden;
<<<<<<< HEAD
=======
} }
@ -4547,4 +4552,5 @@ color: #f4f1f0;
.discount_block{ .discount_block{
padding-bottom: 80px; padding-bottom: 80px;
>>>>>>> e7e74da0bdd7c9b1db3979f0d5db0d07fafdd903
} }

File diff suppressed because it is too large Load Diff

@ -1,60 +1,60 @@
{% extends 'layout.twig' %} {% extends 'layout.twig' %}
{% block content %} {% block content %}
{% set current_path = template_path ~ '/modules/author/' %} {% set current_path = template_path ~ '/modules/author/' %}
<!-- Breadcrumb --> <!-- Breadcrumb -->
<section class="breadcrumb"> <section class="breadcrumb">
<div class="container"> <div class="container">
<a href="/">{{ function('pll_e', 'Главная') }}</a> / <a href="/">{{ function('pll_e', 'Главная') }}</a> /
<a href="/blog/">{{ function('pll_e', 'Блог') }}</a> / <a href="/blog/">{{ function('pll_e', 'Блог') }}</a> /
<a href="/blog_author/">{{ function('pll_e', 'Наши авторы') }}</a> <a href="/blog_author/">{{ function('pll_e', 'Наши авторы') }}</a>
</div> </div>
</section> </section>
<!-- Breadcrumb end --> <!-- Breadcrumb end -->
<!-- Authors block --> <!-- Authors block -->
<section class="authors"> <section class="authors">
<div class="container"> <div class="container">
<h1>{{ function('pll_e', 'Все авторы') }}</h1> <h1>{{ function('pll_e', 'Все авторы') }}</h1>
<ul> <ul>
{% for author in authors %} {% for author in authors %}
<li> <li>
<a href="{{ author.link }}"> <a href="{{ author.link }}">
<div class="main-img"> <div class="main-img">
<img src="{{ author.thumbnail.src|default(author.thumbnail|default('https://via.placeholder.com/150')) }}" alt="{{ author.title }}"> <img src="{{ author.thumbnail.src|default(author.thumbnail|default('https://via.placeholder.com/150')) }}" alt="{{ author.title }}">
</div> </div>
<div class="authors-name">{{ author.title }}</div> <div class="authors-name">{{ author.title }}</div>
<div class="authors-type">{{ author.position|default(author.meta('position')) }}</div> <div class="authors-type">{{ author.position|default(author.meta('position')) }}</div>
<p>{{ function('pll_e', 'статей:') }} {{ author.post_count|default(0) }}</p> <p>{{ function('pll_e', 'статей:') }} {{ author.post_count|default(0) }}</p>
</a> </a>
</li> </li>
{% else %} {% else %}
<li>{{ function('pll_e', 'Нет авторов для отображения.') }}</li> <li>{{ function('pll_e', 'Нет авторов для отображения.') }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
</section> </section>
{% include 'forms/discount.twig' %} {% include 'forms/discount.twig' %}
<section class="blog-home other-home"> <section class="blog-home other-home">
<div class="container"> <div class="container">
<!-- Authors block end --> <!-- Authors block end -->
{% include '/blog/featured-slider.twig' %} {% include '/blog/featured-slider.twig' %}
</div> </div>
</section> </section>
{% endblock %} {% endblock %}

@ -1,36 +1,36 @@
{% for post in posts %} {% for post in posts %}
<li class="anons-best__card light"> <li class="anons-best__card light">
<ul class="anons-best__card-alerts"> <ul class="anons-best__card-alerts">
{% for category in post.categories %} {% for category in post.categories %}
<li> <li>
<a href="{{ category.link }}">{{ category.name }}</a> <a href="{{ category.link }}">{{ category.name }}</a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
<a href="{{ post.link }}" class="main-img"> <a href="{{ post.link }}" class="main-img">
<img src="{{ post.thumbnail.src|default('https://via.placeholder.com/150') }}" alt="{{ post.thumbnail.alt }}"> <img src="{{ post.thumbnail.src|default('https://via.placeholder.com/150') }}" alt="{{ post.thumbnail.alt }}">
</a> </a>
<div class="anons-best__card-body"> <div class="anons-best__card-body">
<a href="{{ post.link }}" class="anons-best__card-body__title">{{ post.title }}</a> <a href="{{ post.link }}" class="anons-best__card-body__title">{{ post.title }}</a>
<div class="anons-best__card-body__datas"> <div class="anons-best__card-body__datas">
<p>{{ post.date|date('d.m.Y') }}</p> <p>{{ post.date|date('d.m.Y') }}</p>
<p>{{ function('pll_e', 'время чтения:') }} {{ post.reading_time|default(function('pll_e', '5 мин.')) }}</p> <p>{{ function('pll_e', 'время чтения:') }} {{ post.reading_time|default(function('pll_e', '5 мин.')) }}</p>
<ul> <ul>
{% if post.get_author_img %} {% if post.get_author_img %}
<li class="logo"> <li class="logo">
<img src="{{ post.get_author_img }}" alt="{{ post.get_author_name }}"> <img src="{{ post.get_author_img }}" alt="{{ post.get_author_name }}">
</li> </li>
{% endif %} {% endif %}
<li> <li>
<img src="{{ current_path }}/assets/img/heart-grey.svg" alt=""> <img src="{{ current_path }}/assets/img/heart-grey.svg" alt="">
<span>{{ function('get_post_likes_count', post.ID) }}</span> <span>{{ function('get_post_likes_count', post.ID) }}</span>
</li> </li>
<li> <li>
<img src="{{ current_path }}/assets/img/msg-grey.svg" alt=""> <img src="{{ current_path }}/assets/img/msg-grey.svg" alt="">
<span>{{ post.comment_count }}</span> <span>{{ post.comment_count }}</span>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
</li> </li>
{% endfor %} {% endfor %}

@ -1,92 +1,92 @@
{% set current_path = template_path ~ '/modules/blog/components/news-list' %} {% set current_path = template_path ~ '/modules/blog/components/news-list' %}
{% extends 'layout.twig' %} {% extends 'layout.twig' %}
{% block content %} {% block content %}
<main> <main>
<!-- Breadcrumb --> <!-- Breadcrumb -->
<section class="breadcrumb"> <section class="breadcrumb">
<div class="container"> <div class="container">
<a href="/">{{ function('pll_e', 'Главная') }}</a> / <a href="/">{{ function('pll_e', 'Главная') }}</a> /
<a href="/blog">{{ function('pll_e', 'Блог') }}</a> / <a href="/blog">{{ function('pll_e', 'Блог') }}</a> /
<a href="#">{{ author.title }}</a> <a href="#">{{ author.title }}</a>
</div> </div>
</section> </section>
<!-- Breadcrumb end --> <!-- Breadcrumb end -->
<!-- Authors block --> <!-- Authors block -->
<section class="author-head"> <section class="author-head">
<div class="container"> <div class="container">
<div class="author-head-content"> <div class="author-head-content">
<div class="main-img"> <div class="main-img">
<img src="{{ author.thumbnail.src|default('https://via.placeholder.com/150') }}" alt="{{ author.title }}"> <img src="{{ author.thumbnail.src|default('https://via.placeholder.com/150') }}" alt="{{ author.title }}">
</div> </div>
<div> <div>
<div class="author-name">{{ author.title }}</div> <div class="author-name">{{ author.title }}</div>
<div class="author-type">{{ author.position }}</div> <div class="author-type">{{ author.position }}</div>
<div class="author-description">{{ author.content|striptags }}</div> <div class="author-description">{{ author.content|striptags }}</div>
<p>{{ function('pll_e', 'статей:') }} {{ author.post_count }}</p> <p>{{ function('pll_e', 'статей:') }} {{ author.post_count }}</p>
</div> </div>
</div> </div>
<h2>{{ author.meta('headline')|default(function('pll_e', 'Посты автора')) }}</h2> <h2>{{ author.meta('headline')|default(function('pll_e', 'Посты автора')) }}</h2>
</div> </div>
</section> </section>
<section class="anons"> <section class="anons">
<div class="container"> <div class="container">
<div class="anons-article"> <div class="anons-article">
<ul class="anons-article__card-wrap"> <ul class="anons-article__card-wrap">
{% for post in author.posts %} {% for post in author.posts %}
<li class="anons-best__card light"> <li class="anons-best__card light">
<ul class="anons-best__card-alerts"> <ul class="anons-best__card-alerts">
{% for category in post.categories %} {% for category in post.categories %}
<li> <li>
<a href="{{ category.link }}">{{ category.name }}</a> <a href="{{ category.link }}">{{ category.name }}</a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
<a href="{{ post.link }}" class="main-img"> <a href="{{ post.link }}" class="main-img">
<img src="{{ post.thumbnail.src|default('https://via.placeholder.com/150') }}" alt="{{ post.thumbnail.alt }}"> <img src="{{ post.thumbnail.src|default('https://via.placeholder.com/150') }}" alt="{{ post.thumbnail.alt }}">
</a> </a>
<div class="anons-best__card-body"> <div class="anons-best__card-body">
<a href="{{ post.link }}" class="anons-best__card-body__title">{{ post.title }}</a> <a href="{{ post.link }}" class="anons-best__card-body__title">{{ post.title }}</a>
<div class="anons-best__card-body__datas"> <div class="anons-best__card-body__datas">
<p>{{ post.date|date('d.m.Y') }}</p> <p>{{ post.date|date('d.m.Y') }}</p>
<p>{{ function('pll_e', 'время чтения:') }} {{ post.reading_time|default(function('pll_e', '5 мин.')) }}</p> <p>{{ function('pll_e', 'время чтения:') }} {{ post.reading_time|default(function('pll_e', '5 мин.')) }}</p>
<ul> <ul>
{% if post.get_author_img %} {% if post.get_author_img %}
<li class="logo"> <li class="logo">
<img src="{{ post.get_author_img }}" alt="{{ post.get_author_name }}"> <img src="{{ post.get_author_img }}" alt="{{ post.get_author_name }}">
</li> </li>
{% endif %} {% endif %}
<li> <li>
<img src="{{ current_path }}/assets/img/heart-grey.svg" alt=""> <img src="{{ current_path }}/assets/img/heart-grey.svg" alt="">
<span>{{ function('get_post_likes_count', post.ID) }}</span> <span>{{ function('get_post_likes_count', post.ID) }}</span>
</li> </li>
<li> <li>
<img src="{{ current_path }}/assets/img/msg-grey.svg" alt=""> <img src="{{ current_path }}/assets/img/msg-grey.svg" alt="">
<span>{{ post.comment_count }}</span> <span>{{ post.comment_count }}</span>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
</li> </li>
{% else %} {% else %}
<li>{{ function('pll_e', 'Нет постов') }}</li> <li>{{ function('pll_e', 'Нет постов') }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
{% if total_pages > 1 %} {% if total_pages > 1 %}
<form id="ajax-load-author" data-total="{{ total_pages }}" data-author="{{ author.ID }}"> <form id="ajax-load-author" data-total="{{ total_pages }}" data-author="{{ author.ID }}">
<input type="hidden" name="page_num" id="page_num" value="1"> <input type="hidden" name="page_num" id="page_num" value="1">
<input type="hidden" name="action" value="get_author_posts"> <input type="hidden" name="action" value="get_author_posts">
<button class="anons-article__more-link"> <button class="anons-article__more-link">
{{ function('pll_e', 'ПОКАЗАТЬ ЕЩЁ') }} {{ function('pll_e', 'ПОКАЗАТЬ ЕЩЁ') }}
</button> </button>
</form> </form>
{% endif %} {% endif %}
</div> </div>
</div> </div>
</section> </section>
<!-- Authors block end --> <!-- Authors block end -->
</main> </main>
{% endblock %} {% endblock %}

@ -1,32 +1,32 @@
<div class="comment-block"> <div class="comment-block">
<div class="comment-user"> <div class="comment-user">
<img src="{{ comment.avatar ?? function('get_avatar_url', comment.author.id)|default('') }}" alt="{{ comment.author.name }}"> <img src="{{ comment.avatar ?? function('get_avatar_url', comment.author.id)|default('') }}" alt="{{ comment.author.name }}">
<div class="comment-user_text"> <div class="comment-user_text">
<h6> <h6>
{{ comment.author.name }} {{ comment.author.name }}
</h6> </h6>
<span> <span>
{{ comment.date }} {{ comment.date }}
</span> </span>
</div> </div>
</div> </div>
<p> <p>
{{ comment.content }} {{ comment.content }}
</p> </p>
<div class="comment-btns"> <div class="comment-btns">
<button class="reply-comment-btn" data-comment-id="{{ comment.ID }}"> <button class="reply-comment-btn" data-comment-id="{{ comment.ID }}">
<svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.5 3H3.25C2.00736 3 1 4.00736 1 5.25V5.25C1 6.49264 2.00736 7.5 3.25 7.5H3.5" stroke="#666666"></path> <path d="M9.5 3H3.25C2.00736 3 1 4.00736 1 5.25V5.25C1 6.49264 2.00736 7.5 3.25 7.5H3.5" stroke="#666666"></path>
<path d="M7 0.5L9.5 3L7 5.5" stroke="#666666"></path> <path d="M7 0.5L9.5 3L7 5.5" stroke="#666666"></path>
</svg> </svg>
{{ function('pll_e', 'Ответить') }} {{ function('pll_e', 'Ответить') }}
</button> </button>
<button class="like-comment-btn" data-comment-id="{{ comment.ID }}"> <button class="like-comment-btn" data-comment-id="{{ comment.ID }}">
<svg width="15" height="13" viewBox="0 0 15 13" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="15" height="13" viewBox="0 0 15 13" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.7745 1C8.67239 1 7.7426 2.5355 7.54047 3.30325C7.39224 2.5355 6.49748 1 4.10427 1C1.11276 1 -0.221288 4.85199 2.40639 8.14801C4.50853 10.7848 6.705 11.8147 7.54047 12C8.47026 11.8279 10.8311 10.761 12.8363 7.87004C15.3427 4.25632 13.4022 1 10.7745 1Z" stroke="#666666"></path> <path d="M10.7745 1C8.67239 1 7.7426 2.5355 7.54047 3.30325C7.39224 2.5355 6.49748 1 4.10427 1C1.11276 1 -0.221288 4.85199 2.40639 8.14801C4.50853 10.7848 6.705 11.8147 7.54047 12C8.47026 11.8279 10.8311 10.761 12.8363 7.87004C15.3427 4.25632 13.4022 1 10.7745 1Z" stroke="#666666"></path>
</svg> </svg>
{{ comment.like_count|default('0') }} {{ comment.like_count|default('0') }}
</button> </button>
</div> </div>
<div class="reply-form-container" id="reply-form-{{ comment.ID }}" style="display: none;"></div> <div class="reply-form-container" id="reply-form-{{ comment.ID }}" style="display: none;"></div>
</div> </div>

@ -1,45 +1,45 @@
<section class="{% if class %} {{ class }}{% else %}discount__sale{% endif %} sec-bf"> <section class="{% if class %} {{ class }}{% else %}discount__sale{% endif %} sec-bf">
<div class="container"> <div class="container">
<div class="discount_top"> <div class="discount_top">
<h3 class="discount_title">{{sub_title}}</span> <h3 class="discount_title">{{sub_title}}</span>
</h3> </h3>
<div class="discount_top-imgs"> <div class="discount_top-imgs">
{% if class %} {% if class %}
<img class="dicount_dog-img img--desktop" <img class="dicount_dog-img img--desktop"
src="{{ theme.link }}/static/front-page/img/labrador%20with%20stars.png" src="{{ theme.link }}/static/front-page/img/labrador%20with%20stars.png"
alt=""> alt="">
<img class="dicount_dog-img img--mobile" <img class="dicount_dog-img img--mobile"
src="{{ theme.link }}/static/front-page/img/labrador%20with%20stars%20--%20mobile.png" src="{{ theme.link }}/static/front-page/img/labrador%20with%20stars%20--%20mobile.png"
alt=""> alt="">
{% else %} {% else %}
<img class="dicount_dog-img img--desktop" <img class="dicount_dog-img img--desktop"
src="{{ theme.link }}/static/front-page/img/dicsount-sale.png" src="{{ theme.link }}/static/front-page/img/dicsount-sale.png"
alt=""> alt="">
<img class="dicount_dog-img img--mobile" <img class="dicount_dog-img img--mobile"
src="{{ theme.link }}/static/front-page/img/dicsount-sale-mob.png" src="{{ theme.link }}/static/front-page/img/dicsount-sale-mob.png"
alt=""> alt="">
{% endif %} {% endif %}
</div> </div>
</div> </div>
<div class="dicsount__body"> <div class="dicsount__body">
<div class="" id="" lang="ru-RU" dir="ltr"> <div class="" id="" lang="ru-RU" dir="ltr">
<div class="screen-reader-response"><p role="status" aria-live="polite" aria-atomic="true"></p> <ul></ul></div> <div class="screen-reader-response"><p role="status" aria-live="polite" aria-atomic="true"></p> <ul></ul></div>
<form class="form-process" action="subscribe_form" method="post" class="" aria-label="Контактная форма" novalidate="novalidate" data-status="init"> <form class="form-process" action="subscribe_form" method="post" class="" aria-label="Контактная форма" novalidate="novalidate" data-status="init">
<div class="discount_form "> <div class="discount_form ">
<span class="" data-name="subscriber"><input size="40" class="discount_form-inp" aria-required="true" aria-invalid="false" placeholder="{{ function('pll_e', 'Эл.почта') }}" value="" type="email" name="subscriber"></span> <span class="" data-name="subscriber"><input size="40" class="discount_form-inp" aria-required="true" aria-invalid="false" placeholder="{{ function('pll_e', 'Эл.почта') }}" value="" type="email" name="subscriber"></span>
<img src="/wp-content/themes/cosmopet/static/front-page/img/discount-line{% if class %}-w{% endif %}.svg"> <img src="/wp-content/themes/cosmopet/static/front-page/img/discount-line{% if class %}-w{% endif %}.svg">
<input type="hidden" name="from_url" value="{{ current_url }}"> <input type="hidden" name="from_url" value="{{ current_url }}">
<input type="hidden" name="form_name" value="Subscribtion form"> <input type="hidden" name="form_name" value="Subscribtion form">
<button class="discount_form-btn main_link" type="submit">{{ function('pll_e', 'подписаться') }}</button> <button class="discount_form-btn main_link" type="submit">{{ function('pll_e', 'подписаться') }}</button>
</div> </div>
</form> </form>
</div> </div>
<p class="discount_form-text"> <p class="discount_form-text">
{{ function('pll_e', 'Подписываясь на рассылку, я даю согласие на обработку персональных данных, на получение рекламных сообщений и новостей о товарах и услугах') }}</p> {{ function('pll_e', 'Подписываясь на рассылку, я даю согласие на обработку персональных данных, на получение рекламных сообщений и новостей о товарах и услугах') }}</p>
<p class="discount_text">{{sub_text}}</p> <p class="discount_text">{{sub_text}}</p>
</div> </div>
</div> </div>
</section> </section>

@ -187,6 +187,7 @@
</a> </a>
</li> </li>
{% if CONSTANTS.DOMAIN != 'AE' %}
<li class="main-menu__item"> <li class="main-menu__item">
<a href=" {% if current_lang == 'ru' %}{{production_url}}{% elseif current_lang == 'en' %}{{production_url_en}}{% endif %}" <a href=" {% if current_lang == 'ru' %}{{production_url}}{% elseif current_lang == 'en' %}{{production_url_en}}{% endif %}"
class="main-menu__link"> class="main-menu__link">

@ -1,118 +1,118 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="ru"> <html lang="ru">
<head> <head>
{{ function('wp_head') }} {{ function('wp_head') }}
<title>{{ function('wp_title') }} </title> <title>{{ function('wp_title') }} </title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Top.Mail.Ru counter --> <!-- Top.Mail.Ru counter -->
<script type="text/javascript"> <script type="text/javascript">
var _tmr = window._tmr || (window._tmr = []); var _tmr = window._tmr || (window._tmr = []);
_tmr.push({id: "3569464", type: "pageView", start: (new Date()).getTime()}); _tmr.push({id: "3569464", type: "pageView", start: (new Date()).getTime()});
(function (d, w, id) { (function (d, w, id) {
if (d.getElementById(id)) return; if (d.getElementById(id)) return;
var ts = d.createElement("script"); ts.type = "text/javascript"; ts.async = true; ts.id = id; var ts = d.createElement("script"); ts.type = "text/javascript"; ts.async = true; ts.id = id;
ts.src = "https://top-fwz1.mail.ru/js/code.js"; ts.src = "https://top-fwz1.mail.ru/js/code.js";
var f = function () {var s = d.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ts, s);}; var f = function () {var s = d.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ts, s);};
if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); } if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); }
})(document, window, "tmr-code"); })(document, window, "tmr-code");
</script> </script>
<noscript><div><img src="https://top-fwz1.mail.ru/counter?id=3569464;js=na" style="position:absolute;left:-9999px;" alt="Top.Mail.Ru" /></div></noscript> <noscript><div><img src="https://top-fwz1.mail.ru/counter?id=3569464;js=na" style="position:absolute;left:-9999px;" alt="Top.Mail.Ru" /></div></noscript>
<!-- /Top.Mail.Ru counter --> <!-- /Top.Mail.Ru counter -->
<meta name="yandex-verification" content="2da3f924c37aec09" /> <meta name="yandex-verification" content="2da3f924c37aec09" />
<meta name="yandex-verification" content="2109bb636b61b248" /> <meta name="yandex-verification" content="2109bb636b61b248" />
<meta name="facebook-domain-verification" content="0t1n3h5uw4gdcpc1smgnnceaya7ek9" /> <meta name="facebook-domain-verification" content="0t1n3h5uw4gdcpc1smgnnceaya7ek9" />
<meta name="google-site-verification" content="rHrHfWw6KM9echj8buJwfSPdVJLPECX0uhRTtyRX5F4" /> <meta name="google-site-verification" content="rHrHfWw6KM9echj8buJwfSPdVJLPECX0uhRTtyRX5F4" />
<!-- Google tag (gtag.js) --> <!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-WTY3GTXP5J"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=G-WTY3GTXP5J"></script>
<script async> <script async>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);} function gtag(){dataLayer.push(arguments);}
gtag('js', new Date()); gtag('js', new Date());
gtag('config', 'G-WTY3GTXP5J'); gtag('config', 'G-WTY3GTXP5J');
</script> </script>
<!-- /Google tag (gtag.js) --> <!-- /Google tag (gtag.js) -->
<!-- Yandex.Metrika counter --> <!-- Yandex.Metrika counter -->
{# RU - счетчик #} {# RU - счетчик #}
<script async type="text/javascript" > <script async type="text/javascript" >
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)}; (function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
m[i].l=1*new Date(); m[i].l=1*new Date();
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }} for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)}) k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym"); (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
ym(96481053, "init", { ym(96481053, "init", {
clickmap:true, clickmap:true,
trackLinks:true, trackLinks:true,
accurateTrackBounce:true, accurateTrackBounce:true,
webvisor:true, webvisor:true,
ecommerce:"dataLayer" ecommerce:"dataLayer"
}); });
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
</script> </script>
<noscript><div><img src="https://mc.yandex.ru/watch/96481053" style="position:absolute; left:-9999px;" alt="" /></div></noscript> <noscript><div><img src="https://mc.yandex.ru/watch/96481053" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
{# AE - счетчик #} {# AE - счетчик #}
<script> <script>
(function(w,d,u){ (function(w,d,u){
var s=d.createElement('script');s.async=true;s.src=u+'?'+(Date.now()/60000|0); var s=d.createElement('script');s.async=true;s.src=u+'?'+(Date.now()/60000|0);
var h=d.getElementsByTagName('script')[0];h.parentNode.insertBefore(s,h); var h=d.getElementsByTagName('script')[0];h.parentNode.insertBefore(s,h);
})(window,document,'https://cdn-ru.bitrix24.ru/b33297602/crm/tag/call.tracker.js'); })(window,document,'https://cdn-ru.bitrix24.ru/b33297602/crm/tag/call.tracker.js');
ym(100896819, "init", { ym(100896819, "init", {
clickmap:true, clickmap:true,
trackLinks:true, trackLinks:true,
accurateTrackBounce:true, accurateTrackBounce:true,
webvisor:true webvisor:true
}); });
</script> </script>
<noscript><div><img src="https://mc.yandex.ru/watch/100896819" style="position:absolute; left:-9999px;" alt="" /></div></noscript> <noscript><div><img src="https://mc.yandex.ru/watch/100896819" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter --> <!-- /Yandex.Metrika counter -->
<!-- Meta Pixel Code --> <!-- Meta Pixel Code -->
<script async> <script async>
!function(f,b,e,v,n,t,s) !function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod? {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)}; n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0; n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0]; t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script', s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js'); 'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '1791804684725971'); fbq('init', '1791804684725971');
fbq('track', 'PageView'); fbq('track', 'PageView');
</script> </script>
<noscript> <noscript>
<img height="1" width="1" style="display:none" <img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=1791804684725971&ev=PageView&noscript=1" src="https://www.facebook.com/tr?id=1791804684725971&ev=PageView&noscript=1"
/> />
</noscript> </noscript>
<!-- /Meta Pixel Code --> <!-- /Meta Pixel Code -->
</head> </head>
<body class="{{bodyClass}}"> <body class="{{bodyClass}}">
{% include 'header.twig' %} {% include 'header.twig' %}
<main class="{{ mainClass }}"> <main class="{{ mainClass }}">
{% block content %} {% block content %}
{% endblock %} {% endblock %}
{% include 'modal.twig' %} {% include 'modal.twig' %}
</main> </main>
{% include 'footer.twig' %} {% include 'footer.twig' %}
</div> </div>
{{ function('wp_footer') }} {{ function('wp_footer') }}
</body> </body>
</html> </html>

@ -1,68 +1,68 @@
<div class="modal"> <div class="modal">
<aside class="modal__aside"> <aside class="modal__aside">
<div class="modal__item modal__filter"> <div class="modal__item modal__filter">
<button class="modal__close"> <button class="modal__close">
<img src="{{ current_path }}assets/img/svg/main/black-x.svg" alt=""> <img src="{{ current_path }}assets/img/svg/main/black-x.svg" alt="">
</button> </button>
<div class="modal__header"> <div class="modal__header">
<p class="modal__title">{{ fn ('pll_e', 'Фильтры') }}</p> <p class="modal__title">{{ fn ('pll_e', 'Фильтры') }}</p>
{{sidebar_filters}} {{sidebar_filters}}
</div> </div>
</div> </div>
{% include 'modal/basket.twig' %} {% include 'modal/basket.twig' %}
<div class="modal__item modal__to-know modal__item--no-title"> <div class="modal__item modal__to-know modal__item--no-title">
<button class="modal__close"> <button class="modal__close">
<img src="{{ current_path }}assets/img/svg/main/black-x.svg" alt=""> <img src="{{ current_path }}assets/img/svg/main/black-x.svg" alt="">
</button> </button>
<div class="modal__header"> <div class="modal__header">
<p class="modal__small-title">{{ fn ('pll_e', 'Узнать о поступлении') }}</p> <p class="modal__small-title">{{ fn ('pll_e', 'Узнать о поступлении') }}</p>
<p class="modal__text"> <p class="modal__text">
{{ fn ('pll_e', 'Оставьте свой e-mail, и мы оповестим вас, когда продукт появится') }} {{ fn ('pll_e', 'Оставьте свой e-mail, и мы оповестим вас, когда продукт появится') }}
</p> </p>
<form action="" class="modal__form-sub"> <form action="" class="modal__form-sub">
<div class="label"> <div class="label">
<label for="mail" class="label__title"> <label for="mail" class="label__title">
{{ fn ('pll_e', 'mail') }} {{ fn ('pll_e', 'mail') }}
</label> </label>
</div> </div>
<input type="text" class="form__input" id="mail" placeholder="Email"> <input type="text" class="form__input" id="mail" placeholder="Email">
<div class="checkbox checkbox--small"> <div class="checkbox checkbox--small">
<div class="checkbox__state"></div> <div class="checkbox__state"></div>
<input type="checkbox" name="" id="" class="checkbox__input"> <input type="checkbox" name="" id="" class="checkbox__input">
<label for="" class="checkbox__label"> <label for="" class="checkbox__label">
{{ fn ('pll_e', 'Я ознакомился с <a href="#">политикой обработки персональных данных</a> и <a href="#">пользовательским соглашением') }}</a> {{ fn ('pll_e', 'Я ознакомился с <a href="#">политикой обработки персональных данных</a> и <a href="#">пользовательским соглашением') }}</a>
</label> </label>
</div> </div>
<input type="submit" value="Оставить почту" class="button button--white button--red-48-px button--100-perc active modal-form-sub__submit"> <input type="submit" value="Оставить почту" class="button button--white button--red-48-px button--100-perc active modal-form-sub__submit">
</form> </form>
</div> </div>
</div> </div>
<div class="modal__item modal__to-know-submit modal__item--no-title"> <div class="modal__item modal__to-know-submit modal__item--no-title">
<button class="modal__close"> <button class="modal__close">
<img src="assets/img/svg/main/black-x.svg" alt=""> <img src="assets/img/svg/main/black-x.svg" alt="">
</button> </button>
<div class="modal__header"> <div class="modal__header">
<p class="modal__small-title">{{ fn ('pll_e', 'Подписка на товар оформлена') }}</p> <p class="modal__small-title">{{ fn ('pll_e', 'Подписка на товар оформлена') }}</p>
<p class="modal__text"> <p class="modal__text">
{{ fn ('pll_e', 'На ваш e-mail <span id="email_current"></span> придет письмо, как только продукт появится в наличии.') }} {{ fn ('pll_e', 'На ваш e-mail <span id="email_current"></span> придет письмо, как только продукт появится в наличии.') }}
</p> </p>
<button class="button button--white button--red-48-px button--100-perc active modal-form-sub__submit"> <button class="button button--white button--red-48-px button--100-perc active modal-form-sub__submit">
{{ fn ('pll_e', 'Продолжить покупки') }} {{ fn ('pll_e', 'Продолжить покупки') }}
</button> </button>
</div> </div>
</div> </div>
{% include 'modal/login.twig' %} {% include 'modal/login.twig' %}
</aside> </aside>
</div> </div>

@ -1,44 +1,44 @@
<div id="modal-basket" class="modal__item modal__basket"> <div id="modal-basket" class="modal__item modal__basket">
<button class="modal__close"> <button class="modal__close">
<img src="{{ theme.link }}/static/img/svg/main/black-x.svg" alt="{{ __('Close cart', 'your-theme') }}"> <img src="{{ theme.link }}/static/img/svg/main/black-x.svg" alt="{{ __('Close cart', 'your-theme') }}">
</button> </button>
<div class="modal-basket__loading"> <div class="modal-basket__loading">
<div class="modal-basket__loader"></div> <div class="modal-basket__loader"></div>
</div> </div>
<div class="modal__header"> <div class="modal__header">
<p class="modal__title">{{ __('Cart', 'woocommerce') }}</p> <p class="modal__title">{{ __('Cart', 'woocommerce') }}</p>
<div class="modal__content" id="modal-basket-content"> <div class="modal__content" id="modal-basket-content">
{% include 'shop/cart-contents.twig' %} {% include 'shop/cart-contents.twig' %}
</div> </div>
</div> </div>
<div class="modal__footer" id="modal-basket-footer"> <div class="modal__footer" id="modal-basket-footer">
{% if not fn('WC').cart.is_empty and fn('WC').cart.get_total('raw') > 0 %} {% if not fn('WC').cart.is_empty and fn('WC').cart.get_total('raw') > 0 %}
<div class="modal__block-price"> <div class="modal__block-price">
<p class="modal-block-price__title">{{ __('Total', 'woocommerce') }}</p> <p class="modal-block-price__title">{{ __('Total', 'woocommerce') }}</p>
<p class="modal-block-price__price"> <p class="modal-block-price__price">
{{ fn('wc_cart_totals_order_total_html') }} {{ fn('wc_cart_totals_order_total_html') }}
</p> </p>
</div> </div>
<div class="modal__block-button"> <div class="modal__block-button">
<div class="modal__button"> <div class="modal__button">
<a href="{{ fn('wc_get_checkout_url') }}" class="button button--gradient button--high button--100-perc proceed-to-checkout"> <a href="{{ fn('wc_get_checkout_url') }}" class="button button--gradient button--high button--100-perc proceed-to-checkout">
{{ __('Proceed to checkout', 'woocommerce') }} {{ __('Proceed to checkout', 'woocommerce') }}
</a> </a>
</div> </div>
</div> </div>
{% else %} {% else %}
<div class="modal__block-button"> <div class="modal__block-button">
<a href="/shop/" class="modal__button"> <a href="/shop/" class="modal__button">
<button class="to-know button--100-perc to-know--background-none continue-shopping"> <button class="to-know button--100-perc to-know--background-none continue-shopping">
<p>{{ __('Continue shopping', 'woocommerce') }}</p> <p>{{ __('Continue shopping', 'woocommerce') }}</p>
</button> </button>
</a> </a>
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div> </div>

@ -1,51 +1,51 @@
<div class="modal__item modal__login"> <div class="modal__item modal__login">
<button class="modal__close"> <button class="modal__close">
<img src="<?php bloginfo('template_url');?>/gp-include/assets/core/img/svg/main/black-x.svg" alt=""> <img src="<?php bloginfo('template_url');?>/gp-include/assets/core/img/svg/main/black-x.svg" alt="">
</button> </button>
<div class="login_wrap login_forms"> <div class="login_wrap login_forms">
<div class="login_inner step active"> <div class="login_inner step active">
<h2 class="login_title">Войти или зарегистрироваться</h2> <h2 class="login_title">Войти или зарегистрироваться</h2>
<div class="login_subtitle">Подтвердите свой e-mail в письме</div> <div class="login_subtitle">Подтвердите свой e-mail в письме</div>
<div class="login_input js-input-email"> <div class="login_input js-input-email">
<input type="text" name="email" placeholder="example@example.com"/> <input type="text" name="email" placeholder="example@example.com"/>
<div class="login_error"></div> <div class="login_error"></div>
</div> </div>
<button class="login_btn btn_gradient js-get-code">Получить код</button> <button class="login_btn btn_gradient js-get-code">Получить код</button>
{{ function('tgWidget') }} {{ function('tgWidget') }}
</div> </div>
<div class="login_inner step"> <div class="login_inner step">
<div class="login_back"> <div class="login_back">
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="32" height="32" rx="16" fill="#121212"/><path d="M8.5 16.3633H25" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M8.5 16.3633L14.864 22.7272" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M8.5 16.3633L14.864 9.99932" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg> <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="32" height="32" rx="16" fill="#121212"/><path d="M8.5 16.3633H25" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M8.5 16.3633L14.864 22.7272" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M8.5 16.3633L14.864 9.99932" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
</div> </div>
<h2 class="login_title">Введите код</h2> <h2 class="login_title">Введите код</h2>
<div class="login_subtitle">Код отправленный на e-mail:<span class="sended_email"></span></div> <div class="login_subtitle">Код отправленный на e-mail:<span class="sended_email"></span></div>
<div class="login_input js-input-code"> <div class="login_input js-input-code">
<input type="text" name="code" placeholder="0000"/> <input type="text" name="code" placeholder="0000"/>
<div class="login_error"></div> <div class="login_error"></div>
</div> </div>
<div class="login_timer">Запросить новый код: <span class="seconds">15</span> секунд</div> <div class="login_timer">Запросить новый код: <span class="seconds">15</span> секунд</div>
<button class="login_btn btn_gradient js-repeat-code">Запросить новый код</button> <button class="login_btn btn_gradient js-repeat-code">Запросить новый код</button>
</div> </div>
<div class="login_privacy"> <div class="login_privacy">
Нажимая на кнопку «Получить код», я даю согласие на обработку моих персональных данных в соответствии с <a href="/privacy-policy">политикой обработки персональных данных</a> Нажимая на кнопку «Получить код», я даю согласие на обработку моих персональных данных в соответствии с <a href="/privacy-policy">политикой обработки персональных данных</a>
</div> </div>
</div> </div>
<div class="login_wrap login_success hide"> <div class="login_wrap login_success hide">
<div class="login_inner active"> <div class="login_inner active">
<h2 class="login_title">Спасибо<br />за авторизацию</h2> <h2 class="login_title">Спасибо<br />за авторизацию</h2>
<div class="login_subtitle">Теперь вы можете получать промокоды за покупки.</div> <div class="login_subtitle">Теперь вы можете получать промокоды за покупки.</div>
<img src="<?php bloginfo('template_url');?>/images/people.png" alt=""/> <img src="<?php bloginfo('template_url');?>/images/people.png" alt=""/>
<a href="/my-account" class="login_btn account_link">Заполнить профиль</a> <a href="/my-account" class="login_btn account_link">Заполнить профиль</a>
</div> </div>
</div> </div>
<div class="login_wrap login_auth hide"> <div class="login_wrap login_auth hide">
<div class="login_inner active"> <div class="login_inner active">
<h2 class="login_title --text-center"> <h2 class="login_title --text-center">
Вы вошли в систему</h2> Вы вошли в систему</h2>
<img src="<?php bloginfo('template_url');?>/images/people.png" alt=""/> <img src="<?php bloginfo('template_url');?>/images/people.png" alt=""/>
<a href="/my-account" class="login_btn account_link">Профиль</a> <a href="/my-account" class="login_btn account_link">Профиль</a>
</div> </div>
</div> </div>
</div> </div>

@ -1,10 +1,10 @@
{% set bodyClass = 'bg-white' %} {% set bodyClass = 'bg-white' %}
{% set mainClass = 'wrapper' %} {% set mainClass = 'wrapper' %}
{% extends 'layout.twig' %} {% extends 'layout.twig' %}
{% block content %} {% block content %}
{{ post.content }} {{ post.content }}
{% endblock %} {% endblock %}

@ -1,81 +1,81 @@
<div class="cabinet-card cabinet-card--green"> <div class="cabinet-card cabinet-card--green">
<div class="cabinet-card__content"> <div class="cabinet-card__content">
<div class="cabinet-card__pet"> <div class="cabinet-card__pet">
<div class="cabinet-card-pet__icon"> <div class="cabinet-card-pet__icon">
<div class="cabinet-card-pet-icon__content"> <div class="cabinet-card-pet-icon__content">
<img src="{{ function('get_template_directory_uri') }}/static/img/pet/mini-{{ function('get_field', 'type', pet_id) }}.png" alt=""> <img src="{{ function('get_template_directory_uri') }}/static/img/pet/mini-{{ function('get_field', 'type', pet_id) }}.png" alt="">
</div> </div>
</div> </div>
<p class="cabinet-card-pet__name">{{ function('get_the_title', pet_id) }}</p> <p class="cabinet-card-pet__name">{{ function('get_the_title', pet_id) }}</p>
</div> </div>
<div class="cabinet-card__element"> <div class="cabinet-card__element">
<p class="cabinet-card__label">{{ pll_e('Breed') }}:</p> <p class="cabinet-card__label">{{ pll_e('Breed') }}:</p>
<p class="cabinet-card__text">{{ function('get_field', 'breed', pet_id) }}</p> <p class="cabinet-card__text">{{ function('get_field', 'breed', pet_id) }}</p>
</div> </div>
<div class="cabinet-card__element"> <div class="cabinet-card__element">
<p class="cabinet-card__label">{{ pll_e('Weight') }}:</p> <p class="cabinet-card__label">{{ pll_e('Weight') }}:</p>
<p class="cabinet-card__text"> <p class="cabinet-card__text">
{% set weight_key = function('get_field', 'weight', pet_id) %} {% set weight_key = function('get_field', 'weight', pet_id) %}
{% if weight_key == 'below_1_5' %}{{ pll_e('from 0,5 kg to 1,5 kg') }} {% if weight_key == 'below_1_5' %}{{ pll_e('from 0,5 kg to 1,5 kg') }}
{% elseif weight_key == '1_5-3' %}{{ pll_e('from 1.5 to 3 kg') }} {% elseif weight_key == '1_5-3' %}{{ pll_e('from 1.5 to 3 kg') }}
{% elseif weight_key == '3-5' %}{{ pll_e('from 3 to 5 kg') }} {% elseif weight_key == '3-5' %}{{ pll_e('from 3 to 5 kg') }}
{% elseif weight_key == '5-8' %}{{ pll_e('from 5 to 8 kg') }} {% elseif weight_key == '5-8' %}{{ pll_e('from 5 to 8 kg') }}
{% elseif weight_key == '8-11' %}{{ pll_e('from 8 to 11 kg') }} {% elseif weight_key == '8-11' %}{{ pll_e('from 8 to 11 kg') }}
{% elseif weight_key == '11-15' %}{{ pll_e('from 11 to 15 kg') }} {% elseif weight_key == '11-15' %}{{ pll_e('from 11 to 15 kg') }}
{% elseif weight_key == '15-20' %}{{ pll_e('from 15 to 20 kg') }} {% elseif weight_key == '15-20' %}{{ pll_e('from 15 to 20 kg') }}
{% elseif weight_key == '20-25' %}{{ pll_e('from 20 to 25 kg') }} {% elseif weight_key == '20-25' %}{{ pll_e('from 20 to 25 kg') }}
{% elseif weight_key == '25-35' %}{{ pll_e('from 25 to 35 kg') }} {% elseif weight_key == '25-35' %}{{ pll_e('from 25 to 35 kg') }}
{% elseif weight_key == 'more_35' %}{{ pll_e('More than 35 kg') }} {% elseif weight_key == 'more_35' %}{{ pll_e('More than 35 kg') }}
{% endif %} {% endif %}
</p> </p>
</div> </div>
{% if function('get_field', 'old', pet_id) %} {% if function('get_field', 'old', pet_id) %}
<div class="cabinet-card__element"> <div class="cabinet-card__element">
<p class="cabinet-card__label">{{ pll_e('Age') }}:</p> <p class="cabinet-card__label">{{ pll_e('Age') }}:</p>
<p class="cabinet-card__text"> <p class="cabinet-card__text">
{% set age_key = function('get_field', 'old', pet_id) %} {% set age_key = function('get_field', 'old', pet_id) %}
{% if age_key == 'normal' %}{{ pll_e('Adult (from 1 year to 7 years)') }} {% if age_key == 'normal' %}{{ pll_e('Adult (from 1 year to 7 years)') }}
{% elseif age_key == 'old' %}{{ pll_e('Elderly (from 7 to 12 years)') }} {% elseif age_key == 'old' %}{{ pll_e('Elderly (from 7 to 12 years)') }}
{% elseif age_key == 'very_old' %}{{ pll_e('Aging (12 years and older)') }} {% elseif age_key == 'very_old' %}{{ pll_e('Aging (12 years and older)') }}
{% elseif age_key == 'baby' %}{{ pll_e('Baby (from 0 to 1 year)') }} {% elseif age_key == 'baby' %}{{ pll_e('Baby (from 0 to 1 year)') }}
{% endif %} {% endif %}
</p> </p>
</div> </div>
{% else %} {% else %}
{% set month = function('get_field', 'month', pet_id) %} {% set month = function('get_field', 'month', pet_id) %}
{% set zero = month < 10 ? '0' : '' %} {% set zero = month < 10 ? '0' : '' %}
<div class="cabinet-card__element"> <div class="cabinet-card__element">
<p class="cabinet-card__label">{{ pll_e('Birthday') }}:</p> <p class="cabinet-card__label">{{ pll_e('Birthday') }}:</p>
<p class="cabinet-card__text"> <p class="cabinet-card__text">
{{ function('get_field', 'day', pet_id) }}.{{ zero }}{{ month }}.{{ function('get_field', 'year', pet_id) }} {{ function('get_field', 'day', pet_id) }}.{{ zero }}{{ month }}.{{ function('get_field', 'year', pet_id) }}
</p> </p>
</div> </div>
{% endif %} {% endif %}
<div class="cabinet-card__element"> <div class="cabinet-card__element">
<p class="cabinet-card__label">{{ pll_e('Activity') }}:</p> <p class="cabinet-card__label">{{ pll_e('Activity') }}:</p>
<p class="cabinet-card__text"> <p class="cabinet-card__text">
{% set activity_key = function('get_field', 'activity', pet_id) %} {% set activity_key = function('get_field', 'activity', pet_id) %}
{% if activity_key == 'low' %}{{ pll_e('Low') }} {% if activity_key == 'low' %}{{ pll_e('Low') }}
{% elseif activity_key == 'moderate' %}{{ pll_e('Moderate') }} {% elseif activity_key == 'moderate' %}{{ pll_e('Moderate') }}
{% elseif activity_key == 'high' %}{{ pll_e('High') }} {% elseif activity_key == 'high' %}{{ pll_e('High') }}
{% endif %} {% endif %}
</p> </p>
</div> </div>
{% if function('get_field', 'type', pet_id) == 'cat' and function('get_field', 'sterilized', pet_id) %} {% if function('get_field', 'type', pet_id) == 'cat' and function('get_field', 'sterilized', pet_id) %}
<div class="cabinet-card__element"> <div class="cabinet-card__element">
<p class="cabinet-card__label">{{ pll_e('Sterilized') }}</p> <p class="cabinet-card__label">{{ pll_e('Sterilized') }}</p>
</div> </div>
{% endif %} {% endif %}
<div class="cabinet-card__element"> <div class="cabinet-card__element">
<button class="cabinet-card__button" data-edit="{{ pet_id }}"> <button class="cabinet-card__button" data-edit="{{ pet_id }}">
{{ pll_e('Edit') }} {{ pll_e('Edit') }}
</button> </button>
</div> </div>
</div> </div>
</div> </div>

@ -1,106 +1,106 @@
{% extends 'profile/profile-base.twig' %} {% extends 'profile/profile-base.twig' %}
{% block profile_content%} {% block profile_content%}
<div class="cabinet__orders cabinet-content {% if fn('is_wc_endpoint_url') %}active hide{% endif %}"> <div class="cabinet__orders cabinet-content {% if fn('is_wc_endpoint_url') %}active hide{% endif %}">
<div class="cabinet-card cabinet-card--green-white cabinet__subscription-pc"> <div class="cabinet-card cabinet-card--green-white cabinet__subscription-pc">
<div class="cabinet-card__content"> <div class="cabinet-card__content">
<p class="cabinet-card__title">{{ function('pll_e', 'Feed subscription') }}</p> <p class="cabinet-card__title">{{ function('pll_e', 'Feed subscription') }}</p>
<div class="cabinet-card__element"> <div class="cabinet-card__element">
<p class="cabinet-card__text">{{ function('pll_e', 'Weekly food delivery for your pet') }}</p> <p class="cabinet-card__text">{{ function('pll_e', 'Weekly food delivery for your pet') }}</p>
</div> </div>
<div class="cabinet-card__element"> <div class="cabinet-card__element">
<button class="button button--gradient button--high-46 form-sub__btn">{{ function('pll_e', 'Get details') }}</button> <button class="button button--gradient button--high-46 form-sub__btn">{{ function('pll_e', 'Get details') }}</button>
</div> </div>
</div> </div>
</div> </div>
{% if customer_orders %} {% if customer_orders %}
{% for order in customer_orders %} {% for order in customer_orders %}
{% set meta_data = order.meta_data.order_data %} {% set meta_data = order.meta_data.order_data %}
{% set shipping_address = order.get_address('shipping') %} {% set shipping_address = order.get_address('shipping') %}
<div class="cabinet-card cabinet-card--grey"> <div class="cabinet-card cabinet-card--grey">
<div class="cabinet-card__content"> <div class="cabinet-card__content">
<div class="cabinet-card__order"> <div class="cabinet-card__order">
<div class="cabinet-card-order__header"> <div class="cabinet-card-order__header">
<div class="cabinet-card-order__main"> <div class="cabinet-card-order__main">
<p class="cabinet-card-order-main__date">{{ function('pll_e', 'Order from') }} {{ order.date_created|date('Y.m.d') }}</p> <p class="cabinet-card-order-main__date">{{ function('pll_e', 'Order from') }} {{ order.date_created|date('Y.m.d') }}</p>
<p class="cabinet-card-order-main__number">{{ order.id }}</p> <p class="cabinet-card-order-main__number">{{ order.id }}</p>
</div> </div>
<div class="cabinet-card-order__payment"> <div class="cabinet-card-order__payment">
<p class="cabinet-card-order-payment__title">{{ function('pll_e', 'Summary') }}:</p> <p class="cabinet-card-order-payment__title">{{ function('pll_e', 'Summary') }}:</p>
<p class="cabinet-card-order-payment__price">{{ order.get_total() }}</p> <p class="cabinet-card-order-payment__price">{{ order.get_total() }}</p>
</div> </div>
</div> </div>
<div class="cabinet-card-order__bottom"> <div class="cabinet-card-order__bottom">
<div class="cabinet-card-order__content"> <div class="cabinet-card-order__content">
{% set order_track = meta_data.order_number|default('') %} {% set order_track = meta_data.order_number|default('') %}
<div class="cabinet-card-order__block-detail"> <div class="cabinet-card-order__block-detail">
<div class="cabinet-card-order__detail"> <div class="cabinet-card-order__detail">
<div class="cabinet-card-order-detail__address"> <div class="cabinet-card-order-detail__address">
<p class="cabinet-card-order-detail-address__title">{{ function('pll_e', 'Delivery address') }}</p> <p class="cabinet-card-order-detail-address__title">{{ function('pll_e', 'Delivery address') }}</p>
<p class="cabinet-card-order-detail-address__text"> <p class="cabinet-card-order-detail-address__text">
{% if meta_data.office_code %} {% if meta_data.office_code %}
{{ function('pll_e', 'CDEK shipping point') }}<br> {{ function('pll_e', 'CDEK shipping point') }}<br>
{{ office_name }} {{ office_name }}
{% else %} {% else %}
{{ shipping_address.city }} {{ shipping_address.address_1 }} {{ shipping_address.city }} {{ shipping_address.address_1 }}
{% endif %} {% endif %}
</p> </p>
</div> </div>
<div class="cabinet-card-order-detail__main"> <div class="cabinet-card-order-detail__main">
<div class="cabinet-card-order-detail-main__products"> <div class="cabinet-card-order-detail-main__products">
{% for item in order.get_items %} {% for item in order.get_items %}
{% set product = item.get_product %} {% set product = item.get_product %}
{% set thumbnail = product ? function('wp_get_attachment_image_url', product.get_image_id(), 'woocommerce_thumbnail') : function('wc_placeholder_img_src', 'woocommerce_thumbnail') %} {% set thumbnail = product ? function('wp_get_attachment_image_url', product.get_image_id(), 'woocommerce_thumbnail') : function('wc_placeholder_img_src', 'woocommerce_thumbnail') %}
<div class="cabinet-card-order-detail-main__product"> <div class="cabinet-card-order-detail-main__product">
<img src="{{ thumbnail }}" alt="" class="cabinet-card-order-detail-main-product__img"> <img src="{{ thumbnail }}" alt="" class="cabinet-card-order-detail-main-product__img">
<div class="cabinet-card-order-detail-main-product__content"> <div class="cabinet-card-order-detail-main-product__content">
<div class="cabinet-card-order-detail-main-product__description"> <div class="cabinet-card-order-detail-main-product__description">
<p class="cabinet-card-order-detail-main-product-description__what">{{ item.name }}</p> <p class="cabinet-card-order-detail-main-product-description__what">{{ item.name }}</p>
</div> </div>
<p class="cabinet-card-order-detail-main-product__count">{{ item.quantity }}</p> <p class="cabinet-card-order-detail-main-product__count">{{ item.quantity }}</p>
<p class="cabinet-card-order-detail-main-product__price">{{ item.total }}&nbsp;{{ function('get_woocommerce_currency_symbol', code) }}</p> <p class="cabinet-card-order-detail-main-product__price">{{ item.total }}&nbsp;{{ function('get_woocommerce_currency_symbol', code) }}</p>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
<div class="cabinet-card-order-detail-main__links"> <div class="cabinet-card-order-detail-main__links">
{% if order_track %} {% if order_track %}
<a href="https://www.cdek.ru/ru/tracking/?order_id={{ order_track }}" target="_blank" class="cabinet-card__button cabinet-card-order-detail-main__link"> <a href="https://www.cdek.ru/ru/tracking/?order_id={{ order_track }}" target="_blank" class="cabinet-card__button cabinet-card-order-detail-main__link">
{{ function('pll_e', 'Track order') }} {{ function('pll_e', 'Track order') }}
</a> </a>
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<button class="cabinet-card-order__open-detail">{{ function('pll_e', 'Order details') }}</button> <button class="cabinet-card-order__open-detail">{{ function('pll_e', 'Order details') }}</button>
</div> </div>
<div class="cabinet-card-order__detail-short"> <div class="cabinet-card-order__detail-short">
{% for item in order.get_items %} {% for item in order.get_items %}
{% set product = item.get_product %} {% set product = item.get_product %}
{% set thumbnail = product ? function('wp_get_attachment_image_url', product.get_image_id(), 'woocommerce_thumbnail') : function('wc_placeholder_img_src', 'woocommerce_thumbnail') %} {% set thumbnail = product ? function('wp_get_attachment_image_url', product.get_image_id(), 'woocommerce_thumbnail') : function('wc_placeholder_img_src', 'woocommerce_thumbnail') %}
{% if thumbnail %} {% if thumbnail %}
<a href="{{ product.permalink }}"><img src="{{ thumbnail }}" alt="" class="cabinet-card-order-detail-short__item"></a> <a href="{{ product.permalink }}"><img src="{{ thumbnail }}" alt="" class="cabinet-card-order-detail-short__item"></a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
{% else %} {% else %}
<div class="cabinet-card__no-orders"> <div class="cabinet-card__no-orders">
<div class="cabinet-card-no-orders__element"> <div class="cabinet-card-no-orders__element">
<p class="cabinet-card-no-orders__title">{{ function('pll_e', 'No orders yet') }}</p> <p class="cabinet-card-no-orders__title">{{ function('pll_e', 'No orders yet') }}</p>
</div> </div>
<div class="cabinet-card-no-orders__element"> <div class="cabinet-card-no-orders__element">
<a href="/shop/" class="to-know button--100-perc to-know--background-none"> <a href="/shop/" class="to-know button--100-perc to-know--background-none">
<p>{{ function('pll_e', 'Catalog') }}</p> <p>{{ function('pll_e', 'Catalog') }}</p>
</a> </a>
</div> </div>
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

@ -1,133 +1,133 @@
{% extends 'profile/profile-base.twig' %} {% extends 'profile/profile-base.twig' %}
{% block profile_content %} {% block profile_content %}
<div class="cabinet__orders cabinet__orders--no-cab cabinet-content active hide"> <div class="cabinet__orders cabinet__orders--no-cab cabinet-content active hide">
{% if subscription %} {% if subscription %}
<div class="cabinet-card cabinet-card--grey"> <div class="cabinet-card cabinet-card--grey">
<div class="cabinet-card__content"> <div class="cabinet-card__content">
<div class="cabinet-card__order"> <div class="cabinet-card__order">
<div class="cabinet-card-order__header"> <div class="cabinet-card-order__header">
<div class="cabinet-card-order__main"> <div class="cabinet-card-order__main">
<p class="cabinet-card-order-main__date"> <p class="cabinet-card-order-main__date">
{{ fn('pll_e', 'Подписка №') }} {{ subscription.id }} {{ fn('pll_e', 'Подписка №') }} {{ subscription.id }}
</p> </p>
</div> </div>
</div> </div>
</div> </div>
<div class="subscription"> <div class="subscription">
<div class="subscription__item"> <div class="subscription__item">
<p>{{ fn('pll_e', 'Статус') }}</p> <p>{{ fn('pll_e', 'Статус') }}</p>
<p class="subscription__status--end">{{ subscription.status | capitalize }}</p> <p class="subscription__status--end">{{ subscription.status | capitalize }}</p>
</div> </div>
<div class="subscription__item"> <div class="subscription__item">
<p>{{ fn('pll_e', 'Дата подписки') }}</p> <p>{{ fn('pll_e', 'Дата подписки') }}</p>
<p>{{ subscription.date_created | date('d.m.Y') }}</p> <p>{{ subscription.date_created | date('d.m.Y') }}</p>
</div> </div>
<div class="subscription__item"> <div class="subscription__item">
<p>{{ fn('pll_e', 'Дата последнего заказа') }}</p> <p>{{ fn('pll_e', 'Дата последнего заказа') }}</p>
<p>{{ subscription.last_order_date | date('d.m.Y') }}</p> <p>{{ subscription.last_order_date | date('d.m.Y') }}</p>
</div> </div>
<div class="subscription__item"> <div class="subscription__item">
<p>{{ fn('pll_e', 'Следующий платеж') }}</p> <p>{{ fn('pll_e', 'Следующий платеж') }}</p>
<p>{{ subscription.next_payment_date | date('d.m.Y')}}</p> <p>{{ subscription.next_payment_date | date('d.m.Y')}}</p>
</div> </div>
<div class="subscription__item"> <div class="subscription__item">
<p>{{ fn('pll_e', 'Способ оплаты') }}</p> <p>{{ fn('pll_e', 'Способ оплаты') }}</p>
<p>{{ subscription.payment_method_title}}</p> <p>{{ subscription.payment_method_title}}</p>
</div> </div>
<div class="subscription__item"> <div class="subscription__item">
<div class="subscription__add"> <div class="subscription__add">
<div class="subscription__add-header"> <div class="subscription__add-header">
<p class="subscription__add-title">{{ fn('pll_e', 'Товары:') }}</p> <p class="subscription__add-title">{{ fn('pll_e', 'Товары:') }}</p>
</div> </div>
<div class="subscription__add-content"> <div class="subscription__add-content">
{% for item in subscription.items %} {% for item in subscription.items %}
{% set product = item.product %} {% set product = item.product %}
{% set image_id = product.image_id %} {% set image_id = product.image_id %}
{% set product_permalink = product.id ? fn('get_permalink', product.id) : '' %} {% set product_permalink = product.id ? fn('get_permalink', product.id) : '' %}
{# Debug: Display product ID and permalink for testing #} {# Debug: Display product ID and permalink for testing #}
<p class="debug-info" style="display: none;">Product ID: {{ product.id | default('null') }} | Permalink: {{ product_permalink | default('none') }}</p> <p class="debug-info" style="display: none;">Product ID: {{ product.id | default('null') }} | Permalink: {{ product_permalink | default('none') }}</p>
<div class="cabinet-card-order-detail-main__product subscription__add-product"> <div class="cabinet-card-order-detail-main__product subscription__add-product">
{% if product.id and product_permalink and product_permalink != fn('get_permalink', fn('get_the_ID')) %} {% if product.id and product_permalink and product_permalink != fn('get_permalink', fn('get_the_ID')) %}
<a href="{{ product_permalink }}"> <a href="{{ product_permalink }}">
<img src="{{ image_id | wp_get_attachment_image_src('thumbnail') | default('assets/img/product/mini-card.png') }}" <img src="{{ image_id | wp_get_attachment_image_src('thumbnail') | default('assets/img/product/mini-card.png') }}"
alt="{{ product.name }}" alt="{{ product.name }}"
class="cabinet-card-order-detail-main-product__img"> class="cabinet-card-order-detail-main-product__img">
</a> </a>
{% else %} {% else %}
<img src="{{ image_id | wp_get_attachment_image_src('thumbnail') | default('assets/img/product/mini-card.png') }}" <img src="{{ image_id | wp_get_attachment_image_src('thumbnail') | default('assets/img/product/mini-card.png') }}"
alt="{{ product.name }}" alt="{{ product.name }}"
class="cabinet-card-order-detail-main-product__img"> class="cabinet-card-order-detail-main-product__img">
{% endif %} {% endif %}
<div class="cabinet-card-order-detail-main-product__description"> <div class="cabinet-card-order-detail-main-product__description">
<p class="cabinet-card-order-detail-main-product-description__what">{{ product.name }}</p> <p class="cabinet-card-order-detail-main-product-description__what">{{ product.name }}</p>
<p class="cabinet-card-order-detail-main-product-description__with-what">{{ product.variation_details | default('') }}</p> <p class="cabinet-card-order-detail-main-product-description__with-what">{{ product.variation_details | default('') }}</p>
</div> </div>
<div class="cabinet-card-order-detail-main-product__content"> <div class="cabinet-card-order-detail-main-product__content">
<p class="cabinet-card-order-detail-main-product__count">{{ item.quantity }}</p> <p class="cabinet-card-order-detail-main-product__count">{{ item.quantity }}</p>
<p class="cabinet-card-order-detail-main-product__price">{{ item.total }}</p> <p class="cabinet-card-order-detail-main-product__price">{{ item.total }}</p>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
</div> </div>
<div class="subscription__item"> <div class="subscription__item">
<p>{{ fn('pll_e', 'Сумма') }}</p> <p>{{ fn('pll_e', 'Сумма') }}</p>
<p><span>{{ subscription.total }} {{ subscription.currency }} <small>/ {{ fn('pll_e', 'месяц') }}</small></span></p> <p><span>{{ subscription.total }} {{ subscription.currency }} <small>/ {{ fn('pll_e', 'месяц') }}</small></span></p>
</div> </div>
<div class="subscription__item"> <div class="subscription__item">
<p>{{ fn('pll_e', 'Доставка') }}</p> <p>{{ fn('pll_e', 'Доставка') }}</p>
<p>{{ fn('pll_e', 'Бесплатно') }}</p> <p>{{ fn('pll_e', 'Бесплатно') }}</p>
</div> </div>
<div class="subscription__item"> <div class="subscription__item">
<p>{{ fn('pll_e', 'Итого') }}</p> <p>{{ fn('pll_e', 'Итого') }}</p>
<p><span>{{ subscription.total }} {{ subscription.currency }} <small>/ {{ fn('pll_e', 'месяц') }}</small></span></p> <p><span>{{ subscription.total }} {{ subscription.currency }} <small>/ {{ fn('pll_e', 'месяц') }}</small></span></p>
</div> </div>
<div class="subscription__item"> <div class="subscription__item">
<div class="subscription__add"> <div class="subscription__add">
<div class="subscription__add-header"> <div class="subscription__add-header">
<p class="subscription__add-title">{{ fn('pll_e', 'Доставка:') }}</p> <p class="subscription__add-title">{{ fn('pll_e', 'Доставка:') }}</p>
</div> </div>
<div class="subscription__add-content" data-js-tabs=""> <div class="subscription__add-content" data-js-tabs="">
<form action="" method="post" class="subscription-address-form" data-subscription-id="{{ subscription.id }}"> <form action="" method="post" class="subscription-address-form" data-subscription-id="{{ subscription.id }}">
<div class="modal-form-content__line"> <div class="modal-form-content__line">
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label for="delivery_address" class="label-name modal-form-content-line__element--arrow">{{ fn('pll_e', 'Адрес доставки') }}</label> <label for="delivery_address" class="label-name modal-form-content-line__element--arrow">{{ fn('pll_e', 'Адрес доставки') }}</label>
<input id="delivery_address" class="form__input form-open" type="text" name="address" value="{{ subscription.shipping_address | striptags | default('') }}" placeholder="{{ fn('pll_e', 'Начните вводить адрес') }}" required data-form="form-data"> <input id="delivery_address" class="form__input form-open" type="text" name="address" value="{{ subscription.shipping_address | striptags | default('') }}" placeholder="{{ fn('pll_e', 'Начните вводить адрес') }}" required data-form="form-data">
<span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Адрес введен неверно') }}</span> <span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Адрес введен неверно') }}</span>
</div> </div>
</div> </div>
<div class="modal-form-content__line"> <div class="modal-form-content__line">
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label for="delivery_comment" class="label-name">{{ fn('pll_e', 'Комментарий для доставки') }}</label> <label for="delivery_comment" class="label-name">{{ fn('pll_e', 'Комментарий для доставки') }}</label>
<textarea id="delivery_comment" class="form__input form__input--textarea-72" name="comment" placeholder="{{ fn('pll_e', 'Для службы доставки') }}">{{ subscription.shipping_comment | default('') }}</textarea> <textarea id="delivery_comment" class="form__input form__input--textarea-72" name="comment" placeholder="{{ fn('pll_e', 'Для службы доставки') }}">{{ subscription.shipping_comment | default('') }}</textarea>
<span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Комментарий введен неверно') }}</span> <span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Комментарий введен неверно') }}</span>
</div> </div>
</div> </div>
<input type="hidden" name="subscription_id" value="{{ subscription.id }}"> <input type="hidden" name="subscription_id" value="{{ subscription.id }}">
<input type="hidden" name="address_nonce" value="{{ fn('wp_create_nonce', 'update_subscription_address') }}"> <input type="hidden" name="address_nonce" value="{{ fn('wp_create_nonce', 'update_subscription_address') }}">
<div class="modal-form-content__line"> <div class="modal-form-content__line">
<button type="submit" style="width: 100%;" class="button button--gradient button--high-46">{{ fn('pll_e', 'Сохранить') }}</button> <button type="submit" style="width: 100%;" class="button button--gradient button--high-46">{{ fn('pll_e', 'Сохранить') }}</button>
</div> </div>
<div class="form-message" style="display: none;"></div> <div class="form-message" style="display: none;"></div>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<a href="{{ subscription.cancel_url }}" class="to-know to-know--start button--100-perc to-know--background-none"> <a href="{{ subscription.cancel_url }}" class="to-know to-know--start button--100-perc to-know--background-none">
<p>{{ fn('pll_e', 'Отменить подписку') }}</p> <p>{{ fn('pll_e', 'Отменить подписку') }}</p>
</a> </a>
</div> </div>
</div> </div>
{% else %} {% else %}
<div class="cabinet-card-no-orders__element"> <div class="cabinet-card-no-orders__element">
<p>{{ fn('pll_e', 'Подписка не найдена.') }}</p> <p>{{ fn('pll_e', 'Подписка не найдена.') }}</p>
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% endblock %} {% endblock %}

@ -1,78 +1,78 @@
{% extends 'profile/profile-base.twig' %} {% extends 'profile/profile-base.twig' %}
{% block profile_content %} {% block profile_content %}
<div class="cabinet__orders cabinet__orders--no-cab cabinet-content active hide"> <div class="cabinet__orders cabinet__orders--no-cab cabinet-content active hide">
{% for subscription in subscriptions %} {% for subscription in subscriptions %}
<div class="cabinet-card cabinet-card--grey"> <div class="cabinet-card cabinet-card--grey">
<div class="cabinet-card__content"> <div class="cabinet-card__content">
<div class="cabinet-card__order"> <div class="cabinet-card__order">
<div class="cabinet-card-order__header"> <div class="cabinet-card-order__header">
<div class="cabinet-card-order__main"> <div class="cabinet-card-order__main">
<p class="cabinet-card-order-main__date"> <p class="cabinet-card-order-main__date">
{% if subscription.view_url %} {% if subscription.view_url %}
<a href="{{ subscription.view_url }}">{{ fn('pll_e', 'Подписка от') }} {{ subscription.date_created | date('d.m.Y') }}</a> <a href="{{ subscription.view_url }}">{{ fn('pll_e', 'Подписка от') }} {{ subscription.date_created | date('d.m.Y') }}</a>
{% else %} {% else %}
{{ fn('pll_e', 'Подписка от') }} {{ subscription.date_created | date('d.m.Y') }} {{ fn('pll_e', 'Подписка от') }} {{ subscription.date_created | date('d.m.Y') }}
{% endif %} {% endif %}
</p> </p>
<p class="cabinet-card-order-main__number"> <p class="cabinet-card-order-main__number">
{{ subscription.id }} {{ subscription.id }}
</p> </p>
</div> </div>
<div class="cabinet-card-order__payment"> <div class="cabinet-card-order__payment">
<p class="cabinet-card-order-payment__title">{{ fn('pll_e', 'Сумма:') }}</p> <p class="cabinet-card-order-payment__title">{{ fn('pll_e', 'Сумма:') }}</p>
<p class="cabinet-card-order-payment__price cabinet-card-order-payment__price--add"> <p class="cabinet-card-order-payment__price cabinet-card-order-payment__price--add">
{{ subscription.total }} {{ subscription.currency }} <span>/ {{ subscription.billing_period }}</span> {{ subscription.total }} {{ subscription.currency }} <span>/ {{ subscription.billing_period }}</span>
</p> </p>
</div> </div>
</div> </div>
<div class="cabinet-card-order__content"> <div class="cabinet-card-order__content">
<div class="cabinet-card-order__payment-add"> <div class="cabinet-card-order__payment-add">
<p class="cabinet-card-order__sub-title"> <p class="cabinet-card-order__sub-title">
{{ fn('pll_e', 'Следующий платеж:') }} {{ fn('pll_e', 'Следующий платеж:') }}
</p> </p>
<p class="cabinet-card-order__date"> <p class="cabinet-card-order__date">
{{ subscription.next_payment_date | date('d.m.Y') }} {{ subscription.next_payment_date | date('d.m.Y') }}
</p> </p>
</div> </div>
</div> </div>
<div class="cabinet-card-order__detail-short mt-m-3"> <div class="cabinet-card-order__detail-short mt-m-3">
{% for item in subscription.items %} {% for item in subscription.items %}
{% set product = item.product %} {% set product = item.product %}
{% set image_id = product.image_id %} {% set image_id = product.image_id %}
{% if product.permalink %} {% if product.permalink %}
<a href="{{ product.permalink }}"> <a href="{{ product.permalink }}">
<img src="{{ image_id | wp_get_attachment_image_src('thumbnail') | default('assets/img/product/mini-card.png') }}" <img src="{{ image_id | wp_get_attachment_image_src('thumbnail') | default('assets/img/product/mini-card.png') }}"
alt="{{ product.name }}" alt="{{ product.name }}"
class="cabinet-card-order-detail-short__item"> class="cabinet-card-order-detail-short__item">
</a> </a>
{% else %} {% else %}
<img src="{{ image_id | wp_get_attachment_image_src('thumbnail') | default('assets/img/product/mini-card.png') }}" <img src="{{ image_id | wp_get_attachment_image_src('thumbnail') | default('assets/img/product/mini-card.png') }}"
alt="{{ product.name }}" alt="{{ product.name }}"
class="cabinet-card-order-detail-short__item"> class="cabinet-card-order-detail-short__item">
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
<div class="cabinet-card-order__link"> <div class="cabinet-card-order__link">
{% if subscription.view_url %} {% if subscription.view_url %}
<a href="{{ subscription.view_url }}" class="to-know to-know--start button--100-perc to-know--background-none"> <a href="{{ subscription.view_url }}" class="to-know to-know--start button--100-perc to-know--background-none">
<p>{{ fn('pll_e', 'Детали подписки') }}</p> <p>{{ fn('pll_e', 'Детали подписки') }}</p>
</a> </a>
{% else %} {% else %}
<p class="to-know to-know--start button--100-perc to-know--background-none disabled"> <p class="to-know to-know--start button--100-perc to-know--background-none disabled">
{{ fn('pll_e', 'Детали недоступны') }} {{ fn('pll_e', 'Детали недоступны') }}
</p> </p>
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% else %} {% else %}
<p>{{ fn('pll_e', 'У вас нет активных подписок.') }}</p> <p>{{ fn('pll_e', 'У вас нет активных подписок.') }}</p>
{% endfor %} {% endfor %}
</div> </div>
{% endblock %} {% endblock %}

@ -1,415 +1,415 @@
{% set profile_pg = 1 %} {% set profile_pg = 1 %}
{% extends 'profile/profile-base.twig' %} {% extends 'profile/profile-base.twig' %}
{% block profile_content%} {% block profile_content%}
<div class="cabinet__orders cabinet-content {% if fn('is_wc_endpoint_url') %}active hide{% endif %}"> <div class="cabinet__orders cabinet-content {% if fn('is_wc_endpoint_url') %}active hide{% endif %}">
<div class="cabinet-card cabinet-card--green-white cabinet__subscription-pc"> <div class="cabinet-card cabinet-card--green-white cabinet__subscription-pc">
<div class="cabinet-card__content"> <div class="cabinet-card__content">
<p class="cabinet-card__title">{{ function('pll_e', 'Feed subscription') }}</p> <p class="cabinet-card__title">{{ function('pll_e', 'Feed subscription') }}</p>
<div class="cabinet-card__element"> <div class="cabinet-card__element">
<p class="cabinet-card__text">{{ function('pll_e', 'Weekly food delivery for your pet') }}</p> <p class="cabinet-card__text">{{ function('pll_e', 'Weekly food delivery for your pet') }}</p>
</div> </div>
<div class="cabinet-card__element"> <div class="cabinet-card__element">
<button class="button button--gradient button--high-46 form-sub__btn">{{ function('pll_e', 'Get details') }}</button> <button class="button button--gradient button--high-46 form-sub__btn">{{ function('pll_e', 'Get details') }}</button>
</div> </div>
</div> </div>
</div> </div>
{% if customer_orders %} {% if customer_orders %}
{% for order in customer_orders %} {% for order in customer_orders %}
{% set meta_data = order.meta_data.order_data %} {% set meta_data = order.meta_data.order_data %}
{% set shipping_address = order.get_address('shipping') %} {% set shipping_address = order.get_address('shipping') %}
<div class="cabinet-card cabinet-card--grey"> <div class="cabinet-card cabinet-card--grey">
<div class="cabinet-card__content"> <div class="cabinet-card__content">
<div class="cabinet-card__order"> <div class="cabinet-card__order">
<div class="cabinet-card-order__header"> <div class="cabinet-card-order__header">
<div class="cabinet-card-order__main"> <div class="cabinet-card-order__main">
<p class="cabinet-card-order-main__date">{{ function('pll_e', 'Order from') }} {{ order.date_created|date('Y.m.d') }}</p> <p class="cabinet-card-order-main__date">{{ function('pll_e', 'Order from') }} {{ order.date_created|date('Y.m.d') }}</p>
<p class="cabinet-card-order-main__number">{{ order.id }}</p> <p class="cabinet-card-order-main__number">{{ order.id }}</p>
</div> </div>
<div class="cabinet-card-order__payment"> <div class="cabinet-card-order__payment">
<p class="cabinet-card-order-payment__title">{{ function('pll_e', 'Summary') }}:</p> <p class="cabinet-card-order-payment__title">{{ function('pll_e', 'Summary') }}:</p>
<p class="cabinet-card-order-payment__price">{{ order.get_total() }}</p> <p class="cabinet-card-order-payment__price">{{ order.get_total() }}</p>
</div> </div>
</div> </div>
<div class="cabinet-card-order__bottom"> <div class="cabinet-card-order__bottom">
<div class="cabinet-card-order__content"> <div class="cabinet-card-order__content">
{% set order_track = meta_data.order_number|default('') %} {% set order_track = meta_data.order_number|default('') %}
<div class="cabinet-card-order__block-detail"> <div class="cabinet-card-order__block-detail">
<div class="cabinet-card-order__detail"> <div class="cabinet-card-order__detail">
<div class="cabinet-card-order-detail__address"> <div class="cabinet-card-order-detail__address">
<p class="cabinet-card-order-detail-address__title">{{ function('pll_e', 'Delivery address') }}</p> <p class="cabinet-card-order-detail-address__title">{{ function('pll_e', 'Delivery address') }}</p>
<p class="cabinet-card-order-detail-address__text"> <p class="cabinet-card-order-detail-address__text">
{% if meta_data.office_code %} {% if meta_data.office_code %}
{{ function('pll_e', 'CDEK shipping point') }}<br> {{ function('pll_e', 'CDEK shipping point') }}<br>
{{ office_name }} {{ office_name }}
{% else %} {% else %}
{{ shipping_address.city }} {{ shipping_address.address_1 }} {{ shipping_address.city }} {{ shipping_address.address_1 }}
{% endif %} {% endif %}
</p> </p>
</div> </div>
<div class="cabinet-card-order-detail__main"> <div class="cabinet-card-order-detail__main">
<div class="cabinet-card-order-detail-main__products"> <div class="cabinet-card-order-detail-main__products">
{% for item in order.get_items %} {% for item in order.get_items %}
{% set product = item.get_product %} {% set product = item.get_product %}
{% set thumbnail = product ? function('wp_get_attachment_image_url', product.get_image_id(), 'woocommerce_thumbnail') : function('wc_placeholder_img_src', 'woocommerce_thumbnail') %} {% set thumbnail = product ? function('wp_get_attachment_image_url', product.get_image_id(), 'woocommerce_thumbnail') : function('wc_placeholder_img_src', 'woocommerce_thumbnail') %}
<div class="cabinet-card-order-detail-main__product"> <div class="cabinet-card-order-detail-main__product">
<img src="{{ thumbnail }}" alt="" class="cabinet-card-order-detail-main-product__img"> <img src="{{ thumbnail }}" alt="" class="cabinet-card-order-detail-main-product__img">
<div class="cabinet-card-order-detail-main-product__content"> <div class="cabinet-card-order-detail-main-product__content">
<div class="cabinet-card-order-detail-main-product__description"> <div class="cabinet-card-order-detail-main-product__description">
<p class="cabinet-card-order-detail-main-product-description__what">{{ item.name }}</p> <p class="cabinet-card-order-detail-main-product-description__what">{{ item.name }}</p>
</div> </div>
<p class="cabinet-card-order-detail-main-product__count">{{ item.quantity }}</p> <p class="cabinet-card-order-detail-main-product__count">{{ item.quantity }}</p>
<p class="cabinet-card-order-detail-main-product__price">{{ item.total }}&nbsp;{{ function('get_woocommerce_currency_symbol', code) }}</p> <p class="cabinet-card-order-detail-main-product__price">{{ item.total }}&nbsp;{{ function('get_woocommerce_currency_symbol', code) }}</p>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
<div class="cabinet-card-order-detail-main__links"> <div class="cabinet-card-order-detail-main__links">
{% if order_track %} {% if order_track %}
<a href="https://www.cdek.ru/ru/tracking/?order_id={{ order_track }}" target="_blank" class="cabinet-card__button cabinet-card-order-detail-main__link"> <a href="https://www.cdek.ru/ru/tracking/?order_id={{ order_track }}" target="_blank" class="cabinet-card__button cabinet-card-order-detail-main__link">
{{ function('pll_e', 'Track order') }} {{ function('pll_e', 'Track order') }}
</a> </a>
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<button class="cabinet-card-order__open-detail">{{ function('pll_e', 'Order details') }}</button> <button class="cabinet-card-order__open-detail">{{ function('pll_e', 'Order details') }}</button>
</div> </div>
<div class="cabinet-card-order__detail-short"> <div class="cabinet-card-order__detail-short">
{% for item in order.get_items %} {% for item in order.get_items %}
{% set product = item.get_product %} {% set product = item.get_product %}
{% set thumbnail = product ? function('wp_get_attachment_image_url', product.get_image_id(), 'woocommerce_thumbnail') : function('wc_placeholder_img_src', 'woocommerce_thumbnail') %} {% set thumbnail = product ? function('wp_get_attachment_image_url', product.get_image_id(), 'woocommerce_thumbnail') : function('wc_placeholder_img_src', 'woocommerce_thumbnail') %}
{% if thumbnail %} {% if thumbnail %}
<a href="{{ product.permalink }}"><img src="{{ thumbnail }}" alt="" class="cabinet-card-order-detail-short__item"></a> <a href="{{ product.permalink }}"><img src="{{ thumbnail }}" alt="" class="cabinet-card-order-detail-short__item"></a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
{% else %} {% else %}
<div class="cabinet-card__no-orders"> <div class="cabinet-card__no-orders">
<div class="cabinet-card-no-orders__element"> <div class="cabinet-card-no-orders__element">
<p class="cabinet-card-no-orders__title">{{ function('pll_e', 'No orders yet') }}</p> <p class="cabinet-card-no-orders__title">{{ function('pll_e', 'No orders yet') }}</p>
</div> </div>
<div class="cabinet-card-no-orders__element"> <div class="cabinet-card-no-orders__element">
<a href="/shop/" class="to-know button--100-perc to-know--background-none"> <a href="/shop/" class="to-know button--100-perc to-know--background-none">
<p>{{ function('pll_e', 'Catalog') }}</p> <p>{{ function('pll_e', 'Catalog') }}</p>
</a> </a>
</div> </div>
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
</main> </main>
<div class="modalProfile" id="pet_add_form"> <div class="modalProfile" id="pet_add_form">
<div class="popup-wrap"> <div class="popup-wrap">
<div class="modal-form form__full-mobile modal-form--white modal-form--height-100-phone form-pet active"> <div class="modal-form form__full-mobile modal-form--white modal-form--height-100-phone form-pet active">
<button class="modal-form__close"></button> <button class="modal-form__close"></button>
<p class="modal-form__title">{{ fn('pll_e', 'Добавить питомца') }}</p> <p class="modal-form__title">{{ fn('pll_e', 'Добавить питомца') }}</p>
<form class="modal-form__content" id="add-pet-form" method="post" action=""> <form class="modal-form__content" id="add-pet-form" method="post" action="">
<input type="hidden" name="action" value="add_pet"> <input type="hidden" name="action" value="add_pet">
<div class="modal-form-content__line"> <div class="modal-form-content__line">
<label for="" class="label-name">{{ fn('pll_e', 'Вид животного') }}</label> <label for="" class="label-name">{{ fn('pll_e', 'Вид животного') }}</label>
<div class="form-input__tabs"> <div class="form-input__tabs">
<label for="cat" class="form-input-tabs__button active"> <label for="cat" class="form-input-tabs__button active">
{{ fn('pll_e', 'Кошка') }} {{ fn('pll_e', 'Кошка') }}
<input type="radio" value="cat" checked name="pet" id="cat" class="form-input-tabs__input"> <input type="radio" value="cat" checked name="pet" id="cat" class="form-input-tabs__input">
</label> </label>
<label for="dog" class="form-input-tabs__button"> <label for="dog" class="form-input-tabs__button">
{{ fn('pll_e', 'Собака') }} {{ fn('pll_e', 'Собака') }}
<input type="radio" value="dog" name="pet" id="dog" class="form-input-tabs__input"> <input type="radio" value="dog" name="pet" id="dog" class="form-input-tabs__input">
</label> </label>
</div> </div>
</div> </div>
<div class="modal-form-content__line sterilized"> <div class="modal-form-content__line sterilized">
<label for="" class="label-name">{{ fn('pll_e', 'Стерелизован') }}</label> <label for="" class="label-name">{{ fn('pll_e', 'Стерелизован') }}</label>
<div class="form-input__tabs"> <div class="form-input__tabs">
<label class="form-input-tabs__button active"> <label class="form-input-tabs__button active">
{{ fn('pll_e', 'Да') }} {{ fn('pll_e', 'Да') }}
<input type="radio" value="1" checked name="sterilized" class="form-input-tabs__input"> <input type="radio" value="1" checked name="sterilized" class="form-input-tabs__input">
</label> </label>
<label class="form-input-tabs__button"> <label class="form-input-tabs__button">
{{ fn('pll_e', 'Нет') }} {{ fn('pll_e', 'Нет') }}
<input type="radio" value="0" name="sterilized" class="form-input-tabs__input"> <input type="radio" value="0" name="sterilized" class="form-input-tabs__input">
</label> </label>
</div> </div>
</div> </div>
<div class="modal-form-content__line"> <div class="modal-form-content__line">
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label for="firstname" class="label-name">{{ fn('pll_e', 'Имя') }}</label> <label for="firstname" class="label-name">{{ fn('pll_e', 'Имя') }}</label>
<input id="firstname" class="form__input" type="text" name="name" placeholder="{{ fn('pll_e', 'Имя питомца') }}" required> <input id="firstname" class="form__input" type="text" name="name" placeholder="{{ fn('pll_e', 'Имя питомца') }}" required>
</div> </div>
</div> </div>
<div class="modal-form-content__line"> <div class="modal-form-content__line">
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label for="firstname" class="label-name">{{ fn('pll_e', 'Порода') }}</label> <label for="firstname" class="label-name">{{ fn('pll_e', 'Порода') }}</label>
<input id="firstname" class="form__input" type="text" name="breed" placeholder="{{ fn('pll_e', 'Порода вашего питомца') }}" required> <input id="firstname" class="form__input" type="text" name="breed" placeholder="{{ fn('pll_e', 'Порода вашего питомца') }}" required>
</div> </div>
</div> </div>
<div class="modal-form-content__line"> <div class="modal-form-content__line">
<label for="" class="label-name">{{ fn('pll_e', 'Пол вашего питомца') }}</label> <label for="" class="label-name">{{ fn('pll_e', 'Пол вашего питомца') }}</label>
<div class="form-input__tabs"> <div class="form-input__tabs">
<label for="boy" class="form-input-tabs__button active"> <label for="boy" class="form-input-tabs__button active">
{{ fn('pll_e', 'Мальчик') }} {{ fn('pll_e', 'Мальчик') }}
<input type="radio" value="male" checked name="sex" id="boy" class="form-input-tabs__input"> <input type="radio" value="male" checked name="sex" id="boy" class="form-input-tabs__input">
</label> </label>
<label for="girl" class="form-input-tabs__button"> <label for="girl" class="form-input-tabs__button">
{{ fn('pll_e', 'Девочка') }} {{ fn('pll_e', 'Девочка') }}
<input type="radio" value="female" name="sex" id="girl" class="form-input-tabs__input"> <input type="radio" value="female" name="sex" id="girl" class="form-input-tabs__input">
</label> </label>
</div> </div>
</div> </div>
<div class="modal-form-content__line modal-form-content__line--two"> <div class="modal-form-content__line modal-form-content__line--two">
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label class="label-name">{{ fn('pll_e', 'Вид активности') }}</label> <label class="label-name">{{ fn('pll_e', 'Вид активности') }}</label>
<div class="form-input__list"> <div class="form-input__list">
<div class="form-input-list__input">{{ fn('pll_e', 'Выберите из списка') }}</div> <div class="form-input-list__input">{{ fn('pll_e', 'Выберите из списка') }}</div>
<div class="form-input-list__block-content" style="height: 0px;"> <div class="form-input-list__block-content" style="height: 0px;">
<div class="form-input-list__content"> <div class="form-input-list__content">
<label class="form-input-list__item"> <label class="form-input-list__item">
<p class="form-input-list-item__text">{{ fn('pll_e', 'Низкая') }}</p> <p class="form-input-list-item__text">{{ fn('pll_e', 'Низкая') }}</p>
<input type="radio" required name="activity" value="low" class="v-hidden"> <input type="radio" required name="activity" value="low" class="v-hidden">
<div class="form-input-list-item__box"> <div class="form-input-list-item__box">
<div class="form-input-list-item-box__content"> <div class="form-input-list-item-box__content">
<img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt=""> <img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt="">
</div> </div>
</div> </div>
</label> </label>
<label class="form-input-list__item"> <label class="form-input-list__item">
<p class="form-input-list-item__text">{{ fn('pll_e', 'Средняя') }}</p> <p class="form-input-list-item__text">{{ fn('pll_e', 'Средняя') }}</p>
<input type="radio" required name="activity" value="moderate" class="v-hidden"> <input type="radio" required name="activity" value="moderate" class="v-hidden">
<div class="form-input-list-item__box"> <div class="form-input-list-item__box">
<div class="form-input-list-item-box__content"> <div class="form-input-list-item-box__content">
<img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt=""> <img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt="">
</div> </div>
</div> </div>
</label> </label>
<label class="form-input-list__item"> <label class="form-input-list__item">
<p class="form-input-list-item__text">{{ fn('pll_e', 'Высокая') }}</p> <p class="form-input-list-item__text">{{ fn('pll_e', 'Высокая') }}</p>
<input type="radio" required name="activity" value="high" class="v-hidden"> <input type="radio" required name="activity" value="high" class="v-hidden">
<div class="form-input-list-item__box"> <div class="form-input-list-item__box">
<div class="form-input-list-item-box__content"> <div class="form-input-list-item-box__content">
<img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt=""> <img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt="">
</div> </div>
</div> </div>
</label> </label>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label for="firstname" class="label-name">{{ fn('pll_e', 'Вес') }}</label> <label for="firstname" class="label-name">{{ fn('pll_e', 'Вес') }}</label>
<div class="form-input__list"> <div class="form-input__list">
<div class="form-input-list__input">{{ fn('pll_e', 'Выберите из списка') }}</div> <div class="form-input-list__input">{{ fn('pll_e', 'Выберите из списка') }}</div>
<div class="form-input-list__block-content" style="height: 0px;"> <div class="form-input-list__block-content" style="height: 0px;">
<div class="form-input-list__content"> <div class="form-input-list__content">
{% for weight in [ {% for weight in [
{value: 'below_1_5', text: fn('pll_e', '1-1.5 кг')}, {value: 'below_1_5', text: fn('pll_e', '1-1.5 кг')},
{value: '1_5-3', text: fn('pll_e', '1.5-3 кг')}, {value: '1_5-3', text: fn('pll_e', '1.5-3 кг')},
{value: '3-5', text: fn('pll_e', '3-5 кг')}, {value: '3-5', text: fn('pll_e', '3-5 кг')},
{value: '5-8', text: fn('pll_e', '5-8 кг')}, {value: '5-8', text: fn('pll_e', '5-8 кг')},
{value: '8-11', text: fn('pll_e', '8-11 кг')}, {value: '8-11', text: fn('pll_e', '8-11 кг')},
{value: '11-15', text: fn('pll_e', '11-15 кг')}, {value: '11-15', text: fn('pll_e', '11-15 кг')},
{value: '15-20', text: fn('pll_e', '10-20кг')}, {value: '15-20', text: fn('pll_e', '10-20кг')},
{value: '20-25', text: fn('pll_e', '20-25кг')}, {value: '20-25', text: fn('pll_e', '20-25кг')},
{value: '25-35', text: fn('pll_e', '25-35 кг')}, {value: '25-35', text: fn('pll_e', '25-35 кг')},
{value: 'more_35', text: fn('pll_e', 'Более 35 кг')} {value: 'more_35', text: fn('pll_e', 'Более 35 кг')}
] %} ] %}
<label class="form-input-list__item"> <label class="form-input-list__item">
<p class="form-input-list-item__text">{{ weight.text }}</p> <p class="form-input-list-item__text">{{ weight.text }}</p>
<input type="radio" required name="weight" value="{{ weight.value }}" class="v-hidden"> <input type="radio" required name="weight" value="{{ weight.value }}" class="v-hidden">
<div class="form-input-list-item__box"> <div class="form-input-list-item__box">
<div class="form-input-list-item-box__content"> <div class="form-input-list-item-box__content">
<img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt=""> <img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt="">
</div> </div>
</div> </div>
</label> </label>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="rm"> <div class="rm">
<div class="modal-form-content__line"> <div class="modal-form-content__line">
<label class="label-name">{{ fn('pll_e', 'Возраст питомца') }}</label> <label class="label-name">{{ fn('pll_e', 'Возраст питомца') }}</label>
<div class="form-input__tabs form-input__remote-control" data-content="modal__age"> <div class="form-input__tabs form-input__remote-control" data-content="modal__age">
<label for="exemplary" class="form-input-tabs__button active" data-rm="0"> <label for="exemplary" class="form-input-tabs__button active" data-rm="0">
{{ fn('pll_e', 'Примерный') }} {{ fn('pll_e', 'Примерный') }}
<input type="radio" checked value="ex" name="old_type" required id="exemplary" class="form-input-tabs__input"> <input type="radio" checked value="ex" name="old_type" required id="exemplary" class="form-input-tabs__input">
</label> </label>
<label class="form-input-tabs__button" data-rm="1"> <label class="form-input-tabs__button" data-rm="1">
{{ fn('pll_e', 'Точный') }} {{ fn('pll_e', 'Точный') }}
<input type="radio" value="acc" name="old_type" required id="accurate" class="form-input-tabs__input"> <input type="radio" value="acc" name="old_type" required id="accurate" class="form-input-tabs__input">
</label> </label>
</div> </div>
</div> </div>
<div class="modal__age"> <div class="modal__age">
<div class="form-input__radio remote-control__item active" data-rmcont="0"> <div class="form-input__radio remote-control__item active" data-rmcont="0">
{% for age in [ {% for age in [
{value: 'baby', title: fn('pll_e', 'Малыш'), desc: fn('pll_e', '(от 0 до 1 года)')}, {value: 'baby', title: fn('pll_e', 'Малыш'), desc: fn('pll_e', '(от 0 до 1 года)')},
{value: 'normal', title: fn('pll_e', 'Взрослый'), desc: fn('pll_e', '(от 1 года до 7 лет)')}, {value: 'normal', title: fn('pll_e', 'Взрослый'), desc: fn('pll_e', '(от 1 года до 7 лет)')},
{value: 'old', title: fn('pll_e', 'Пожилой'), desc: fn('pll_e', '(от 7 до 12 лет)')}, {value: 'old', title: fn('pll_e', 'Пожилой'), desc: fn('pll_e', '(от 7 до 12 лет)')},
{value: 'very_old', title: fn('pll_e', 'Стареющий'), desc: fn('pll_e', '(от 12 лет и старше)')} {value: 'very_old', title: fn('pll_e', 'Стареющий'), desc: fn('pll_e', '(от 12 лет и старше)')}
] %} ] %}
<label class="form-input-radio__item {{ loop.first ? 'active' : '' }}"> <label class="form-input-radio__item {{ loop.first ? 'active' : '' }}">
<input type="radio" name="old" value="{{ age.value }}" {{ loop.first ? 'checked' : '' }} class="v-hidden"> <input type="radio" name="old" value="{{ age.value }}" {{ loop.first ? 'checked' : '' }} class="v-hidden">
<div class="form-input-radio__circle"> <div class="form-input-radio__circle">
<div class="form-input-radio-circle__content"></div> <div class="form-input-radio-circle__content"></div>
</div> </div>
<p class="form-input-radio__title">{{ age.title }} <span>{{ age.desc }}</span></p> <p class="form-input-radio__title">{{ age.title }} <span>{{ age.desc }}</span></p>
</label> </label>
{% endfor %} {% endfor %}
</div> </div>
<div data-rmcont="1" class="modal-form-content__line remote-control__item modal-form-content__line--three modal-form-content__line--margin-top-16"> <div data-rmcont="1" class="modal-form-content__line remote-control__item modal-form-content__line--three modal-form-content__line--margin-top-16">
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label for="firstname" class="label-name">{{ fn('pll_e', 'День') }}</label> <label for="firstname" class="label-name">{{ fn('pll_e', 'День') }}</label>
<input id="firstname" class="form__input form__input--center" maxlength="2" type="text" name="day" placeholder="{{ fn('pll_e', 'ДД') }}"> <input id="firstname" class="form__input form__input--center" maxlength="2" type="text" name="day" placeholder="{{ fn('pll_e', 'ДД') }}">
</div> </div>
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label for="firstname" class="label-name">{{ fn('pll_e', 'Месяц') }}</label> <label for="firstname" class="label-name">{{ fn('pll_e', 'Месяц') }}</label>
<div class="form-input__list"> <div class="form-input__list">
<div class="form-input-list__input">{{ fn('pll_e', 'Месяц') }}</div> <div class="form-input-list__input">{{ fn('pll_e', 'Месяц') }}</div>
<div class="form-input-list__block-content"> <div class="form-input-list__block-content">
<div class="form-input-list__content"> <div class="form-input-list__content">
{% for month in [ {% for month in [
{value: 1, text: fn('pll_e', 'Январь')}, {value: 1, text: fn('pll_e', 'Январь')},
{value: 2, text: fn('pll_e', 'Февраль')}, {value: 2, text: fn('pll_e', 'Февраль')},
{value: 3, text: fn('pll_e', 'Март')}, {value: 3, text: fn('pll_e', 'Март')},
{value: 4, text: fn('pll_e', 'Апрель')}, {value: 4, text: fn('pll_e', 'Апрель')},
{value: 5, text: fn('pll_e', 'Май')}, {value: 5, text: fn('pll_e', 'Май')},
{value: 6, text: fn('pll_e', 'Июнь')}, {value: 6, text: fn('pll_e', 'Июнь')},
{value: 7, text: fn('pll_e', 'Июль')}, {value: 7, text: fn('pll_e', 'Июль')},
{value: 8, text: fn('pll_e', 'Август')}, {value: 8, text: fn('pll_e', 'Август')},
{value: 9, text: fn('pll_e', 'Сентябрь')}, {value: 9, text: fn('pll_e', 'Сентябрь')},
{value: 10, text: fn('pll_e', 'Октябрь')}, {value: 10, text: fn('pll_e', 'Октябрь')},
{value: 11, text: fn('pll_e', 'Ноябрь')}, {value: 11, text: fn('pll_e', 'Ноябрь')},
{value: 12, text: fn('pll_e', 'Декабрь')} {value: 12, text: fn('pll_e', 'Декабрь')}
] %} ] %}
<label class="form-input-list__item"> <label class="form-input-list__item">
<p class="form-input-list-item__text">{{ month.text }}</p> <p class="form-input-list-item__text">{{ month.text }}</p>
<input type="radio" name="month" value="{{ month.value }}" class="v-hidden"> <input type="radio" name="month" value="{{ month.value }}" class="v-hidden">
<div class="form-input-list-item__box"> <div class="form-input-list-item__box">
<div class="form-input-list-item-box__content"> <div class="form-input-list-item-box__content">
<img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt=""> <img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt="">
</div> </div>
</div> </div>
</label> </label>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label for="firstname" class="label-name">{{ fn('pll_e', 'Год') }}</label> <label for="firstname" class="label-name">{{ fn('pll_e', 'Год') }}</label>
<input id="firstname" class="form__input form__input--center" maxlength="4" type="text" name="year" placeholder="{{ fn('pll_e', 'ГГГГ') }}"> <input id="firstname" class="form__input form__input--center" maxlength="4" type="text" name="year" placeholder="{{ fn('pll_e', 'ГГГГ') }}">
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal-form__buttons"> <div class="modal-form__buttons">
<button class="button button--gradient button--high button--100-perc" type="submit">{{ fn('pll_e', 'Добавить') }}</button> <button class="button button--gradient button--high button--100-perc" type="submit">{{ fn('pll_e', 'Добавить') }}</button>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
<div class="modalProfile" id="subForm"> <div class="modalProfile" id="subForm">
<div class="popup-wrap"> <div class="popup-wrap">
<div class="modal-form modal__notification modal-form--green-gradient modal-form--width-584 form-sub active"> <div class="modal-form modal__notification modal-form--green-gradient modal-form--width-584 form-sub active">
<button class="modal-form__close modal-form__close--white"></button> <button class="modal-form__close modal-form__close--white"></button>
<p class="modal-form__title modal-form__title--white">Подписка на корм</p> <p class="modal-form__title modal-form__title--white">Подписка на корм</p>
<div class="modal-form__element modal-form__element--top-40"> <div class="modal-form__element modal-form__element--top-40">
<p class="modal-form__text modal-form__text--white"> <p class="modal-form__text modal-form__text--white">
Спасибо за интерес к нашему новому виду услуг, данная функция находится в разработке, если вы хотите узнать первыми о запуске подпишитесь на рассылку. Спасибо за интерес к нашему новому виду услуг, данная функция находится в разработке, если вы хотите узнать первыми о запуске подпишитесь на рассылку.
</p> </p>
</div> </div>
<form class="modal-form__element modal-form__element--top-40 foodSub"> <form class="modal-form__element modal-form__element--top-40 foodSub">
<input type="hidden" name="email" value="{{ user.user_email }}"> <input type="hidden" name="email" value="{{ user.user_email }}">
<input type="hidden" name="action" value="subscription_sub__profile"> <input type="hidden" name="action" value="subscription_sub__profile">
<button class="button form__button-pc button--white button--100-perc open-overlay button--high"> <button class="button form__button-pc button--white button--100-perc open-overlay button--high">
Хочу попробовать первым! Хочу попробовать первым!
</button> </button>
<button class="button form__button-mobile button--white button--100-perc open-overlay button--high"> <button class="button form__button-mobile button--white button--100-perc open-overlay button--high">
Хочу быть первым! Хочу быть первым!
</button> </button>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
<div class="modalProfile" id="user_edit"> <div class="modalProfile" id="user_edit">
<div class="popup-wrap"> <div class="popup-wrap">
<div class="modal-form form__full-mobile modal-form--white modal-form--height-100-phone form-data active"> <div class="modal-form form__full-mobile modal-form--white modal-form--height-100-phone form-data active">
<button class="modal-form__close"></button> <button class="modal-form__close"></button>
<p class="modal-form__title">Изменить мои данные</p> <p class="modal-form__title">Изменить мои данные</p>
<form class="modal-form__content user-edit-form" method="post"> <form class="modal-form__content user-edit-form" method="post">
<input type="hidden" name="action" value="edit_user"> <input type="hidden" name="action" value="edit_user">
<div class="modal-form-content__line modal-form-content__line--two"> <div class="modal-form-content__line modal-form-content__line--two">
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label for="firstname" class="label-name">Имя</label> <label for="firstname" class="label-name">Имя</label>
<input id="firstname" class="form__input" type="text" value="{{ user.user_firstname }}" name="name" placeholder="Ваше имя" required> <input id="firstname" class="form__input" type="text" value="{{ user.user_firstname }}" name="name" placeholder="Ваше имя" required>
<span class="form-input__error form-input__error--absolute">Имя введено неверно</span> <span class="form-input__error form-input__error--absolute">Имя введено неверно</span>
</div> </div>
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label for="lastname" class="label-name">Фамилия</label> <label for="lastname" class="label-name">Фамилия</label>
<input id="lastname" class="form__input" type="text" value="{{ user.user_lastname }}" name="l_name" placeholder="Ваша фамилия" required> <input id="lastname" class="form__input" type="text" value="{{ user.user_lastname }}" name="l_name" placeholder="Ваша фамилия" required>
<span class="form-input__error form-input__error--absolute">Фамилия введена неверно</span> <span class="form-input__error form-input__error--absolute">Фамилия введена неверно</span>
</div> </div>
</div> </div>
<div class="modal-form-content__line"> <div class="modal-form-content__line">
<label class="label-name">Телефон</label> <label class="label-name">Телефон</label>
<div class="form-input__phone"> <div class="form-input__phone">
<input type="text" placeholder="___ ___ ____" id="tel-phone" value="{{ fn('get_user_meta', user.ID, 'billing_phone', true) }}" name="phone" class="form-input-phone__input" required> <input type="text" placeholder="___ ___ ____" id="tel-phone" value="{{ fn('get_user_meta', user.ID, 'billing_phone', true) }}" name="phone" class="form-input-phone__input" required>
<div class="form-input__error form-input__error--absolute">Номер введён неверно</div> <div class="form-input__error form-input__error--absolute">Номер введён неверно</div>
</div> </div>
</div> </div>
<div class="modal-form__buttons modal-form__buttons--two"> <div class="modal-form__buttons modal-form__buttons--two">
<button class="button button--gradient button--high" type="submit">Сохранить</button> <button class="button button--gradient button--high" type="submit">Сохранить</button>
<input type="reset" class="button button--white open-overlay button--high modal-form__button-close" value="Отмена"> <input type="reset" class="button button--white open-overlay button--high modal-form__button-close" value="Отмена">
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

@ -1,81 +1,81 @@
{# Bestsellers Slider Template with Polylang support #} {# Bestsellers Slider Template with Polylang support #}
{% set best = function('get_field', 'best', 'options') %} {% set best = function('get_field', 'best', 'options') %}
{% set currency = function('get_woocommerce_currency_symbol') %} {% set currency = function('get_woocommerce_currency_symbol') %}
<div class="section_wrap"> <div class="section_wrap">
<section class="sellers"> <section class="sellers">
<div class="container"> <div class="container">
<div class="seller_block"> <div class="seller_block">
<div class="sellers_top"> <div class="sellers_top">
<h2 class="sellers_title">{{ function('pll_e', 'BESTSELLERS') }}</h2> <h2 class="sellers_title">{{ function('pll_e', 'BESTSELLERS') }}</h2>
<div class="slider-arrows"> <div class="slider-arrows">
<button class="slider-arrow slider-arrow-prev sellerSlider-prev" aria-label="{{ function('pll_e', 'Previous products') }}"></button> <button class="slider-arrow slider-arrow-prev sellerSlider-prev" aria-label="{{ function('pll_e', 'Previous products') }}"></button>
<button class="slider-arrow slider-arrow-next sellerSlider-next" aria-label="{{ function('pll_e', 'Next products') }}"></button> <button class="slider-arrow slider-arrow-next sellerSlider-next" aria-label="{{ function('pll_e', 'Next products') }}"></button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="container-fluid"> <div class="container-fluid">
<div class="sellers_slider"> <div class="sellers_slider">
<div class="swiper sellerSlider"> <div class="swiper sellerSlider">
<div class="swiper-wrapper"> <div class="swiper-wrapper">
{% if best %} {% if best %}
{% for product_id in best %} {% for product_id in best %}
{% set product = function('wc_get_product', product_id) %} {% set product = function('wc_get_product', product_id) %}
{% if product %} {% if product %}
{% set thumbnail = product.get_image_id() ? function('wp_get_attachment_image_url', product.get_image_id(), 'medium') : function('wc_placeholder_img_src') %} {% set thumbnail = product.get_image_id() ? function('wp_get_attachment_image_url', product.get_image_id(), 'medium') : function('wc_placeholder_img_src') %}
{% set price = product.get_price() ~ ' ' ~ fn('get_woocommerce_currency_symbol') %} {% set price = product.get_price() ~ ' ' ~ fn('get_woocommerce_currency_symbol') %}
{% set has_sale = product.is_on_sale() %} {% set has_sale = product.is_on_sale() %}
{% set regular_price = product.get_regular_price() %} {% set regular_price = product.get_regular_price() %}
{% set sale_price = product.get_sale_price() %} {% set sale_price = product.get_sale_price() %}
<div class="swiper-slide"> <div class="swiper-slide">
<div class="sellers_card"> <div class="sellers_card">
<a href="{{ product.get_permalink() }}" aria-label="{{ function('pll_e', 'View product') }}: {{ product.get_name() }}"> <a href="{{ product.get_permalink() }}" aria-label="{{ function('pll_e', 'View product') }}: {{ product.get_name() }}">
<img src="{{ thumbnail }}" <img src="{{ thumbnail }}"
alt="{{ function('pll_e', 'Product image') }}: {{ product.get_name() }}" alt="{{ function('pll_e', 'Product image') }}: {{ product.get_name() }}"
class="sellers_card-img" class="sellers_card-img"
loading="lazy"> loading="lazy">
</a> </a>
<div class="tags_block"> <div class="tags_block">
<a href="{{ product.get_permalink() }}" class="seller_name"> <a href="{{ product.get_permalink() }}" class="seller_name">
{{ product.get_name() }} {{ product.get_name() }}
</a> </a>
<div class="seller_bt"> <div class="seller_bt">
<div class="seller_price"> <div class="seller_price">
{{ price|raw }} {{ price|raw }}
</div> </div>
</div> </div>
<a href="{{ product.get_permalink() }}" class="seller_link"> <a href="{{ product.get_permalink() }}" class="seller_link">
<button class="seller_buy" aria-label="{{ function('pll_e', 'Buy') }} {{ product.get_name() }}"> <button class="seller_buy" aria-label="{{ function('pll_e', 'Buy') }} {{ product.get_name() }}">
{{ function('pll_e', 'Buy') }} {{ function('pll_e', 'Buy') }}
</button> </button>
</a> </a>
</div> </div>
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% else %} {% else %}
<p class="no-products">{{ function('pll_e', 'No bestsellers found') }}</p> <p class="no-products">{{ function('pll_e', 'No bestsellers found') }}</p>
{% endif %} {% endif %}
</div> </div>
</div> </div>
<div class="seller_full"> <div class="seller_full">
<div class="container"> <div class="container">
<a href="{{ function('wc_get_page_permalink', 'shop') }}" class="seller_full-link"> <a href="{{ function('wc_get_page_permalink', 'shop') }}" class="seller_full-link">
{{ function('pll_e', 'All products') }} {{ function('pll_e', 'All products') }}
</a> </a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</section> </section>
</div> </div>

@ -1,45 +1,45 @@
{% if cart.is_empty %} {% if cart.is_empty %}
<p class="cart-empty">{{ function('pll_e', 'Your cart is empty') }}</p> <p class="cart-empty">{{ function('pll_e', 'Your cart is empty') }}</p>
{% else %} {% else %}
{% for item_key, item in cart.get_cart %} {% for item_key, item in cart.get_cart %}
{% set product = item.data %} {% set product = item.data %}
<div class="modal-basket__item" data-key="{{ item.key }}" data-product_id="{{ item.product_id }}" data-variation_id="{{ item.variation_id }}"> <div class="modal-basket__item" data-key="{{ item.key }}" data-product_id="{{ item.product_id }}" data-variation_id="{{ item.variation_id }}">
<div class="modal-basket-item__block-image"> <div class="modal-basket-item__block-image">
{{ product.get_image }} {{ product.get_image }}
</div> </div>
<div class="modal-basket-item__content"> <div class="modal-basket-item__content">
<p class="modal-basket-item__title">{{ product.get_name }}</p> <p class="modal-basket-item__title">{{ product.get_name }}</p>
<p class="modal-basket-item__sub-title"> <p class="modal-basket-item__sub-title">
{{ fn('wc_get_formatted_cart_item_data', item) }} {{ fn('wc_get_formatted_cart_item_data', item) }}
</p> </p>
<div class="modal-basket-item__control"> <div class="modal-basket-item__control">
<div class="counter counter--small"> <div class="counter counter--small">
<button class="counter__button minus" data-key="{{ item_key }}"> <button class="counter__button minus" data-key="{{ item_key }}">
<img src="{{ theme.link }}/static/img/svg/main/minus.svg" alt="{{ __('Decrease quantity', 'your-theme') }}"> <img src="{{ theme.link }}/static/img/svg/main/minus.svg" alt="{{ __('Decrease quantity', 'your-theme') }}">
</button> </button>
<input type="text" class="counter__input" <input type="text" class="counter__input"
value="{{ item.quantity }}" value="{{ item.quantity }}"
data-key="{{ item_key }}"> data-key="{{ item_key }}">
<button class="counter__button plus" data-key="{{ item_key }}"> <button class="counter__button plus" data-key="{{ item_key }}">
<img src="{{ theme.link }}/static/img/svg/main/plus.svg" alt="{{ __('Increase quantity', 'your-theme') }}"> <img src="{{ theme.link }}/static/img/svg/main/plus.svg" alt="{{ __('Increase quantity', 'your-theme') }}">
</button> </button>
</div> </div>
<p class="modal-basket-item__price"> <p class="modal-basket-item__price">
{{ fn('wc_price', item.line_total + item.line_tax) }} {{ fn('wc_price', item.line_total + item.line_tax) }}
</p> </p>
<button class="remove-item" data-key="{{ item_key }}"> <button class="remove-item" data-key="{{ item_key }}">
<img src="{{ theme.link }}/static/img/svg/main/basket.svg" alt="{{ __('Remove item', 'your-theme') }}"> <img src="{{ theme.link }}/static/img/svg/main/basket.svg" alt="{{ __('Remove item', 'your-theme') }}">
</button> </button>
</div> </div>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
{% endif %} {% endif %}

@ -1,151 +1,151 @@
{# templates/woocommerce/checkout/form-checkout.twig #} {# templates/woocommerce/checkout/form-checkout.twig #}
<form action="" class="checkout woocommerce-checkout"> <form action="" class="checkout woocommerce-checkout">
<div class="order checkout woocommerce-checkout"> <div class="order checkout woocommerce-checkout">
<div id="recipient" class="order__contacts"> <div id="recipient" class="order__contacts">
<div class="order-contacts__header"> <div class="order-contacts__header">
<p class="order__title"> <p class="order__title">
{{ fn('pll_e', 'Контакты получателя') }} {{ fn('pll_e', 'Контакты получателя') }}
</p> </p>
{% if fn('is_user_logged_in') %} {% if fn('is_user_logged_in') %}
<a href="{{ fn('wp_logout_url', fn('wc_get_checkout_url')) }}" class="cabinet-card__button"> <a href="{{ fn('wp_logout_url', fn('wc_get_checkout_url')) }}" class="cabinet-card__button">
{{ fn('pll_e', 'Выйти') }} {{ fn('pll_e', 'Выйти') }}
</a> </a>
{% else %} {% else %}
<button type="button" class="cabinet-card__button login-open"> <button type="button" class="cabinet-card__button login-open">
{{ fn('pll_e', 'Войти') }} {{ fn('pll_e', 'Войти') }}
</button> </button>
{% endif %} {% endif %}
</div> </div>
<div id="acc-error" class="form-input__error"><span class="error-message"></span></div> <div id="acc-error" class="form-input__error"><span class="error-message"></span></div>
<div class="order-contacts__form"> <div class="order-contacts__form">
{{ fn('do_action', 'woocommerce_checkout_billing') }} {{ fn('do_action', 'woocommerce_checkout_billing') }}
</div> </div>
{% set chosen_methods = WC().session.get('chosen_shipping_methods') %} {% set chosen_methods = WC().session.get('chosen_shipping_methods') %}
{% set shipping_method = chosen_methods[0] ? chosen_methods[0] : fn('pll_e', 'Не выбран') %} {% set shipping_method = chosen_methods[0] ? chosen_methods[0] : fn('pll_e', 'Не выбран') %}
<div class="order-contacts__delivery"> <div class="order-contacts__delivery">
<p class="order__title">{{ fn('pll_e', 'Доставка') }}</p> <p class="order__title">{{ fn('pll_e', 'Доставка') }}</p>
<div id="custom-shipping-methods" class="modal-map__control modal-map__control--delivery"></div> <div id="custom-shipping-methods" class="modal-map__control modal-map__control--delivery"></div>
<div class="modal-map__address"> <div class="modal-map__address">
<div data-remote="official_cdek:136" class="shipping-add-info remote-control__item {% if shipping_method == 'official_cdek:136' %}active{% endif %}"> <div data-remote="official_cdek:136" class="shipping-add-info remote-control__item {% if shipping_method == 'official_cdek:136' %}active{% endif %}">
<div class="order-contacts-deliver__item"> <div class="order-contacts-deliver__item">
<div class="modal-form-content-line__element modal-form-content-line__element--arrow"> <div class="modal-form-content-line__element modal-form-content-line__element--arrow">
<label class="label-name">{{ fn('pll_e', 'Пункт выдачи') }}</label> <label class="label-name">{{ fn('pll_e', 'Пункт выдачи') }}</label>
<input id="pvz_inp" class="form__input form__input--grey form-open mandatory input-read" type="text" name="" placeholder="{{ fn('pll_e', 'Выберите пункт выдачи') }}" required="" data-form="form-point" autocomplete="none"> <input id="pvz_inp" class="form__input form__input--grey form-open mandatory input-read" type="text" name="" placeholder="{{ fn('pll_e', 'Выберите пункт выдачи') }}" required="" data-form="form-point" autocomplete="none">
</div> </div>
<div id="pvz-error" class="form-input__error"><span class="error-message"></span></div> <div id="pvz-error" class="form-input__error"><span class="error-message"></span></div>
</div> </div>
</div> </div>
<div data-remote="official_cdek:137" class="shipping-add-info remote-control__item {% if shipping_method == 'official_cdek:137' %}active{% endif %}"> <div data-remote="official_cdek:137" class="shipping-add-info remote-control__item {% if shipping_method == 'official_cdek:137' %}active{% endif %}">
<div class="order-contacts-deliver__item"> <div class="order-contacts-deliver__item">
<div class="modal-form-content-line__element modal-form-content-line__element--arrow"> <div class="modal-form-content-line__element modal-form-content-line__element--arrow">
<label class="label-name">{{ fn('pll_e', 'Адрес доставки') }}</label> <label class="label-name">{{ fn('pll_e', 'Адрес доставки') }}</label>
<input class="form__input form__input--grey form-open mandatory input-read" id="addr_inp" type="text" name="name" placeholder="{{ fn('pll_e', 'Выберите адрес доставки') }}" data-form="form-address" autocomplete="none"> <input class="form__input form__input--grey form-open mandatory input-read" id="addr_inp" type="text" name="name" placeholder="{{ fn('pll_e', 'Выберите адрес доставки') }}" data-form="form-address" autocomplete="none">
</div> </div>
</div> </div>
<div id="adr-error" class="form-input__error"><span class="error-message"></span></div> <div id="adr-error" class="form-input__error"><span class="error-message"></span></div>
<div class="order-contacts-deliver__item"> <div class="order-contacts-deliver__item">
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label for="firstname" class="label-name">{{ fn('pll_e', 'Комментарий для доставки') }}</label> <label for="firstname" class="label-name">{{ fn('pll_e', 'Комментарий для доставки') }}</label>
<textarea id="firstname" class="form__input form__input--textarea-72 form__input--grey" type="text" name="name" placeholder="{{ fn('pll_e', 'Для службы доставки') }}"></textarea> <textarea id="firstname" class="form__input form__input--textarea-72 form__input--grey" type="text" name="name" placeholder="{{ fn('pll_e', 'Для службы доставки') }}"></textarea>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="order__your"> <div class="order__your">
<p class="order__title">{{ fn('pll_e', 'Ваш заказ') }}</p> <p class="order__title">{{ fn('pll_e', 'Ваш заказ') }}</p>
<div class="order-your__products"> <div class="order-your__products">
{% for cart_item_key, cart_item in WC().cart.get_cart() %} {% for cart_item_key, cart_item in WC().cart.get_cart() %}
{% set product = cart_item.data %} {% set product = cart_item.data %}
{% set thumbnail_id = product.get_image_id() %} {% set thumbnail_id = product.get_image_id() %}
{% if product and product.exists() and cart_item.quantity > 0 and fn('apply_filters', 'woocommerce_checkout_cart_item_visible', true, cart_item, cart_item_key) %} {% if product and product.exists() and cart_item.quantity > 0 and fn('apply_filters', 'woocommerce_checkout_cart_item_visible', true, cart_item, cart_item_key) %}
<div class="order-your-products__item"> <div class="order-your-products__item">
<div class="order-your-products__left"> <div class="order-your-products__left">
<img src="{{ fn('wp_get_attachment_url', thumbnail_id) }}" alt="" class="order-your-products__img"> <img src="{{ fn('wp_get_attachment_url', thumbnail_id) }}" alt="" class="order-your-products__img">
<div class="order-your-products__content"> <div class="order-your-products__content">
<a href="{{ product.get_permalink() }}" class="order-your-products__name">{{ product.get_name() }}</a> <a href="{{ product.get_permalink() }}" class="order-your-products__name">{{ product.get_name() }}</a>
</div> </div>
</div> </div>
<div class="order-your-products__right"> <div class="order-your-products__right">
<p class="order-your-products__count"> <p class="order-your-products__count">
{{ cart_item.quantity }} {{ cart_item.quantity }}
</p> </p>
<p class="order-your-products__price"> <p class="order-your-products__price">
{{ fn('apply_filters', 'woocommerce_cart_item_subtotal', WC().cart.get_product_subtotal(product, cart_item.quantity), cart_item, cart_item_key) }} {{ fn('apply_filters', 'woocommerce_cart_item_subtotal', WC().cart.get_product_subtotal(product, cart_item.quantity), cart_item, cart_item_key) }}
</p> </p>
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
<div class="order-your__calculation"> <div class="order-your__calculation">
{{ fn('woocommerce_checkout_coupon_form') }} {{ fn('woocommerce_checkout_coupon_form') }}
<div id="order_review" class="woocommerce-checkout-review-order"> <div id="order_review" class="woocommerce-checkout-review-order">
{{ fn('do_action', 'woocommerce_checkout_order_review') }} {{ fn('do_action', 'woocommerce_checkout_order_review') }}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
<div class="modalProfile" id="address_input"> <div class="modalProfile" id="address_input">
<div class="popup-wrap"> <div class="popup-wrap">
<div class="modal-form form__full-mobile modal-form--white modal-form--height-100-phone form-data active"> <div class="modal-form form__full-mobile modal-form--white modal-form--height-100-phone form-data active">
<button class="modal-form__close"></button> <button class="modal-form__close"></button>
<p class="modal-form__title">{{ fn('pll_e', 'Адрес') }}</p> <p class="modal-form__title">{{ fn('pll_e', 'Адрес') }}</p>
<div class="modal-form__content" method="post" action="/send-telegram.php"> <div class="modal-form__content" method="post" action="/send-telegram.php">
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label for="address" class="label-name">{{ fn('pll_e', 'Адрес') }}</label> <label for="address" class="label-name">{{ fn('pll_e', 'Адрес') }}</label>
<input id="f_address" class="form__input" type="text" placeholder="{{ fn('pll_e', 'Начните вводить ваш адрес') }}" required=""> <input id="f_address" class="form__input" type="text" placeholder="{{ fn('pll_e', 'Начните вводить ваш адрес') }}" required="">
<span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Адрес введен неверно') }}</span> <span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Адрес введен неверно') }}</span>
</div> </div>
<div class="modal-form-content__line modal-form-content__line--two-mobile"> <div class="modal-form-content__line modal-form-content__line--two-mobile">
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label for="apartment" class="label-name">{{ fn('pll_e', 'Квартира') }}</label> <label for="apartment" class="label-name">{{ fn('pll_e', 'Квартира') }}</label>
<input id="f_apartment" class="form__input" type="text" placeholder="{{ fn('pll_e', 'Квартира') }}" required=""> <input id="f_apartment" class="form__input" type="text" placeholder="{{ fn('pll_e', 'Квартира') }}" required="">
<span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Квартира введено неверно') }}</span> <span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Квартира введено неверно') }}</span>
</div> </div>
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label for="floor" class="label-name">{{ fn('pll_e', 'Этаж') }}</label> <label for="floor" class="label-name">{{ fn('pll_e', 'Этаж') }}</label>
<input id="f_floor" class="form__input" type="text" placeholder="{{ fn('pll_e', 'Этаж') }}" required=""> <input id="f_floor" class="form__input" type="text" placeholder="{{ fn('pll_e', 'Этаж') }}" required="">
<span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Этаж введен неверно') }}</span> <span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Этаж введен неверно') }}</span>
</div> </div>
</div> </div>
<div class="modal-form-content__line modal-form-content__line--two-mobile"> <div class="modal-form-content__line modal-form-content__line--two-mobile">
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label for="entrance" class="label-name">{{ fn('pll_e', 'Подъезд') }}</label> <label for="entrance" class="label-name">{{ fn('pll_e', 'Подъезд') }}</label>
<input id="f_entrance" class="form__input" type="text" placeholder="{{ fn('pll_e', 'Подъезд') }}" required=""> <input id="f_entrance" class="form__input" type="text" placeholder="{{ fn('pll_e', 'Подъезд') }}" required="">
<span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Подъезд введен неверно') }}</span> <span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Подъезд введен неверно') }}</span>
</div> </div>
<div class="modal-form-content-line__element"> <div class="modal-form-content-line__element">
<label for="number-phone" class="label-name">{{ fn('pll_e', 'Домофон') }}</label> <label for="number-phone" class="label-name">{{ fn('pll_e', 'Домофон') }}</label>
<input id="f_number-phone" class="form__input" type="text" placeholder="{{ fn('pll_e', 'Код домофона') }}" required=""> <input id="f_number-phone" class="form__input" type="text" placeholder="{{ fn('pll_e', 'Код домофона') }}" required="">
<span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Код домофона введен неверно') }}</span> <span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Код домофона введен неверно') }}</span>
</div> </div>
</div> </div>
<div class="modal-form__buttons"> <div class="modal-form__buttons">
<button class="button button--gradient button--high button--100-perc close-btn"> <button class="button button--gradient button--high button--100-perc close-btn">
<span>{{ fn('pll_e', 'Доставить сюда') }}</span> <span>{{ fn('pll_e', 'Доставить сюда') }}</span>
</button> </button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

@ -1,66 +1,66 @@
<table class="shop_table woocommerce-checkout-review-order-table"> <table class="shop_table woocommerce-checkout-review-order-table">
<tfoot> <tfoot>
<tr class="order-your-calculation__item"> <tr class="order-your-calculation__item">
<th class="order-your-calculation__title">{{ fn('pll_e', 'Товары') }}</th> <th class="order-your-calculation__title">{{ fn('pll_e', 'Товары') }}</th>
<td class="order-your-calculation__value order-your-calculation__value--price">{{ fn('wc_cart_totals_subtotal_html') }}</td> <td class="order-your-calculation__value order-your-calculation__value--price">{{ fn('wc_cart_totals_subtotal_html') }}</td>
</tr> </tr>
{% for code, coupon in fn('WC').cart.get_coupons() %} {% for code, coupon in fn('WC').cart.get_coupons() %}
<tr class="order-your-calculation__item cart-discount coupon-{{ code }}"> <tr class="order-your-calculation__item cart-discount coupon-{{ code }}">
<th class="order-your-calculation__title">{{ fn('wc_cart_totals_coupon_label', coupon) }}</th> <th class="order-your-calculation__title">{{ fn('wc_cart_totals_coupon_label', coupon) }}</th>
<td class="order-your-calculation__value order-your-calculation__value--price order-your-calculation__value--discount">{{ fn('wc_cart_totals_coupon_html', coupon) }}</td> <td class="order-your-calculation__value order-your-calculation__value--price order-your-calculation__value--discount">{{ fn('wc_cart_totals_coupon_html', coupon) }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
{% if fn('WC').cart.needs_shipping() and fn('WC').cart.show_shipping() %} {% if fn('WC').cart.needs_shipping() and fn('WC').cart.show_shipping() %}
{{ action('woocommerce_review_order_before_shipping') }} {{ action('woocommerce_review_order_before_shipping') }}
{{ fn('wc_cart_totals_shipping_html') }} {{ fn('wc_cart_totals_shipping_html') }}
{{ action('woocommerce_review_order_after_shipping') }} {{ action('woocommerce_review_order_after_shipping') }}
{% endif %} {% endif %}
<tr class="order-your-calculation__item"> <tr class="order-your-calculation__item">
<th class="order-your-calculation__title">{{ fn('pll_e', 'Доставка') }}</th> <th class="order-your-calculation__title">{{ fn('pll_e', 'Доставка') }}</th>
{% set chosen_shipping_methods = fn('WC').session.get('chosen_shipping_methods') %} {% set chosen_shipping_methods = fn('WC').session.get('chosen_shipping_methods') %}
{% if not chosen_shipping_methods[0] is defined %} {% if not chosen_shipping_methods[0] is defined %}
<td class="order-your-calculation__description">{{ fn('pll_e', 'Введите адрес доставки') }}</td> <td class="order-your-calculation__description">{{ fn('pll_e', 'Введите адрес доставки') }}</td>
{% else %} {% else %}
<td class="order-your-calculation__value order-your-calculation__value--price">{{ fn('WC').cart.get_shipping_total() }} ₽</td> <td class="order-your-calculation__value order-your-calculation__value--price">{{ fn('WC').cart.get_shipping_total() }} ₽</td>
{% endif %} {% endif %}
</tr> </tr>
{% for fee in fn('WC').cart.get_fees() %} {% for fee in fn('WC').cart.get_fees() %}
<tr class="fee"> <tr class="fee">
<th>{{ fee.name|e }}</th> <th>{{ fee.name|e }}</th>
<td>{{ fn('wc_cart_totals_fee_html', fee) }}</td> <td>{{ fn('wc_cart_totals_fee_html', fee) }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
{% if fn('wc_tax_enabled') and not fn('WC').cart.display_prices_including_tax() %} {% if fn('wc_tax_enabled') and not fn('WC').cart.display_prices_including_tax() %}
{% if 'itemized' == fn('get_option', 'woocommerce_tax_total_display') %} {% if 'itemized' == fn('get_option', 'woocommerce_tax_total_display') %}
{% for code, tax in fn('WC').cart.get_tax_totals() %} {% for code, tax in fn('WC').cart.get_tax_totals() %}
<tr class="tax-rate tax-rate-{{ code }}"> <tr class="tax-rate tax-rate-{{ code }}">
<th>{{ tax.label|e }}</th> <th>{{ tax.label|e }}</th>
<td>{{ tax.formatted_amount|raw }}</td> <td>{{ tax.formatted_amount|raw }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
{% else %} {% else %}
<tr class="tax-total"> <tr class="tax-total">
<th>{{ fn('WC').countries.tax_or_vat()|e }}</th> <th>{{ fn('WC').countries.tax_or_vat()|e }}</th>
<td>{{ fn('wc_cart_totals_taxes_total_html') }}</td> <td>{{ fn('wc_cart_totals_taxes_total_html') }}</td>
</tr> </tr>
{% endif %} {% endif %}
{% endif %} {% endif %}
{{ action('woocommerce_review_order_before_order_total') }} {{ action('woocommerce_review_order_before_order_total') }}
<tr class="order-your-calculation__line"></tr> <tr class="order-your-calculation__line"></tr>
<tr class="order-your-calculation__item"> <tr class="order-your-calculation__item">
<th class="order-your-calculation__result">{{ fn('pll_e', 'Total') }}</th> <th class="order-your-calculation__result">{{ fn('pll_e', 'Total') }}</th>
<td class="order-your-calculation__result order-your-calculation__value--price">{{ fn('wc_cart_totals_order_total_html') }}</td> <td class="order-your-calculation__result order-your-calculation__value--price">{{ fn('wc_cart_totals_order_total_html') }}</td>
</tr> </tr>
{{ action('woocommerce_review_order_after_order_total') }} {{ action('woocommerce_review_order_after_order_total') }}
</tfoot> </tfoot>
</table> </table>

@ -1,63 +1,63 @@
<?php <?php
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
if (is_product()) { if (is_product()) {
include_module('shop'); include_module('shop');
include_component('shop', 'single-product'); include_component('shop', 'single-product');
$context = Timber::get_context(); $context = Timber::get_context();
$post = Timber::get_post(); $post = Timber::get_post();
$context['post'] = $post; $context['post'] = $post;
$context['wc_breadcrumbs'] = array(); $context['wc_breadcrumbs'] = array();
if (function_exists('woocommerce_breadcrumb')) { if (function_exists('woocommerce_breadcrumb')) {
$args = array( $args = array(
'delimiter' => '', 'delimiter' => '',
'wrap_before' => '', 'wrap_before' => '',
'wrap_after' => '', 'wrap_after' => '',
'before' => '', 'before' => '',
'after' => '', 'after' => '',
'home' => _x('Home', 'breadcrumb', 'woocommerce'), 'home' => _x('Home', 'breadcrumb', 'woocommerce'),
); );
$breadcrumbs = new WC_Breadcrumb(); $breadcrumbs = new WC_Breadcrumb();
$breadcrumbs->generate(); $breadcrumbs->generate();
$formatted_breadcrumbs = array(); $formatted_breadcrumbs = array();
foreach ($breadcrumbs->get_breadcrumb() as $crumb) { foreach ($breadcrumbs->get_breadcrumb() as $crumb) {
$formatted_breadcrumbs[] = array( $formatted_breadcrumbs[] = array(
'text' => $crumb[0], 'text' => $crumb[0],
'url' => $crumb[1] 'url' => $crumb[1]
); );
} }
$context['wc_breadcrumbs'] = $formatted_breadcrumbs; $context['wc_breadcrumbs'] = $formatted_breadcrumbs;
} }
$product_id = get_the_ID(); $product_id = get_the_ID();
$product = wc_get_product($product_id); $product = wc_get_product($product_id);
$context['product'] = $product; $context['product'] = $product;
$context['related_products'] = array(); $context['related_products'] = array();
$related_products_ids = wc_get_related_products($product_id, 5); $related_products_ids = wc_get_related_products($product_id, 5);
if ($related_products_ids) { if ($related_products_ids) {
foreach ($related_products_ids as $related_id) { foreach ($related_products_ids as $related_id) {
$related_product = wc_get_product($related_id); $related_product = wc_get_product($related_id);
if ($related_product) { if ($related_product) {
$context['related_products'][] = $related_product; $context['related_products'][] = $related_product;
} }
} }
} }
Timber::render('modules/shop/components/single-product/component-template.twig', $context); Timber::render('modules/shop/components/single-product/component-template.twig', $context);
} }

@ -1,136 +1,136 @@
<?php <?php
/* /*
Template Name: Where to Buy Template Name: Where to Buy
Template Post Type: page Template Post Type: page
*/ */
// Инициализация Timber // Инициализация Timber
$context = Timber::context(); $context = Timber::context();
// Подключение стилей // Подключение стилей
wp_enqueue_style('gp-wtb-style', get_template_directory_uri() . '/gp-include/assets/where-to-buy/css/gp-style-core.css?v=1.14'); wp_enqueue_style('gp-wtb-style', get_template_directory_uri() . '/gp-include/assets/where-to-buy/css/gp-style-core.css?v=1.14');
wp_enqueue_style('gp-wtb-style-dt', get_template_directory_uri() . '/gp-include/assets/where-to-buy/css/gp-style-desktop.css?v=1.22'); wp_enqueue_style('gp-wtb-style-dt', get_template_directory_uri() . '/gp-include/assets/where-to-buy/css/gp-style-desktop.css?v=1.22');
wp_enqueue_style('gp-wtb-style-tb', get_template_directory_uri() . '/gp-include/assets/where-to-buy/css/gp-style-tablet.css?v=1.22'); wp_enqueue_style('gp-wtb-style-tb', get_template_directory_uri() . '/gp-include/assets/where-to-buy/css/gp-style-tablet.css?v=1.22');
wp_enqueue_style('gp-wtb-style-mb', get_template_directory_uri() . '/gp-include/assets/where-to-buy/css/gp-style-mobile.css?v=1.122'); wp_enqueue_style('gp-wtb-style-mb', get_template_directory_uri() . '/gp-include/assets/where-to-buy/css/gp-style-mobile.css?v=1.122');
// Получение данных маркеров из ACF // Получение данных маркеров из ACF
$locations = get_field('location_markers') ?: []; $locations = get_field('location_markers') ?: [];
$acf_locations = array_map(function($location) { $acf_locations = array_map(function($location) {
return [ return [
'title' => $location['title'], 'title' => $location['title'],
'address' => $location['address'], 'address' => $location['address'],
'url' => $location['website'], 'url' => $location['website'],
'latitude' => isset($location['latitude']) ? (float)$location['latitude'] : null, 'latitude' => isset($location['latitude']) ? (float)$location['latitude'] : null,
'longitude' => isset($location['longitude']) ? (float)$location['longitude'] : null 'longitude' => isset($location['longitude']) ? (float)$location['longitude'] : null
]; ];
}, $locations); }, $locations);
// Предопределенные данные локаций // Предопределенные данные локаций
$predefined_locations = [ $predefined_locations = [
[ [
'title' => 'Roots Supermarket', 'title' => 'Roots Supermarket',
'address' => 'Waves Grande, Retail unit 1-2 Shobha Hartland, Dubai DU United Arab Emirates', 'address' => 'Waves Grande, Retail unit 1-2 Shobha Hartland, Dubai DU United Arab Emirates',
'position' => ['lat' => 25.1896, 'lng' => 55.3662], 'position' => ['lat' => 25.1896, 'lng' => 55.3662],
'url' => '' 'url' => ''
], ],
[ [
'title' => 'Pawdy Neighbors', 'title' => 'Pawdy Neighbors',
'address' => 'Souk Al Manzil - Old Town Downtown, Dubai, United Arab Emirates', 'address' => 'Souk Al Manzil - Old Town Downtown, Dubai, United Arab Emirates',
'position' => ['lat' => 25.1915, 'lng' => 55.2758], 'position' => ['lat' => 25.1915, 'lng' => 55.2758],
'url' => '' 'url' => ''
], ],
[ [
'title' => 'The Pet Co', 'title' => 'The Pet Co',
'address' => 'Tower A, Shop 01, Prime Business Centre, JVC, Dubai, UAE', 'address' => 'Tower A, Shop 01, Prime Business Centre, JVC, Dubai, UAE',
'position' => ['lat' => 25.0580, 'lng' => 55.2282], 'position' => ['lat' => 25.0580, 'lng' => 55.2282],
'url' => '' 'url' => ''
], ],
[ [
'title' => 'Ivy Secret Garden', 'title' => 'Ivy Secret Garden',
'address' => 'Al Wasl Warehouse Complex, Unit 14 - 26th St - Al Quoz Industrial Area 4 - Dubai', 'address' => 'Al Wasl Warehouse Complex, Unit 14 - 26th St - Al Quoz Industrial Area 4 - Dubai',
'position' => ['lat' => 25.1416, 'lng' => 55.2358], 'position' => ['lat' => 25.1416, 'lng' => 55.2358],
'url' => '' 'url' => ''
], ],
[ [
'title' => 'Petzone', 'title' => 'Petzone',
'address' => 'Petzone Sheikh Zayed Road - Petzone Umm Suqeim', 'address' => 'Petzone Sheikh Zayed Road - Petzone Umm Suqeim',
'position' => ['lat' => 25.1530, 'lng' => 55.2145], 'position' => ['lat' => 25.1530, 'lng' => 55.2145],
'url' => 'https://petzone.com/uae/en/' 'url' => 'https://petzone.com/uae/en/'
], ],
[ [
'title' => 'Pet Corner', 'title' => 'Pet Corner',
'address' => 'Pet Corner Sheikh Zayed Road, Al Fardan Building 1, Sheikh Zayed Road, Next to Deals on Wheels & Business Bay Metro Station', 'address' => 'Pet Corner Sheikh Zayed Road, Al Fardan Building 1, Sheikh Zayed Road, Next to Deals on Wheels & Business Bay Metro Station',
'position' => ['lat' => 25.1868, 'lng' => 55.2527], 'position' => ['lat' => 25.1868, 'lng' => 55.2527],
'url' => 'https://petcornerdubai.com/' 'url' => 'https://petcornerdubai.com/'
], ],
[ [
'title' => 'Pet Corner Motor City - Dubai', 'title' => 'Pet Corner Motor City - Dubai',
'address' => 'Unit R7, Fox Hill 8, Motor City, Opposite Arabian Ranches', 'address' => 'Unit R7, Fox Hill 8, Motor City, Opposite Arabian Ranches',
'position' => ['lat' => 25.0499, 'lng' => 55.2350], 'position' => ['lat' => 25.0499, 'lng' => 55.2350],
'url' => '' 'url' => ''
], ],
[ [
'title' => 'Pet Corner Jumeirah Golf Estates - Dubai', 'title' => 'Pet Corner Jumeirah Golf Estates - Dubai',
'address' => 'Shop No. 7, The Fairway Mall Jumeirah Golf Estates Dubai', 'address' => 'Shop No. 7, The Fairway Mall Jumeirah Golf Estates Dubai',
'position' => ['lat' => 25.0394, 'lng' => 55.2269], 'position' => ['lat' => 25.0394, 'lng' => 55.2269],
'url' => '' 'url' => ''
], ],
[ [
'title' => 'Pet Corner Khalifa City - Abu Dhabi', 'title' => 'Pet Corner Khalifa City - Abu Dhabi',
'address' => 'Shop No 5, Al Raha Gardens, Khalifa City Abu Dhabi', 'address' => 'Shop No 5, Al Raha Gardens, Khalifa City Abu Dhabi',
'position' => ['lat' => 24.4243, 'lng' => 54.5754], 'position' => ['lat' => 24.4243, 'lng' => 54.5754],
'url' => '' 'url' => ''
], ],
[ [
'title' => 'Pet Corner- Sharjah Al Mamsha', 'title' => 'Pet Corner- Sharjah Al Mamsha',
'address' => 'Al Sharjah, University Road', 'address' => 'Al Sharjah, University Road',
'position' => ['lat' => 25.3126, 'lng' => 55.4783], 'position' => ['lat' => 25.3126, 'lng' => 55.4783],
'url' => '' 'url' => ''
], ],
[ [
'title' => 'Pet Corner Fujairah- Lulu Mall', 'title' => 'Pet Corner Fujairah- Lulu Mall',
'address' => 'Al - Korthabah Road - Fujairah City Center - Fujairah', 'address' => 'Al - Korthabah Road - Fujairah City Center - Fujairah',
'position' => ['lat' => 25.1221, 'lng' => 56.3244], 'position' => ['lat' => 25.1221, 'lng' => 56.3244],
'url' => '' 'url' => ''
], ],
[ [
'title' => 'Tail Waggin Al Quoz', 'title' => 'Tail Waggin Al Quoz',
'address' => 'Warehouse 7, Street 8, Al Khail Road, Al Quoz 1, Dubai, United Arab Emirates', 'address' => 'Warehouse 7, Street 8, Al Khail Road, Al Quoz 1, Dubai, United Arab Emirates',
'position' => ['lat' => 25.1368, 'lng' => 55.2364], 'position' => ['lat' => 25.1368, 'lng' => 55.2364],
'url' => '' 'url' => ''
], ],
[ [
'title' => "Tail Waggin' Pet Spa Dubai Hills", 'title' => "Tail Waggin' Pet Spa Dubai Hills",
'address' => 'SWAY Residences, Retail 2 - near Kings College Hospital Dubai Hills Estate - Dubai - United Arab Emirates', 'address' => 'SWAY Residences, Retail 2 - near Kings College Hospital Dubai Hills Estate - Dubai - United Arab Emirates',
'position' => ['lat' => 25.1276, 'lng' => 55.2714], 'position' => ['lat' => 25.1276, 'lng' => 55.2714],
'url' => '' 'url' => ''
], ],
[ [
'title' => 'Goofy Groom', 'title' => 'Goofy Groom',
'address' => 'Dubai, UAE Midtown Central Majan, Shop G-17', 'address' => 'Dubai, UAE Midtown Central Majan, Shop G-17',
'position' => ['lat' => 25.0834, 'lng' => 55.1743], 'position' => ['lat' => 25.0834, 'lng' => 55.1743],
'url' => '' 'url' => ''
] ]
]; ];
// Получение изображений из галереи ACF // Получение изображений из галереи ACF
$partners_logos = get_field('partners_logos') ?: []; $partners_logos = get_field('partners_logos') ?: [];
$partners_logos_formatted = array_map(function($image) { $partners_logos_formatted = array_map(function($image) {
return [ return [
'url' => esc_url($image['title']), 'url' => esc_url($image['title']),
'src' => esc_url($image['sizes']['medium']), 'src' => esc_url($image['sizes']['medium']),
'alt' => esc_attr($image['alt']) 'alt' => esc_attr($image['alt'])
]; ];
}, $partners_logos); }, $partners_logos);
// Добавление данных в контекст // Добавление данных в контекст
$context['acf_locations'] = $acf_locations; $context['acf_locations'] = $acf_locations;
$context['predefined_locations'] = $predefined_locations; $context['predefined_locations'] = $predefined_locations;
$context['partners_logos'] = $partners_logos_formatted; $context['partners_logos'] = $partners_logos_formatted;
// Отключение автопараграфов для Contact Form 7 // Отключение автопараграфов для Contact Form 7
add_filter('wpcf7_autop_or_not', '__return_false'); add_filter('wpcf7_autop_or_not', '__return_false');
// Рендеринг шаблона // Рендеринг шаблона
Timber::render('templates/where_to_buy/wtb.twig', $context); Timber::render('templates/where_to_buy/wtb.twig', $context);
?> ?>

@ -1,9 +1,9 @@
{% for post in posts %} {% for post in posts %}
{% include '/woocommerce/archive-product/archive-product-tease.twig' with {post: post} %} {% include '/woocommerce/archive-product/archive-product-tease.twig' with {post: post} %}
{% endfor %} {% endfor %}
{% if not ended %} {% if not ended %}
<button class="button button--white" id="load-more-products" data-category_id="{{ get_category }}" data-category_type="{{ get_category_type }}"> <button class="button button--white" id="load-more-products" data-category_id="{{ get_category }}" data-category_type="{{ get_category_type }}">
{{ function('pll_e', 'Загрузить еще') }} {{ function('pll_e', 'Загрузить еще') }}
</button> </button>
{% endif %} {% endif %}

@ -1,221 +1,221 @@
{# <div class="modal"> {# <div class="modal">
<aside class="modal__aside"> <aside class="modal__aside">
<div class="modal__item modal__filter"> <div class="modal__item modal__filter">
<button class="modal__close"> <button class="modal__close">
<img src="assets/img/svg/main/black-x.svg" alt=""> <img src="assets/img/svg/main/black-x.svg" alt="">
</button> </button>
<div class="modal__header"> <div class="modal__header">
<p class="modal__title">Фильтры</p> <p class="modal__title">Фильтры</p>
{{sidebar_filters}} {{sidebar_filters}}
</div> </div>
</div> </div>
<div class="modal__item modal__basket"> <div class="modal__item modal__basket">
<button class="modal__close"> <button class="modal__close">
<img src="assets/img/svg/main/black-x.svg" alt=""> <img src="assets/img/svg/main/black-x.svg" alt="">
</button> </button>
<div class="modal__header"> <div class="modal__header">
<p class="modal__title">Корзина</p> <p class="modal__title">Корзина</p>
<div class="modal__content"> <div class="modal__content">
<div class="modal-basket__item modal-basket__item--return"> <div class="modal-basket__item modal-basket__item--return">
<p class="modal-basket-item__title"> <p class="modal-basket-item__title">
Удаление товра из корзины: 5с Удаление товра из корзины: 5с
</p> </p>
<button class="modal-basket-item__return"> <button class="modal-basket-item__return">
Восстановить Восстановить
</button> </button>
</div> </div>
<div class="modal-basket__item"> <div class="modal-basket__item">
<div class="modal-basket-item__block-image"> <div class="modal-basket-item__block-image">
<img src="assets/img/product/image.png" alt="" class="modal-basket-item__image"> <img src="assets/img/product/image.png" alt="" class="modal-basket-item__image">
</div> </div>
<div class="modal-basket-item__content"> <div class="modal-basket-item__content">
<p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p> <p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p>
<p class="modal-basket-item__sub-title">Индейка, 2 кг</p> <p class="modal-basket-item__sub-title">Индейка, 2 кг</p>
<div class="modal-basket-item__control"> <div class="modal-basket-item__control">
<div class="counter counter--small"> <div class="counter counter--small">
<button class="counter__button minus"> <button class="counter__button minus">
<img src="assets/img/svg/main/minus.svg" alt=""> <img src="assets/img/svg/main/minus.svg" alt="">
</button> </button>
<input type="text" class="counter__input" value="1"> <input type="text" class="counter__input" value="1">
<button class="counter__button plus"> <button class="counter__button plus">
<img src="assets/img/svg/main/plus.svg" alt=""> <img src="assets/img/svg/main/plus.svg" alt="">
</button> </button>
</div> </div>
<p class="modal-basket-item__price">1280</p> <p class="modal-basket-item__price">1280</p>
</div> </div>
</div> </div>
</div> </div>
<div class="modal-basket__item"> <div class="modal-basket__item">
<div class="modal-basket-item__block-image"> <div class="modal-basket-item__block-image">
<img src="assets/img/product/image.png" alt="" class="modal-basket-item__image"> <img src="assets/img/product/image.png" alt="" class="modal-basket-item__image">
</div> </div>
<div class="modal-basket-item__content"> <div class="modal-basket-item__content">
<p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p> <p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p>
<p class="modal-basket-item__sub-title">Индейка, 2 кг</p> <p class="modal-basket-item__sub-title">Индейка, 2 кг</p>
<div class="modal-basket-item__control"> <div class="modal-basket-item__control">
<div class="counter counter--small"> <div class="counter counter--small">
<button class="counter__button minus"> <button class="counter__button minus">
<img src="assets/img/svg/main/minus.svg" alt=""> <img src="assets/img/svg/main/minus.svg" alt="">
</button> </button>
<input type="text" class="counter__input" value="1"> <input type="text" class="counter__input" value="1">
<button class="counter__button plus"> <button class="counter__button plus">
<img src="assets/img/svg/main/plus.svg" alt=""> <img src="assets/img/svg/main/plus.svg" alt="">
</button> </button>
</div> </div>
<p class="modal-basket-item__price">1280</p> <p class="modal-basket-item__price">1280</p>
</div> </div>
</div> </div>
</div> </div>
<div class="modal-basket__item"> <div class="modal-basket__item">
<div class="modal-basket-item__block-image"> <div class="modal-basket-item__block-image">
<img src="assets/img/product/image.png" alt="" class="modal-basket-item__image"> <img src="assets/img/product/image.png" alt="" class="modal-basket-item__image">
</div> </div>
<div class="modal-basket-item__content"> <div class="modal-basket-item__content">
<p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p> <p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p>
<p class="modal-basket-item__sub-title">Индейка, 2 кг</p> <p class="modal-basket-item__sub-title">Индейка, 2 кг</p>
<div class="modal-basket-item__control"> <div class="modal-basket-item__control">
<div class="counter counter--small"> <div class="counter counter--small">
<button class="counter__button minus"> <button class="counter__button minus">
<img src="assets/img/svg/main/minus.svg" alt=""> <img src="assets/img/svg/main/minus.svg" alt="">
</button> </button>
<input type="text" class="counter__input" value="1"> <input type="text" class="counter__input" value="1">
<button class="counter__button plus"> <button class="counter__button plus">
<img src="assets/img/svg/main/plus.svg" alt=""> <img src="assets/img/svg/main/plus.svg" alt="">
</button> </button>
</div> </div>
<p class="modal-basket-item__price">1280</p> <p class="modal-basket-item__price">1280</p>
</div> </div>
</div> </div>
</div> </div>
<div class="modal-basket__item"> <div class="modal-basket__item">
<div class="modal-basket-item__block-image"> <div class="modal-basket-item__block-image">
<img src="assets/img/product/image.png" alt="" class="modal-basket-item__image"> <img src="assets/img/product/image.png" alt="" class="modal-basket-item__image">
</div> </div>
<div class="modal-basket-item__content"> <div class="modal-basket-item__content">
<p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p> <p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p>
<p class="modal-basket-item__sub-title">Индейка, 2 кг</p> <p class="modal-basket-item__sub-title">Индейка, 2 кг</p>
<div class="modal-basket-item__control"> <div class="modal-basket-item__control">
<div class="counter counter--small"> <div class="counter counter--small">
<button class="counter__button minus"> <button class="counter__button minus">
<img src="assets/img/svg/main/minus.svg" alt=""> <img src="assets/img/svg/main/minus.svg" alt="">
</button> </button>
<input type="text" class="counter__input" value="1"> <input type="text" class="counter__input" value="1">
<button class="counter__button plus"> <button class="counter__button plus">
<img src="assets/img/svg/main/plus.svg" alt=""> <img src="assets/img/svg/main/plus.svg" alt="">
</button> </button>
</div> </div>
<p class="modal-basket-item__price">1280</p> <p class="modal-basket-item__price">1280</p>
</div> </div>
</div> </div>
</div> </div>
<div class="modal-basket__item"> <div class="modal-basket__item">
<div class="modal-basket-item__block-image"> <div class="modal-basket-item__block-image">
<img src="assets/img/product/image.png" alt="" class="modal-basket-item__image"> <img src="assets/img/product/image.png" alt="" class="modal-basket-item__image">
</div> </div>
<div class="modal-basket-item__content"> <div class="modal-basket-item__content">
<p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p> <p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p>
<p class="modal-basket-item__sub-title">Индейка, 2 кг</p> <p class="modal-basket-item__sub-title">Индейка, 2 кг</p>
<div class="modal-basket-item__control"> <div class="modal-basket-item__control">
<div class="counter counter--small"> <div class="counter counter--small">
<button class="counter__button minus"> <button class="counter__button minus">
<img src="assets/img/svg/main/minus.svg" alt=""> <img src="assets/img/svg/main/minus.svg" alt="">
</button> </button>
<input type="text" class="counter__input" value="1"> <input type="text" class="counter__input" value="1">
<button class="counter__button plus"> <button class="counter__button plus">
<img src="assets/img/svg/main/plus.svg" alt=""> <img src="assets/img/svg/main/plus.svg" alt="">
</button> </button>
</div> </div>
<p class="modal-basket-item__price">1280</p> <p class="modal-basket-item__price">1280</p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal__footer"> <div class="modal__footer">
<div class="modal__block-price"> <div class="modal__block-price">
<p class="modal-block-price__title">Общая стоимость</p> <p class="modal-block-price__title">Общая стоимость</p>
<p class="modal-block-price__price"> <p class="modal-block-price__price">
8960 8960
</p> </p>
</div> </div>
<div class="modal__block-button"> <div class="modal__block-button">
<div class="modal__button"> <div class="modal__button">
<button class="button button--gradient button--high button--100-perc"> <button class="button button--gradient button--high button--100-perc">
Перейти к оформлению Перейти к оформлению
</button> </button>
</div> </div>
<div class="modal__button"> <div class="modal__button">
<button class="to-know button--100-perc to-know--background-none"> <button class="to-know button--100-perc to-know--background-none">
<p>Продолжить покупку</p> <p>Продолжить покупку</p>
</button> </button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal__item modal__to-know modal__item--no-title"> <div class="modal__item modal__to-know modal__item--no-title">
<button class="modal__close"> <button class="modal__close">
<img src="assets/img/svg/main/black-x.svg" alt=""> <img src="assets/img/svg/main/black-x.svg" alt="">
</button> </button>
<div class="modal__header"> <div class="modal__header">
<p class="modal__small-title">Узнать о поступлении</p> <p class="modal__small-title">Узнать о поступлении</p>
<p class="modal__text"> <p class="modal__text">
Оставьте свой e-mail, и мы оповестим вас, когда продукт появится Оставьте свой e-mail, и мы оповестим вас, когда продукт появится
</p> </p>
<form action="" class="modal__form-sub"> <form action="" class="modal__form-sub">
<div class="label"> <div class="label">
<label for="mail" class="label__title"> <label for="mail" class="label__title">
mail mail
</label> </label>
<div class="label__question"> <div class="label__question">
text <br> text <br>
re re
</div> </div>
</div> </div>
<input type="text" class="form__input" id="mail" placeholder="Email"> <input type="text" class="form__input" id="mail" placeholder="Email">
<div class="checkbox checkbox--small"> <div class="checkbox checkbox--small">
<div class="checkbox__state"></div> <div class="checkbox__state"></div>
<input type="checkbox" name="" id="" class="checkbox__input"> <input type="checkbox" name="" id="" class="checkbox__input">
<label for="" class="checkbox__label"> <label for="" class="checkbox__label">
Я ознакомился с <a href="#">политикой обработки персональных данных</a> и <a href="#">пользовательским соглашением</a> Я ознакомился с <a href="#">политикой обработки персональных данных</a> и <a href="#">пользовательским соглашением</a>
</label> </label>
</div> </div>
<input type="submit" value="Оставить почту" class="button button--white button--red-48-px button--100-perc active modal-form-sub__submit"> <input type="submit" value="Оставить почту" class="button button--white button--red-48-px button--100-perc active modal-form-sub__submit">
</form> </form>
</div> </div>
</div> </div>
<div class="modal__item modal__to-know-submit modal__item--no-title"> <div class="modal__item modal__to-know-submit modal__item--no-title">
<button class="modal__close"> <button class="modal__close">
<img src="assets/img/svg/main/black-x.svg" alt=""> <img src="assets/img/svg/main/black-x.svg" alt="">
</button> </button>
<div class="modal__header"> <div class="modal__header">
<p class="modal__small-title">Подписка на товар оформлена</p> <p class="modal__small-title">Подписка на товар оформлена</p>
<p class="modal__text"> <p class="modal__text">
На ваш e-mail ivan.ivanov@gmail.com придет письмо, как только продукт появится в наличии. На ваш e-mail ivan.ivanov@gmail.com придет письмо, как только продукт появится в наличии.
</p> </p>
<button class="button button--white button--red-48-px button--100-perc active modal-form-sub__submit"> <button class="button button--white button--red-48-px button--100-perc active modal-form-sub__submit">
Продолжить покупки Продолжить покупки
</button> </button>
</div> </div>
</div> </div>
</aside> </aside>
</div> #} </div> #}

@ -1,121 +1,121 @@
{% if post.id is defined and post.id %} {% if post.id is defined and post.id %}
{% set cur_product = fn('wc_get_product', post.id) %} {% set cur_product = fn('wc_get_product', post.id) %}
{% set attrs = post.product.get_attributes() %} {% set attrs = post.product.get_attributes() %}
{% set cur_weight = function('get_product_info', post.id, 'weight') %} {% set cur_weight = function('get_product_info', post.id, 'weight') %}
<div class="product__item"> <div class="product__item">
<div class="product-item__label"> <div class="product-item__label">
{% if post.date('Y-m-d') >= criteria_for_new_product %} {% if post.date('Y-m-d') >= criteria_for_new_product %}
<span class="product-item-label__tag product-item-label__tag--new"> <span class="product-item-label__tag product-item-label__tag--new">
{{ function('pll_e', 'Новинка') }} {{ function('pll_e', 'Новинка') }}
</span> </span>
{% endif %} {% endif %}
{% if post._sale_price %} {% if post._sale_price %}
<span class="product-item-label__tag product-item-label__tag--sale"> <span class="product-item-label__tag product-item-label__tag--sale">
{{ function('pll_e', 'Распродажа %') }} {{ function('pll_e', 'Распродажа %') }}
</span> </span>
{% endif %} {% endif %}
</div> </div>
<a href="{{ post.link }}" class="product-item__product-card"> <a href="{{ post.link }}" class="product-item__product-card">
<img src="{{ post.thumbnail.src('shop_single') }}" alt="{{ post.title }}" class="product-item__images"> <img src="{{ post.thumbnail.src('shop_single') }}" alt="{{ post.title }}" class="product-item__images">
</a> </a>
<div class="product-item__content-card"> <div class="product-item__content-card">
<div class="compound"> <div class="compound">
{% set compound = fn('wc_get_product_terms', post.id, 'pa_compound') %} {% set compound = fn('wc_get_product_terms', post.id, 'pa_compound') %}
{% for option in compound %} {% for option in compound %}
{% set term = get_term(option) %} {% set term = get_term(option) %}
<a href="/compound/{{ term.slug }}" class="compound__item">{{ term.name }}</a> <a href="/compound/{{ term.slug }}" class="compound__item">{{ term.name }}</a>
{% endfor %} {% endfor %}
</div> </div>
<a href="{{ post.link }}" class="product-item__title">{{ post.title }}</a> <a href="{{ post.link }}" class="product-item__title">{{ post.title }}</a>
<div class="product-item__price"> <div class="product-item__price">
<p>{{ post._price() }} {{ fn('get_woocommerce_currency_symbol') }}</p> <p>{{ post._price() }} {{ fn('get_woocommerce_currency_symbol') }}</p>
</div> </div>
<div class="product-item__bye"> <div class="product-item__bye">
<button class="button button--white button--100-perc open-overlay"> <button class="button button--white button--100-perc open-overlay">
{{ function('pll_e', 'Купить') }} {{ function('pll_e', 'Купить') }}
</button> </button>
</div> </div>
</div> </div>
<div class="product-item__overlay"> <div class="product-item__overlay">
<div class="product-item-overlay__header"> <div class="product-item-overlay__header">
<a href="{{ post.link }}" class="product-item__title">{{ post.title }}</a> <a href="{{ post.link }}" class="product-item__title">{{ post.title }}</a>
<ul class="product-item-overlay__tags"> <ul class="product-item-overlay__tags">
{% set features = fn('wc_get_product_terms', post.id, 'pa_features') %} {% set features = fn('wc_get_product_terms', post.id, 'pa_features') %}
{% for option in features %} {% for option in features %}
{% set term = get_term(option) %} {% set term = get_term(option) %}
<li>{{ term.name }}</li> <li>{{ term.name }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
<form class="product-item__form" method="post" action="/send-telegram.php"> <form class="product-item__form" method="post" action="/send-telegram.php">
<div class="product-item-overlay__input-block"> <div class="product-item-overlay__input-block">
{% set collection = fn('wc_get_product_terms', post.id, 'pa_collection') %} {% set collection = fn('wc_get_product_terms', post.id, 'pa_collection') %}
{% if collection %} {% if collection %}
<div class="product-item-overlay__field"> <div class="product-item-overlay__field">
<p class="product-item-overlay-field__title">{{ fn('pll_e', 'Объем') }}</p> <p class="product-item-overlay-field__title">{{ fn('pll_e', 'Объем') }}</p>
<div class="select"> <div class="select">
<input type="text" class="select__state" value="{{ cur_weight }}" readonly data-product_id="{{post.id}}" data-product_price="{{ post._price() }}"> <input type="text" class="select__state" value="{{ cur_weight }}" readonly data-product_id="{{post.id}}" data-product_price="{{ post._price() }}">
<div class="state__block"> <div class="state__block">
<ul class="state__content"> <ul class="state__content">
{% for option in collection %} {% for option in collection %}
{% set term = get_term(option) %} {% set term = get_term(option) %}
{% set siblings = function('get_collection_siblings' , term.id) %} {% set siblings = function('get_collection_siblings' , term.id) %}
{% for sibling in siblings %} {% for sibling in siblings %}
{% set weight = function('get_product_info', sibling.ID, 'weight') %} {% set weight = function('get_product_info', sibling.ID, 'weight') %}
{% set class = '' %} {% set class = '' %}
{% if weight == cur_weight %} {% if weight == cur_weight %}
{% set class = 'active' %} {% set class = 'active' %}
{% endif %} {% endif %}
<li> <li>
<button class="state__button {{ class }}" data-product_id="{{sibling.ID}}" data-product_price="{{ function('get_product_info', sibling.ID, 'price') }}"> <button class="state__button {{ class }}" data-product_id="{{sibling.ID}}" data-product_price="{{ function('get_product_info', sibling.ID, 'price') }}">
{{ weight }} {{ weight }}
</button> </button>
</li> </li>
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
{% endif %} {% endif %}
<div class="product-item-overlay__field"> <div class="product-item-overlay__field">
<p class="product-item-overlay-field__title">{{ fn('pll_e', 'Количество') }}</p> <p class="product-item-overlay-field__title">{{ fn('pll_e', 'Количество') }}</p>
<div class="counter"> <div class="counter">
<button class="counter__button minus"> <button class="counter__button minus">
<img src="{{ theme.link }}/woocommerce/assets/img/svg/main/minus.svg" alt=""> <img src="{{ theme.link }}/woocommerce/assets/img/svg/main/minus.svg" alt="">
</button> </button>
<input type="text" class="counter__input" value="1"> <input type="text" class="counter__input" value="1">
<button class="counter__button plus"> <button class="counter__button plus">
<img src="{{ theme.link }}/woocommerce/assets/img/svg/main/plus.svg" alt=""> <img src="{{ theme.link }}/woocommerce/assets/img/svg/main/plus.svg" alt="">
</button> </button>
</div> </div>
</div> </div>
</div> </div>
<p class="product-item-overlay__price"> <p class="product-item-overlay__price">
{{ post._price() }} {{ post._price() }}
</p> </p>
<div class="product-item-overlay__block-button"> <div class="product-item-overlay__block-button">
<div class="product-item-overlay__button"> <div class="product-item-overlay__button">
{{ function('get_add_to_cart_button', post.id) }} {{ function('get_add_to_cart_button', post.id) }}
</div> </div>
<div class="product-item-overlay__more_button"> <div class="product-item-overlay__more_button">
<a class="to-know button--100-perc" href="{{ post.link }}"> <a class="to-know button--100-perc" href="{{ post.link }}">
<p>{{ function('pll_e', 'Подробнее') }}</p> <p>{{ function('pll_e', 'Подробнее') }}</p>
</a> </a>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
{% endif %} {% endif %}

@ -1,110 +1,110 @@
'use strict'; 'use strict';
// slider gallery modal // slider gallery modal
const gallery = new Swiper('.gallery__slider', { const gallery = new Swiper('.gallery__slider', {
spaceBetween: 100, spaceBetween: 100,
pagination: { pagination: {
el: '.swiper-pagination', el: '.swiper-pagination',
}, },
navigation: { navigation: {
nextEl: '.swiper-button-next', nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev', prevEl: '.swiper-button-prev',
}, },
scrollbar: { scrollbar: {
el: '.swiper-scrollbar', el: '.swiper-scrollbar',
}, },
}); });
let paginationButtons = document.querySelectorAll('.gallery-pagination__item'); let paginationButtons = document.querySelectorAll('.gallery-pagination__item');
paginationButtons.forEach(button => { paginationButtons.forEach(button => {
let index = button.dataset.countImg; let index = button.dataset.countImg;
button.onclick = function () { button.onclick = function () {
gallery.slideTo(index); gallery.slideTo(index);
} }
}) })
// open gallery // open gallery
let detailImage= document.querySelectorAll('.detail__image'); let detailImage= document.querySelectorAll('.detail__image');
detailImage.forEach(button => { detailImage.forEach(button => {
let index = button.dataset.countImg; let index = button.dataset.countImg;
button.onclick = function () { button.onclick = function () {
gallery.slideTo(index); gallery.slideTo(index);
document.querySelector('.gallery').classList.add('active'); document.querySelector('.gallery').classList.add('active');
} }
}) })
// close gallery // close gallery
document.querySelector('.gallery__close').onclick = function () { document.querySelector('.gallery__close').onclick = function () {
document.querySelector('.gallery').classList.remove('active'); document.querySelector('.gallery').classList.remove('active');
} }
// slider gallery modal // slider gallery modal
// slider gallery main phone // slider gallery main phone
// createGalleryPhone('.detail__images', '.detail-images__wrapper', '.detail__image', 980); // createGalleryPhone('.detail__images', '.detail-images__wrapper', '.detail__image', 980);
const detailPhone = new Swiper('.detail__images-phone', { const detailPhone = new Swiper('.detail__images-phone', {
spaceBetween: 100, spaceBetween: 100,
pagination: { pagination: {
el: '.swiper-pagination', el: '.swiper-pagination',
}, },
navigation: { navigation: {
nextEl: '.swiper-button-next', nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev', prevEl: '.swiper-button-prev',
}, },
scrollbar: { scrollbar: {
el: '.swiper-scrollbar', el: '.swiper-scrollbar',
}, },
}); });
let detailImagesPhones = document.querySelectorAll('.detail-images-phone__image-block'); let detailImagesPhones = document.querySelectorAll('.detail-images-phone__image-block');
detailImagesPhones.forEach(button => { detailImagesPhones.forEach(button => {
button.onclick = function (e) { button.onclick = function (e) {
let index = button.dataset.countImg; let index = button.dataset.countImg;
gallery.slideTo(index); gallery.slideTo(index);
document.querySelector('.gallery').classList.add('active'); document.querySelector('.gallery').classList.add('active');
} }
}) })
// slider gallery main phone // slider gallery main phone
// detail catalog // detail catalog
const detailCatalot = new Swiper('.detail__catalot', { const detailCatalot = new Swiper('.detail__catalot', {
// Navigation arrows // Navigation arrows
navigation: { navigation: {
nextEl: '.detail-catalot-control__button.next', nextEl: '.detail-catalot-control__button.next',
prevEl: '.detail-catalot-control__button.prev', prevEl: '.detail-catalot-control__button.prev',
}, },
breakpoints: { breakpoints: {
1600: { 1600: {
slidesPerView: 4, slidesPerView: 4,
}, },
1200: { 1200: {
slidesPerView: 3, slidesPerView: 3,
}, },
780: { 780: {
slidesPerView: 2, slidesPerView: 2,
}, },
100: { 100: {
slidesPerView: 1.1, slidesPerView: 1.1,
spaceBetween: 20 spaceBetween: 20
}, },
} }
}); });
// detail catalog // detail catalog

@ -1,121 +1,121 @@
<?php <?php
/** /**
* Shipping Methods Display * Shipping Methods Display
* *
* In 2.1 we show methods per package. This allows for multiple methods per order if so desired. * In 2.1 we show methods per package. This allows for multiple methods per order if so desired.
* *
* This template can be overridden by copying it to yourtheme/woocommerce/cart/cart-shipping.php. * This template can be overridden by copying it to yourtheme/woocommerce/cart/cart-shipping.php.
* *
* HOWEVER, on occasion WooCommerce will need to update template files and you * 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 * (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 * 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 * happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes. * the readme will list any important changes.
* *
* @see https://woocommerce.com/document/template-structure/ * @see https://woocommerce.com/document/template-structure/
* @package WooCommerce\Templates * @package WooCommerce\Templates
* @version 8.8.0 * @version 8.8.0
*/ */
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
$formatted_destination = isset( $formatted_destination ) ? $formatted_destination : WC()->countries->get_formatted_address( $package['destination'], ', ' ); $formatted_destination = isset( $formatted_destination ) ? $formatted_destination : WC()->countries->get_formatted_address( $package['destination'], ', ' );
$has_calculated_shipping = ! empty( $has_calculated_shipping ); $has_calculated_shipping = ! empty( $has_calculated_shipping );
$show_shipping_calculator = ! empty( $show_shipping_calculator ); $show_shipping_calculator = ! empty( $show_shipping_calculator );
$calculator_text = ''; $calculator_text = '';
?> ?>
<tr class="woocommerce-shipping-totals shipping"> <tr class="woocommerce-shipping-totals shipping">
<?php <?php
?> ?>
<td data-title="<?php echo esc_attr( $package_name ); ?>" class="modal-map__control modal-map__control--delivery"> <td data-title="<?php echo esc_attr( $package_name ); ?>" class="modal-map__control modal-map__control--delivery">
<?php if ( ! empty( $available_methods ) && is_array( $available_methods ) ) : ?> <?php if ( ! empty( $available_methods ) && is_array( $available_methods ) ) : ?>
<ul id="shipping_method" class="woocommerce-shipping-methods"> <ul id="shipping_method" class="woocommerce-shipping-methods">
<?php foreach ( $available_methods as $method ) : <?php foreach ( $available_methods as $method ) :
$pattern = '/^(.*?),\s*\((.*?)\)$/'; $pattern = '/^(.*?),\s*\((.*?)\)$/';
if (preg_match($pattern, $method->label, $matches)) { if (preg_match($pattern, $method->label, $matches)) {
$text_before_comma = trim($matches[1]); // Текст до запятой $text_before_comma = trim($matches[1]); // Текст до запятой
$text_in_parentheses = trim($matches[2]); // Текст в скобках $text_in_parentheses = trim($matches[2]); // Текст в скобках
} else { } else {
$text_before_comma = ''; $text_before_comma = '';
$text_in_parentheses = ''; $text_in_parentheses = '';
} }
if ($text_before_comma == 'CDEK: Посылка склад-дверь'){ if ($text_before_comma == 'CDEK: Посылка склад-дверь'){
$title = 'Курьером'; $title = 'Курьером';
} }
else if ($text_before_comma == 'CDEK: Посылка склад-склад'){ else if ($text_before_comma == 'CDEK: Посылка склад-склад'){
$title = 'Пункт выдачи'; $title = 'Пункт выдачи';
} }
?> ?>
<li data-remote="<?php echo $method->id ?>" class="modal-map-control__item <?php if ($method->id == $chosen_method): ?>active <?php endif; ?>"> <li data-remote="<?php echo $method->id ?>" class="modal-map-control__item <?php if ($method->id == $chosen_method): ?>active <?php endif; ?>">
<label> <label>
<div class="modal-map-control-item__content"> <div class="modal-map-control-item__content">
<div class="modal-map-control-item__header"> <div class="modal-map-control-item__header">
<div class="modal-map-control-item__circle"><div class="modal-map-control-item-circle__content"></div></div> <div class="modal-map-control-item__circle"><div class="modal-map-control-item-circle__content"></div></div>
<p class="modal-map-control-item__title"> <p class="modal-map-control-item__title">
<?php <?php
echo $title; echo $title;
?> ?>
</p> </p>
</div> </div>
<div class="modal-map-control-item__description"> <div class="modal-map-control-item__description">
<p class="modal-map-control-item__time"><?php echo $text_in_parentheses; ?></p> <p class="modal-map-control-item__time"><?php echo $text_in_parentheses; ?></p>
<p class="modal-map-control-item__price"> <?php <p class="modal-map-control-item__price"> <?php
echo $method->cost; echo $method->cost;
?>₽</p> ?>₽</p>
</div> </div>
<?php do_action( 'woocommerce_after_shipping_rate', $method, $index ); ?> <?php do_action( 'woocommerce_after_shipping_rate', $method, $index ); ?>
</div> </div>
<?php <?php
if ( 1 < count( $available_methods ) ) { if ( 1 < count( $available_methods ) ) {
printf( '<input type="radio" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method visually-hidden" %4$s />', $index, esc_attr( sanitize_title( $method->id ) ), esc_attr( $method->id ), checked( $method->id, $chosen_method, false ) ); // WPCS: XSS ok. printf( '<input type="radio" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method visually-hidden" %4$s />', $index, esc_attr( sanitize_title( $method->id ) ), esc_attr( $method->id ), checked( $method->id, $chosen_method, false ) ); // WPCS: XSS ok.
} else { } else {
printf( '<input type="hidden" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method visually-hidden" />', $index, esc_attr( sanitize_title( $method->id ) ), esc_attr( $method->id ) ); // WPCS: XSS ok. printf( '<input type="hidden" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method visually-hidden" />', $index, esc_attr( sanitize_title( $method->id ) ), esc_attr( $method->id ) ); // WPCS: XSS ok.
} }
?> ?>
</label> </label>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>
<?php <?php
?> ?>
</ul> </ul>
<?php if ( is_cart() ) : ?> <?php if ( is_cart() ) : ?>
<p class="woocommerce-shipping-destination"> <p class="woocommerce-shipping-destination">
<?php <?php
if ( $formatted_destination ) { if ( $formatted_destination ) {
// Translators: $s shipping destination. // Translators: $s shipping destination.
printf( esc_html__( 'Shipping to %s.', 'woocommerce' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' ); printf( esc_html__( 'Shipping to %s.', 'woocommerce' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' );
$calculator_text = esc_html__( 'Change address', 'woocommerce' ); $calculator_text = esc_html__( 'Change address', 'woocommerce' );
} else { } else {
echo wp_kses_post( apply_filters( 'woocommerce_shipping_estimate_html', __( 'Shipping options will be updated during checkout.', 'woocommerce' ) ) ); echo wp_kses_post( apply_filters( 'woocommerce_shipping_estimate_html', __( 'Shipping options will be updated during checkout.', 'woocommerce' ) ) );
} }
?> ?>
</p> </p>
<?php endif; ?> <?php endif; ?>
<?php <?php
else: else:
?> ?>
<p> Нет доступных способов доставки. Для отображение доступных методов укажите ваш город.</p> <p> Нет доступных способов доставки. Для отображение доступных методов укажите ваш город.</p>
<?php <?php
endif; endif;
?> ?>
</td> </td>
</tr> </tr>
<style> <style>
</style> </style>

@ -1,29 +1,29 @@
<?php <?php
/** /**
* Checkout Form * Checkout Form
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.5.0 * @version 3.5.0
*/ */
if (!defined('ABSPATH')) { if (!defined('ABSPATH')) {
exit; exit;
} }
// Get Timber context // Get Timber context
$context = Timber::context(); $context = Timber::context();
// Add WooCommerce-specific data to context // Add WooCommerce-specific data to context
$context['checkout'] = WC()->checkout(); $context['checkout'] = WC()->checkout();
// In your theme's functions.php // In your theme's functions.php
add_filter('timber/twig', function($twig) { add_filter('timber/twig', function($twig) {
$twig->addFunction(new \Twig\TwigFunction('WC', function() { $twig->addFunction(new \Twig\TwigFunction('WC', function() {
return WC(); return WC();
})); }));
return $twig; return $twig;
}); });
// Render the Twig template // Render the Twig template
Timber::render('shop/checkout.twig', $context); Timber::render('shop/checkout.twig', $context);

@ -1,19 +1,19 @@
<?php <?php
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
get_header(); get_header();
$template_path = 'templates/shop/single-product.php'; $template_path = 'templates/shop/single-product.php';
if (file_exists(get_template_directory() . '/' . $template_path)) { if (file_exists(get_template_directory() . '/' . $template_path)) {
include_once get_template_directory() . '/' . $template_path; include_once get_template_directory() . '/' . $template_path;
} else { } else {
while (have_posts()) : the_post(); while (have_posts()) : the_post();
wc_get_template_part('content', 'single-product'); wc_get_template_part('content', 'single-product');
endwhile; endwhile;
} }
get_footer(); get_footer();
Loading…
Cancel
Save