Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
|
0c8ab333bd | 2 months ago |
|
b2ef19f829 | 2 months ago |
@ -1,6 +1,6 @@ |
||||
<?php |
||||
|
||||
include_module('author'); |
||||
include_component('author', 'author-archive'); |
||||
|
||||
<?php |
||||
|
||||
include_module('author'); |
||||
include_component('author', 'author-archive'); |
||||
|
||||
?> |
@ -1,211 +1,211 @@ |
||||
<?php |
||||
if (!defined('ABSPATH')) { |
||||
exit; |
||||
} |
||||
|
||||
function count_nested_replies($comment_id) { |
||||
$count = 0; |
||||
$replies = get_comments(array( |
||||
'post_id' => get_the_ID(), |
||||
'status' => 'approve', |
||||
'parent' => $comment_id, |
||||
'order' => 'ASC' |
||||
)); |
||||
|
||||
if ($replies) { |
||||
$count += count($replies); |
||||
foreach ($replies as $reply) { |
||||
$count += count_nested_replies($reply->comment_ID); |
||||
} |
||||
} |
||||
|
||||
return $count; |
||||
} |
||||
|
||||
if (post_password_required()) { |
||||
return; |
||||
} |
||||
|
||||
if (!is_user_logged_in()) { |
||||
?> |
||||
<div class="comment-block"> |
||||
<p class="comment-block_text"> |
||||
<a href="#modal"><?php pll_e('Войдите'); ?></a>, <?php pll_e('чтобы оставлять комментарии'); ?> |
||||
</p> |
||||
</div> |
||||
<?php |
||||
} |
||||
|
||||
$top_level_comments = get_comments(array( |
||||
'post_id' => get_the_ID(), |
||||
'status' => 'approve', |
||||
'parent' => 0, |
||||
'order' => 'ASC' |
||||
)); |
||||
|
||||
if ($top_level_comments) { |
||||
echo '<div class="comment-block_wrapper">'; |
||||
|
||||
foreach ($top_level_comments as $comment) { |
||||
?> |
||||
<div class="comment-block" id="comment-<?php echo $comment->comment_ID; ?>">
|
||||
<div class="comment-user"> |
||||
<?php echo get_avatar($comment, 50); ?> |
||||
<div class="comment-user_text"> |
||||
<h6><?php echo get_comment_author($comment); ?></h6>
|
||||
<span><?php echo get_comment_date('d F Y', $comment); ?></span>
|
||||
</div> |
||||
</div> |
||||
<p><?php echo get_comment_text($comment); ?></p>
|
||||
<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)); ?>">
|
||||
<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="M7 0.5L9.5 3L7 5.5" stroke="#666666"></path> |
||||
</svg> |
||||
<?php pll_e('Ответить'); ?> |
||||
</button> |
||||
<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"> |
||||
<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> |
||||
<?php echo get_comment_likes_count($comment->comment_ID); ?> |
||||
</button> |
||||
<?php |
||||
comment_reply_link(array( |
||||
'reply_text' => pll__('Ответить'), |
||||
'depth' => 1, |
||||
'max_depth' => get_option('thread_comments_depth'), |
||||
'before' => '<span style="display:none;">', |
||||
'after' => '</span>', |
||||
), $comment->comment_ID, get_the_ID()); |
||||
?> |
||||
</div> |
||||
<div class="reply-form-container" id="reply-form-<?php echo $comment->comment_ID; ?>" style="display: none;"></div>
|
||||
</div> |
||||
<?php |
||||
|
||||
$all_nested_replies = get_all_nested_replies($comment->comment_ID); |
||||
|
||||
if (!empty($all_nested_replies)) { |
||||
$total_reply_count = count($all_nested_replies); |
||||
?> |
||||
<button class="answer-btn"> |
||||
<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> |
||||
</svg> |
||||
<?php echo $total_reply_count; ?> |
||||
<span> |
||||
<?php echo ($total_reply_count == 1) ? pll__('ответ') : pll__('ответа'); ?> |
||||
</span> |
||||
</button> |
||||
<?php |
||||
|
||||
foreach ($all_nested_replies as $reply) { |
||||
?> |
||||
<div class="comment-block answer-block" id="comment-<?php echo $reply->comment_ID; ?>">
|
||||
<div class="comment-user"> |
||||
<?php echo get_avatar($reply, 50); ?> |
||||
<div class="comment-user_text"> |
||||
<h6><?php echo get_comment_author($reply); ?></h6>
|
||||
<span><?php echo get_comment_date('d F Y', $reply); ?></span>
|
||||
</div> |
||||
</div> |
||||
<p><?php echo get_comment_text($reply); ?></p>
|
||||
<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)); ?>">
|
||||
<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="M7 0.5L9.5 3L7 5.5" stroke="#666666"></path> |
||||
</svg> |
||||
<?php pll_e('Ответить'); ?> |
||||
</button> |
||||
<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"> |
||||
<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> |
||||
<?php echo get_comment_likes_count($reply->comment_ID); ?> |
||||
</button> |
||||
<?php |
||||
comment_reply_link(array( |
||||
'reply_text' => pll__('Ответить'), |
||||
'depth' => 2, |
||||
'max_depth' => get_option('thread_comments_depth'), |
||||
'before' => '<span style="display:none;">', |
||||
'after' => '</span>', |
||||
), $reply->comment_ID, get_the_ID()); |
||||
?> |
||||
</div> |
||||
<div class="reply-form-container" id="reply-form-<?php echo $reply->comment_ID; ?>" style="display: none;"></div>
|
||||
</div> |
||||
<?php |
||||
} |
||||
} |
||||
} |
||||
|
||||
echo '</div>'; |
||||
} |
||||
|
||||
function get_all_nested_replies($comment_id) { |
||||
$all_replies = array(); |
||||
|
||||
$direct_replies = get_comments(array( |
||||
'post_id' => get_the_ID(), |
||||
'status' => 'approve', |
||||
'parent' => $comment_id, |
||||
'order' => 'ASC' |
||||
)); |
||||
|
||||
$all_replies = array_merge($all_replies, $direct_replies); |
||||
|
||||
foreach ($direct_replies as $reply) { |
||||
$deeper_replies = get_all_nested_replies_recursive($reply->comment_ID); |
||||
$all_replies = array_merge($all_replies, $deeper_replies); |
||||
} |
||||
|
||||
return $all_replies; |
||||
} |
||||
|
||||
function get_all_nested_replies_recursive($comment_id) { |
||||
$replies = get_comments(array( |
||||
'post_id' => get_the_ID(), |
||||
'status' => 'approve', |
||||
'parent' => $comment_id, |
||||
'order' => 'ASC' |
||||
)); |
||||
|
||||
$all_replies = $replies; |
||||
|
||||
foreach ($replies as $reply) { |
||||
$deeper_replies = get_all_nested_replies_recursive($reply->comment_ID); |
||||
$all_replies = array_merge($all_replies, $deeper_replies); |
||||
} |
||||
|
||||
return $all_replies; |
||||
} |
||||
|
||||
if (is_user_logged_in()) { |
||||
$commenter = wp_get_current_commenter(); |
||||
$args = array( |
||||
'fields' => array( |
||||
'author' => '', |
||||
'email' => '', |
||||
'url' => '', |
||||
'cookies' => '', |
||||
), |
||||
'comment_field' => '<div class="comment-form-comment"><textarea id="comment" name="comment" placeholder="' . pll__('Ваш комментарий') . '" required></textarea></div>', |
||||
'title_reply' => pll__('Оставить комментарий'), |
||||
'title_reply_to' => pll__('Ответить %s'), |
||||
'class_submit' => 'comment-submit-btn', |
||||
'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>', |
||||
'cancel_reply_link' => pll__('Отменить'), |
||||
'id_form' => 'commentform', |
||||
'id_submit' => 'submit', |
||||
'title_reply_before' => '<h3 id="reply-title" class="comment-reply-title">', |
||||
'title_reply_after' => '</h3>', |
||||
); |
||||
|
||||
comment_form($args); |
||||
} |
||||
<?php |
||||
if (!defined('ABSPATH')) { |
||||
exit; |
||||
} |
||||
|
||||
function count_nested_replies($comment_id) { |
||||
$count = 0; |
||||
$replies = get_comments(array( |
||||
'post_id' => get_the_ID(), |
||||
'status' => 'approve', |
||||
'parent' => $comment_id, |
||||
'order' => 'ASC' |
||||
)); |
||||
|
||||
if ($replies) { |
||||
$count += count($replies); |
||||
foreach ($replies as $reply) { |
||||
$count += count_nested_replies($reply->comment_ID); |
||||
} |
||||
} |
||||
|
||||
return $count; |
||||
} |
||||
|
||||
if (post_password_required()) { |
||||
return; |
||||
} |
||||
|
||||
if (!is_user_logged_in()) { |
||||
?> |
||||
<div class="comment-block"> |
||||
<p class="comment-block_text"> |
||||
<a href="#modal"><?php pll_e('Войдите'); ?></a>, <?php pll_e('чтобы оставлять комментарии'); ?> |
||||
</p> |
||||
</div> |
||||
<?php |
||||
} |
||||
|
||||
$top_level_comments = get_comments(array( |
||||
'post_id' => get_the_ID(), |
||||
'status' => 'approve', |
||||
'parent' => 0, |
||||
'order' => 'ASC' |
||||
)); |
||||
|
||||
if ($top_level_comments) { |
||||
echo '<div class="comment-block_wrapper">'; |
||||
|
||||
foreach ($top_level_comments as $comment) { |
||||
?> |
||||
<div class="comment-block" id="comment-<?php echo $comment->comment_ID; ?>">
|
||||
<div class="comment-user"> |
||||
<?php echo get_avatar($comment, 50); ?> |
||||
<div class="comment-user_text"> |
||||
<h6><?php echo get_comment_author($comment); ?></h6>
|
||||
<span><?php echo get_comment_date('d F Y', $comment); ?></span>
|
||||
</div> |
||||
</div> |
||||
<p><?php echo get_comment_text($comment); ?></p>
|
||||
<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)); ?>">
|
||||
<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="M7 0.5L9.5 3L7 5.5" stroke="#666666"></path> |
||||
</svg> |
||||
<?php pll_e('Ответить'); ?> |
||||
</button> |
||||
<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"> |
||||
<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> |
||||
<?php echo get_comment_likes_count($comment->comment_ID); ?> |
||||
</button> |
||||
<?php |
||||
comment_reply_link(array( |
||||
'reply_text' => pll__('Ответить'), |
||||
'depth' => 1, |
||||
'max_depth' => get_option('thread_comments_depth'), |
||||
'before' => '<span style="display:none;">', |
||||
'after' => '</span>', |
||||
), $comment->comment_ID, get_the_ID()); |
||||
?> |
||||
</div> |
||||
<div class="reply-form-container" id="reply-form-<?php echo $comment->comment_ID; ?>" style="display: none;"></div>
|
||||
</div> |
||||
<?php |
||||
|
||||
$all_nested_replies = get_all_nested_replies($comment->comment_ID); |
||||
|
||||
if (!empty($all_nested_replies)) { |
||||
$total_reply_count = count($all_nested_replies); |
||||
?> |
||||
<button class="answer-btn"> |
||||
<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> |
||||
</svg> |
||||
<?php echo $total_reply_count; ?> |
||||
<span> |
||||
<?php echo ($total_reply_count == 1) ? pll__('ответ') : pll__('ответа'); ?> |
||||
</span> |
||||
</button> |
||||
<?php |
||||
|
||||
foreach ($all_nested_replies as $reply) { |
||||
?> |
||||
<div class="comment-block answer-block" id="comment-<?php echo $reply->comment_ID; ?>">
|
||||
<div class="comment-user"> |
||||
<?php echo get_avatar($reply, 50); ?> |
||||
<div class="comment-user_text"> |
||||
<h6><?php echo get_comment_author($reply); ?></h6>
|
||||
<span><?php echo get_comment_date('d F Y', $reply); ?></span>
|
||||
</div> |
||||
</div> |
||||
<p><?php echo get_comment_text($reply); ?></p>
|
||||
<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)); ?>">
|
||||
<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="M7 0.5L9.5 3L7 5.5" stroke="#666666"></path> |
||||
</svg> |
||||
<?php pll_e('Ответить'); ?> |
||||
</button> |
||||
<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"> |
||||
<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> |
||||
<?php echo get_comment_likes_count($reply->comment_ID); ?> |
||||
</button> |
||||
<?php |
||||
comment_reply_link(array( |
||||
'reply_text' => pll__('Ответить'), |
||||
'depth' => 2, |
||||
'max_depth' => get_option('thread_comments_depth'), |
||||
'before' => '<span style="display:none;">', |
||||
'after' => '</span>', |
||||
), $reply->comment_ID, get_the_ID()); |
||||
?> |
||||
</div> |
||||
<div class="reply-form-container" id="reply-form-<?php echo $reply->comment_ID; ?>" style="display: none;"></div>
|
||||
</div> |
||||
<?php |
||||
} |
||||
} |
||||
} |
||||
|
||||
echo '</div>'; |
||||
} |
||||
|
||||
function get_all_nested_replies($comment_id) { |
||||
$all_replies = array(); |
||||
|
||||
$direct_replies = get_comments(array( |
||||
'post_id' => get_the_ID(), |
||||
'status' => 'approve', |
||||
'parent' => $comment_id, |
||||
'order' => 'ASC' |
||||
)); |
||||
|
||||
$all_replies = array_merge($all_replies, $direct_replies); |
||||
|
||||
foreach ($direct_replies as $reply) { |
||||
$deeper_replies = get_all_nested_replies_recursive($reply->comment_ID); |
||||
$all_replies = array_merge($all_replies, $deeper_replies); |
||||
} |
||||
|
||||
return $all_replies; |
||||
} |
||||
|
||||
function get_all_nested_replies_recursive($comment_id) { |
||||
$replies = get_comments(array( |
||||
'post_id' => get_the_ID(), |
||||
'status' => 'approve', |
||||
'parent' => $comment_id, |
||||
'order' => 'ASC' |
||||
)); |
||||
|
||||
$all_replies = $replies; |
||||
|
||||
foreach ($replies as $reply) { |
||||
$deeper_replies = get_all_nested_replies_recursive($reply->comment_ID); |
||||
$all_replies = array_merge($all_replies, $deeper_replies); |
||||
} |
||||
|
||||
return $all_replies; |
||||
} |
||||
|
||||
if (is_user_logged_in()) { |
||||
$commenter = wp_get_current_commenter(); |
||||
$args = array( |
||||
'fields' => array( |
||||
'author' => '', |
||||
'email' => '', |
||||
'url' => '', |
||||
'cookies' => '', |
||||
), |
||||
'comment_field' => '<div class="comment-form-comment"><textarea id="comment" name="comment" placeholder="' . pll__('Ваш комментарий') . '" required></textarea></div>', |
||||
'title_reply' => pll__('Оставить комментарий'), |
||||
'title_reply_to' => pll__('Ответить %s'), |
||||
'class_submit' => 'comment-submit-btn', |
||||
'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>', |
||||
'cancel_reply_link' => pll__('Отменить'), |
||||
'id_form' => 'commentform', |
||||
'id_submit' => 'submit', |
||||
'title_reply_before' => '<h3 id="reply-title" class="comment-reply-title">', |
||||
'title_reply_after' => '</h3>', |
||||
); |
||||
|
||||
comment_form($args); |
||||
} |
||||
?> |
File diff suppressed because it is too large
Load Diff
@ -1,46 +1,46 @@ |
||||
jQuery(document).ready(function ($) { |
||||
$('#ajax-load-author').on('submit', function (e) { |
||||
e.preventDefault(); |
||||
var form = $(this); |
||||
var currentPage = parseInt($('#page_num').val()); |
||||
var totalPosts = parseInt(form.data('total')); |
||||
var postsPerPage = 9; |
||||
|
||||
console.log('Current page before load:', currentPage); |
||||
console.log('Total posts:', totalPosts); |
||||
console.log('Posts loaded before request:', postsPerPage); |
||||
|
||||
var data = { |
||||
action: 'get_author_posts', |
||||
page_num: currentPage, |
||||
author_id: form.data('author') |
||||
}; |
||||
|
||||
console.log('Sending AJAX request with data:', data); |
||||
|
||||
$.ajax({ |
||||
url: '/wp-admin/admin-ajax.php', |
||||
type: 'POST', |
||||
data: data, |
||||
success: function (response) { |
||||
console.log('AJAX response received'); |
||||
$(".anons-article__card-wrap").append(response); |
||||
|
||||
$('#page_num').val(currentPage + 1); |
||||
console.log('New page number:', currentPage + 1); |
||||
|
||||
// Считаем общее количество загруженных постов
|
||||
var currentlyDisplayed = $('.anons-article__card-wrap .anons-best__card').length; |
||||
console.log('Actually displayed posts:', currentlyDisplayed); |
||||
|
||||
if (currentlyDisplayed >= totalPosts) { |
||||
console.log('Hiding load more button - all posts loaded'); |
||||
form.hide(); |
||||
} |
||||
}, |
||||
error: function (error) { |
||||
console.error('AJAX error:', error); |
||||
} |
||||
}); |
||||
}); |
||||
jQuery(document).ready(function ($) { |
||||
$('#ajax-load-author').on('submit', function (e) { |
||||
e.preventDefault(); |
||||
var form = $(this); |
||||
var currentPage = parseInt($('#page_num').val()); |
||||
var totalPosts = parseInt(form.data('total')); |
||||
var postsPerPage = 9; |
||||
|
||||
console.log('Current page before load:', currentPage); |
||||
console.log('Total posts:', totalPosts); |
||||
console.log('Posts loaded before request:', postsPerPage); |
||||
|
||||
var data = { |
||||
action: 'get_author_posts', |
||||
page_num: currentPage, |
||||
author_id: form.data('author') |
||||
}; |
||||
|
||||
console.log('Sending AJAX request with data:', data); |
||||
|
||||
$.ajax({ |
||||
url: '/wp-admin/admin-ajax.php', |
||||
type: 'POST', |
||||
data: data, |
||||
success: function (response) { |
||||
console.log('AJAX response received'); |
||||
$(".anons-article__card-wrap").append(response); |
||||
|
||||
$('#page_num').val(currentPage + 1); |
||||
console.log('New page number:', currentPage + 1); |
||||
|
||||
// Считаем общее количество загруженных постов
|
||||
var currentlyDisplayed = $('.anons-article__card-wrap .anons-best__card').length; |
||||
console.log('Actually displayed posts:', currentlyDisplayed); |
||||
|
||||
if (currentlyDisplayed >= totalPosts) { |
||||
console.log('Hiding load more button - all posts loaded'); |
||||
form.hide(); |
||||
} |
||||
}, |
||||
error: function (error) { |
||||
console.error('AJAX error:', error); |
||||
} |
||||
}); |
||||
}); |
||||
});
|
@ -1,54 +1,54 @@ |
||||
<?php |
||||
|
||||
include_component('blog', 'featured-slider'); |
||||
include_module('forms'); |
||||
include_component('forms', 'discount'); |
||||
|
||||
$context = Timber::context(); |
||||
|
||||
$context['blog_title'] = get_field('blog_title', 'options'); |
||||
$context['blog_desc'] = get_field('blog_desc', 'options'); |
||||
$context['post_count'] = wp_count_posts()->publish; |
||||
$context['total_pages'] = ceil($context['post_count'] / get_option('posts_per_page')); |
||||
|
||||
$context['sub_title'] = get_field('sub_title', 383); |
||||
$context['sub_text'] = get_field('sub_text', 383); |
||||
|
||||
$authors = Timber::get_posts([ |
||||
'post_type' => 'blog_author', |
||||
'posts_per_page' => -1, |
||||
'orderby' => 'menu_order', |
||||
'order' => 'ASC', |
||||
]); |
||||
|
||||
$authors_arr = iterator_to_array($authors); |
||||
foreach ($authors_arr as $author) { |
||||
$author_id = $author->ID; |
||||
$query = new WP_Query([ |
||||
'post_type' => 'post', |
||||
'posts_per_page' => -1, |
||||
'meta_query' => [ |
||||
[ |
||||
'key' => 'post_author', |
||||
'value' => $author_id, |
||||
'compare' => '=' |
||||
] |
||||
] |
||||
]); |
||||
$author->post_count = $query->found_posts; |
||||
$author->position = get_field('post', $author_id); |
||||
$author->posts = Timber::get_posts([ |
||||
'post_type' => 'post', |
||||
'posts_per_page' => -1, |
||||
'meta_query' => [ |
||||
[ |
||||
'key' => 'post_author', |
||||
'value' => $author_id, |
||||
'compare' => '=' |
||||
] |
||||
] |
||||
]); |
||||
} |
||||
$context['authors'] = $authors_arr; |
||||
|
||||
Timber::render('blog_author/author-archive.twig', $context); |
||||
<?php |
||||
|
||||
include_component('blog', 'featured-slider'); |
||||
include_module('forms'); |
||||
include_component('forms', 'discount'); |
||||
|
||||
$context = Timber::context(); |
||||
|
||||
$context['blog_title'] = get_field('blog_title', 'options'); |
||||
$context['blog_desc'] = get_field('blog_desc', 'options'); |
||||
$context['post_count'] = wp_count_posts()->publish; |
||||
$context['total_pages'] = ceil($context['post_count'] / get_option('posts_per_page')); |
||||
|
||||
$context['sub_title'] = get_field('sub_title', 383); |
||||
$context['sub_text'] = get_field('sub_text', 383); |
||||
|
||||
$authors = Timber::get_posts([ |
||||
'post_type' => 'blog_author', |
||||
'posts_per_page' => -1, |
||||
'orderby' => 'menu_order', |
||||
'order' => 'ASC', |
||||
]); |
||||
|
||||
$authors_arr = iterator_to_array($authors); |
||||
foreach ($authors_arr as $author) { |
||||
$author_id = $author->ID; |
||||
$query = new WP_Query([ |
||||
'post_type' => 'post', |
||||
'posts_per_page' => -1, |
||||
'meta_query' => [ |
||||
[ |
||||
'key' => 'post_author', |
||||
'value' => $author_id, |
||||
'compare' => '=' |
||||
] |
||||
] |
||||
]); |
||||
$author->post_count = $query->found_posts; |
||||
$author->position = get_field('post', $author_id); |
||||
$author->posts = Timber::get_posts([ |
||||
'post_type' => 'post', |
||||
'posts_per_page' => -1, |
||||
'meta_query' => [ |
||||
[ |
||||
'key' => 'post_author', |
||||
'value' => $author_id, |
||||
'compare' => '=' |
||||
] |
||||
] |
||||
]); |
||||
} |
||||
$context['authors'] = $authors_arr; |
||||
|
||||
Timber::render('blog_author/author-archive.twig', $context); |
||||
|
@ -1,41 +1,41 @@ |
||||
<?php |
||||
|
||||
$context = Timber::get_context(); |
||||
|
||||
$author = Timber::get_post(); |
||||
$author_id = $author->ID; |
||||
|
||||
|
||||
$author->position = get_field('post', $author_id); |
||||
|
||||
$count_query = new WP_Query([ |
||||
'post_type' => 'post', |
||||
'post_status' => 'publish', |
||||
'posts_per_page' => -1, |
||||
'meta_query' => [ |
||||
[ |
||||
'key' => 'post_author', |
||||
'value' => $author_id, |
||||
'compare' => '=' |
||||
] |
||||
] |
||||
]); |
||||
$author->post_count = $count_query->found_posts; |
||||
|
||||
$author->posts = Timber::get_posts([ |
||||
'post_type' => 'post', |
||||
'post_status' => 'publish', |
||||
'posts_per_page' => 9, |
||||
'meta_query' => [ |
||||
[ |
||||
'key' => 'post_author', |
||||
'value' => $author_id, |
||||
'compare' => '=' |
||||
] |
||||
] |
||||
]); |
||||
|
||||
$context['author'] = $author; |
||||
$context['total_pages'] = ceil($author->post_count / 9); |
||||
|
||||
<?php |
||||
|
||||
$context = Timber::get_context(); |
||||
|
||||
$author = Timber::get_post(); |
||||
$author_id = $author->ID; |
||||
|
||||
|
||||
$author->position = get_field('post', $author_id); |
||||
|
||||
$count_query = new WP_Query([ |
||||
'post_type' => 'post', |
||||
'post_status' => 'publish', |
||||
'posts_per_page' => -1, |
||||
'meta_query' => [ |
||||
[ |
||||
'key' => 'post_author', |
||||
'value' => $author_id, |
||||
'compare' => '=' |
||||
] |
||||
] |
||||
]); |
||||
$author->post_count = $count_query->found_posts; |
||||
|
||||
$author->posts = Timber::get_posts([ |
||||
'post_type' => 'post', |
||||
'post_status' => 'publish', |
||||
'posts_per_page' => 9, |
||||
'meta_query' => [ |
||||
[ |
||||
'key' => 'post_author', |
||||
'value' => $author_id, |
||||
'compare' => '=' |
||||
] |
||||
] |
||||
]); |
||||
|
||||
$context['author'] = $author; |
||||
$context['total_pages'] = ceil($author->post_count / 9); |
||||
|
||||
Timber::render('blog_author/author-single.twig', $context); |
@ -1,35 +1,35 @@ |
||||
<?php |
||||
|
||||
include_module('author'); |
||||
|
||||
function get_author_posts() { |
||||
$author_id = isset($_POST['author_id']) ? sanitize_text_field($_POST['author_id']) : ''; |
||||
|
||||
$all_posts = Timber::get_posts([ |
||||
'post_type' => 'post', |
||||
'post_status' => 'publish', |
||||
'posts_per_page' => -1, |
||||
'meta_query' => [ |
||||
[ |
||||
'key' => 'post_author', |
||||
'value' => $author_id, |
||||
'compare' => '=' |
||||
] |
||||
] |
||||
]); |
||||
|
||||
if ($all_posts instanceof \Timber\PostQuery || $all_posts instanceof \Timber\PostCollection) { |
||||
$all_posts = $all_posts->get_posts(); |
||||
} |
||||
|
||||
$remaining_posts = array_slice($all_posts, 9); |
||||
|
||||
$context = Timber::context(); |
||||
$context['posts'] = $remaining_posts; |
||||
|
||||
Timber::render('blog_author/author-posts-list.twig', $context); |
||||
wp_die(); |
||||
} |
||||
|
||||
add_action('wp_ajax_get_author_posts', 'get_author_posts'); |
||||
<?php |
||||
|
||||
include_module('author'); |
||||
|
||||
function get_author_posts() { |
||||
$author_id = isset($_POST['author_id']) ? sanitize_text_field($_POST['author_id']) : ''; |
||||
|
||||
$all_posts = Timber::get_posts([ |
||||
'post_type' => 'post', |
||||
'post_status' => 'publish', |
||||
'posts_per_page' => -1, |
||||
'meta_query' => [ |
||||
[ |
||||
'key' => 'post_author', |
||||
'value' => $author_id, |
||||
'compare' => '=' |
||||
] |
||||
] |
||||
]); |
||||
|
||||
if ($all_posts instanceof \Timber\PostQuery || $all_posts instanceof \Timber\PostCollection) { |
||||
$all_posts = $all_posts->get_posts(); |
||||
} |
||||
|
||||
$remaining_posts = array_slice($all_posts, 9); |
||||
|
||||
$context = Timber::context(); |
||||
$context['posts'] = $remaining_posts; |
||||
|
||||
Timber::render('blog_author/author-posts-list.twig', $context); |
||||
wp_die(); |
||||
} |
||||
|
||||
add_action('wp_ajax_get_author_posts', 'get_author_posts'); |
||||
add_action('wp_ajax_nopriv_get_author_posts', 'get_author_posts'); |
@ -1,198 +1,198 @@ |
||||
// comment
|
||||
let answerbtns = document.querySelectorAll('.answer-btn'); |
||||
let answerbtnicons = document.querySelectorAll('.answer-btn svg'); |
||||
|
||||
// При загрузке страницы проверяем активные кнопки
|
||||
document.addEventListener('DOMContentLoaded', function() { |
||||
// Для каждой кнопки ответов
|
||||
answerbtns.forEach((answerbtn) => { |
||||
// Находим родительский контейнер, чтобы искать ответы только для этого комментария
|
||||
const buttonParent = answerbtn.parentElement; |
||||
|
||||
// Находим все блоки ответов для этого комментария (после текущей кнопки)
|
||||
const answerBlocks = getRelatedAnswerBlocks(answerbtn); |
||||
if (answerBlocks.length === 0) return; |
||||
|
||||
// Проверяем, должны ли быть ответы развернуты (если у кнопки или любого ответа есть класс active)
|
||||
const shouldBeActive = answerbtn.querySelector('svg').classList.contains('active') ||
|
||||
Array.from(answerBlocks).some(block => block.classList.contains('active')); |
||||
|
||||
if (shouldBeActive) { |
||||
// Активируем все ответы только для этого комментария
|
||||
answerBlocks.forEach(block => { |
||||
block.classList.add('active'); |
||||
}); |
||||
|
||||
// Обновляем состояние кнопки
|
||||
answerbtn.querySelector('svg').classList.add('active'); |
||||
|
||||
// Обновляем текст кнопки
|
||||
let buttonText = answerbtn.querySelector('span'); |
||||
if (buttonText) { |
||||
buttonText.textContent = 'Свернуть'; |
||||
} |
||||
} else { |
||||
// Скрываем все ответы
|
||||
answerBlocks.forEach(block => { |
||||
block.classList.remove('active'); |
||||
}); |
||||
|
||||
// Обновляем состояние кнопки
|
||||
answerbtn.querySelector('svg').classList.remove('active'); |
||||
|
||||
// Обновляем текст кнопки в зависимости от количества ответов
|
||||
let buttonText = answerbtn.querySelector('span'); |
||||
if (buttonText) { |
||||
const count = answerBlocks.length; |
||||
buttonText.textContent = count === 1 ? 'ответ' : 'ответа'; |
||||
} |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
// Функция для получения блоков ответов, связанных с данной кнопкой
|
||||
function getRelatedAnswerBlocks(answerBtn) { |
||||
// Получаем следующий блок комментариев (если он есть)
|
||||
let currentElement = answerBtn; |
||||
let answerBlocks = []; |
||||
|
||||
// Собираем все блоки ответов до следующего основного комментария или кнопки ответов
|
||||
while ((currentElement = currentElement.nextElementSibling) !== null) { |
||||
if (currentElement.classList.contains('comment-block') && !currentElement.classList.contains('answer-block')) { |
||||
// Достигли следующего основного комментария, прерываем сбор
|
||||
break; |
||||
} else if (currentElement.classList.contains('answer-btn')) { |
||||
// Достигли следующей кнопки ответов, прерываем сбор
|
||||
break; |
||||
} else if (currentElement.classList.contains('answer-block')) { |
||||
// Это блок ответа, добавляем в коллекцию
|
||||
answerBlocks.push(currentElement); |
||||
} |
||||
} |
||||
|
||||
return answerBlocks; |
||||
} |
||||
|
||||
// Обработчики нажатия на кнопки ответов
|
||||
answerbtns.forEach((answerbtn) => { |
||||
answerbtn.addEventListener('click', () => { |
||||
// Получаем все блоки ответов для этого комментария
|
||||
const answerBlocks = getRelatedAnswerBlocks(answerbtn); |
||||
if (answerBlocks.length === 0) return; |
||||
|
||||
// Определяем, развернуты ли ответы сейчас
|
||||
const isCurrentlyActive = answerbtn.querySelector('svg').classList.contains('active'); |
||||
|
||||
// Переключаем состояние
|
||||
if (isCurrentlyActive) { |
||||
// Скрываем все ответы
|
||||
answerBlocks.forEach(block => { |
||||
block.classList.remove('active'); |
||||
}); |
||||
|
||||
// Обновляем состояние кнопки
|
||||
answerbtn.querySelector('svg').classList.remove('active'); |
||||
|
||||
// Обновляем текст кнопки
|
||||
let buttonText = answerbtn.querySelector('span'); |
||||
if (buttonText) { |
||||
const count = answerBlocks.length; |
||||
buttonText.textContent = count === 1 ? 'ответ' : 'ответа'; |
||||
} |
||||
} else { |
||||
// Показываем все ответы
|
||||
answerBlocks.forEach(block => { |
||||
block.classList.add('active'); |
||||
}); |
||||
|
||||
// Обновляем состояние кнопки
|
||||
answerbtn.querySelector('svg').classList.add('active'); |
||||
|
||||
// Обновляем текст кнопки
|
||||
let buttonText = answerbtn.querySelector('span'); |
||||
if (buttonText) { |
||||
buttonText.textContent = 'Свернуть'; |
||||
} |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
// Обработка нажатия на кнопку "Ответить" на комментарий
|
||||
document.addEventListener('DOMContentLoaded', function() { |
||||
// Получаем все кнопки "Ответить" на странице
|
||||
const replyButtons = document.querySelectorAll('.reply-to-comment'); |
||||
|
||||
// Добавляем обработчик на каждую кнопку
|
||||
replyButtons.forEach(button => { |
||||
button.addEventListener('click', function() { |
||||
// Получаем ID комментария, на который отвечаем
|
||||
const commentId = this.getAttribute('data-comment-id'); |
||||
const postId = this.getAttribute('data-post-id'); |
||||
const replyToName = this.getAttribute('data-reply-to'); |
||||
|
||||
// Получаем контейнер для формы ответа
|
||||
const replyFormContainer = document.getElementById('reply-form-' + commentId); |
||||
|
||||
// Если форма уже открыта, скрываем её
|
||||
if (replyFormContainer.style.display !== 'none') { |
||||
replyFormContainer.style.display = 'none'; |
||||
return; |
||||
} |
||||
|
||||
// Скрываем все открытые формы ответов
|
||||
document.querySelectorAll('.reply-form-container').forEach(container => { |
||||
container.style.display = 'none'; |
||||
}); |
||||
|
||||
// Клонируем основную форму комментариев
|
||||
const originalForm = document.getElementById('commentform'); |
||||
if (originalForm) { |
||||
const clonedForm = originalForm.cloneNode(true); |
||||
|
||||
// Изменяем атрибуты формы для ответа
|
||||
clonedForm.id = 'commentform-reply-' + commentId; |
||||
|
||||
// Добавляем скрытое поле с ID родительского комментария
|
||||
const hiddenInput = document.createElement('input'); |
||||
hiddenInput.type = 'hidden'; |
||||
hiddenInput.name = 'comment_parent'; |
||||
hiddenInput.value = commentId; |
||||
clonedForm.appendChild(hiddenInput); |
||||
|
||||
// Изменяем заголовок формы
|
||||
const formTitle = clonedForm.querySelector('.comment-reply-title'); |
||||
if (formTitle) { |
||||
formTitle.textContent = 'Ответить ' + replyToName; |
||||
} |
||||
|
||||
// Добавляем кнопку отмены
|
||||
const cancelButton = document.createElement('button'); |
||||
cancelButton.type = 'button'; |
||||
cancelButton.className = 'cancel-reply-btn'; |
||||
cancelButton.textContent = 'Отменить'; |
||||
cancelButton.addEventListener('click', function() { |
||||
replyFormContainer.style.display = 'none'; |
||||
}); |
||||
|
||||
// Добавляем кнопку отмены в форму
|
||||
const submitContainer = clonedForm.querySelector('.form-submit'); |
||||
if (submitContainer) { |
||||
submitContainer.appendChild(cancelButton); |
||||
} |
||||
|
||||
// Очищаем контейнер и добавляем клонированную форму
|
||||
replyFormContainer.innerHTML = ''; |
||||
replyFormContainer.appendChild(clonedForm); |
||||
|
||||
// Показываем форму
|
||||
replyFormContainer.style.display = 'block'; |
||||
|
||||
// Фокусируемся на текстовой области
|
||||
const textarea = clonedForm.querySelector('textarea'); |
||||
if (textarea) { |
||||
textarea.focus(); |
||||
} |
||||
} |
||||
}); |
||||
}); |
||||
}); |
||||
// comment
|
||||
let answerbtns = document.querySelectorAll('.answer-btn'); |
||||
let answerbtnicons = document.querySelectorAll('.answer-btn svg'); |
||||
|
||||
// При загрузке страницы проверяем активные кнопки
|
||||
document.addEventListener('DOMContentLoaded', function() { |
||||
// Для каждой кнопки ответов
|
||||
answerbtns.forEach((answerbtn) => { |
||||
// Находим родительский контейнер, чтобы искать ответы только для этого комментария
|
||||
const buttonParent = answerbtn.parentElement; |
||||
|
||||
// Находим все блоки ответов для этого комментария (после текущей кнопки)
|
||||
const answerBlocks = getRelatedAnswerBlocks(answerbtn); |
||||
if (answerBlocks.length === 0) return; |
||||
|
||||
// Проверяем, должны ли быть ответы развернуты (если у кнопки или любого ответа есть класс active)
|
||||
const shouldBeActive = answerbtn.querySelector('svg').classList.contains('active') ||
|
||||
Array.from(answerBlocks).some(block => block.classList.contains('active')); |
||||
|
||||
if (shouldBeActive) { |
||||
// Активируем все ответы только для этого комментария
|
||||
answerBlocks.forEach(block => { |
||||
block.classList.add('active'); |
||||
}); |
||||
|
||||
// Обновляем состояние кнопки
|
||||
answerbtn.querySelector('svg').classList.add('active'); |
||||
|
||||
// Обновляем текст кнопки
|
||||
let buttonText = answerbtn.querySelector('span'); |
||||
if (buttonText) { |
||||
buttonText.textContent = 'Свернуть'; |
||||
} |
||||
} else { |
||||
// Скрываем все ответы
|
||||
answerBlocks.forEach(block => { |
||||
block.classList.remove('active'); |
||||
}); |
||||
|
||||
// Обновляем состояние кнопки
|
||||
answerbtn.querySelector('svg').classList.remove('active'); |
||||
|
||||
// Обновляем текст кнопки в зависимости от количества ответов
|
||||
let buttonText = answerbtn.querySelector('span'); |
||||
if (buttonText) { |
||||
const count = answerBlocks.length; |
||||
buttonText.textContent = count === 1 ? 'ответ' : 'ответа'; |
||||
} |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
// Функция для получения блоков ответов, связанных с данной кнопкой
|
||||
function getRelatedAnswerBlocks(answerBtn) { |
||||
// Получаем следующий блок комментариев (если он есть)
|
||||
let currentElement = answerBtn; |
||||
let answerBlocks = []; |
||||
|
||||
// Собираем все блоки ответов до следующего основного комментария или кнопки ответов
|
||||
while ((currentElement = currentElement.nextElementSibling) !== null) { |
||||
if (currentElement.classList.contains('comment-block') && !currentElement.classList.contains('answer-block')) { |
||||
// Достигли следующего основного комментария, прерываем сбор
|
||||
break; |
||||
} else if (currentElement.classList.contains('answer-btn')) { |
||||
// Достигли следующей кнопки ответов, прерываем сбор
|
||||
break; |
||||
} else if (currentElement.classList.contains('answer-block')) { |
||||
// Это блок ответа, добавляем в коллекцию
|
||||
answerBlocks.push(currentElement); |
||||
} |
||||
} |
||||
|
||||
return answerBlocks; |
||||
} |
||||
|
||||
// Обработчики нажатия на кнопки ответов
|
||||
answerbtns.forEach((answerbtn) => { |
||||
answerbtn.addEventListener('click', () => { |
||||
// Получаем все блоки ответов для этого комментария
|
||||
const answerBlocks = getRelatedAnswerBlocks(answerbtn); |
||||
if (answerBlocks.length === 0) return; |
||||
|
||||
// Определяем, развернуты ли ответы сейчас
|
||||
const isCurrentlyActive = answerbtn.querySelector('svg').classList.contains('active'); |
||||
|
||||
// Переключаем состояние
|
||||
if (isCurrentlyActive) { |
||||
// Скрываем все ответы
|
||||
answerBlocks.forEach(block => { |
||||
block.classList.remove('active'); |
||||
}); |
||||
|
||||
// Обновляем состояние кнопки
|
||||
answerbtn.querySelector('svg').classList.remove('active'); |
||||
|
||||
// Обновляем текст кнопки
|
||||
let buttonText = answerbtn.querySelector('span'); |
||||
if (buttonText) { |
||||
const count = answerBlocks.length; |
||||
buttonText.textContent = count === 1 ? 'ответ' : 'ответа'; |
||||
} |
||||
} else { |
||||
// Показываем все ответы
|
||||
answerBlocks.forEach(block => { |
||||
block.classList.add('active'); |
||||
}); |
||||
|
||||
// Обновляем состояние кнопки
|
||||
answerbtn.querySelector('svg').classList.add('active'); |
||||
|
||||
// Обновляем текст кнопки
|
||||
let buttonText = answerbtn.querySelector('span'); |
||||
if (buttonText) { |
||||
buttonText.textContent = 'Свернуть'; |
||||
} |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
// Обработка нажатия на кнопку "Ответить" на комментарий
|
||||
document.addEventListener('DOMContentLoaded', function() { |
||||
// Получаем все кнопки "Ответить" на странице
|
||||
const replyButtons = document.querySelectorAll('.reply-to-comment'); |
||||
|
||||
// Добавляем обработчик на каждую кнопку
|
||||
replyButtons.forEach(button => { |
||||
button.addEventListener('click', function() { |
||||
// Получаем ID комментария, на который отвечаем
|
||||
const commentId = this.getAttribute('data-comment-id'); |
||||
const postId = this.getAttribute('data-post-id'); |
||||
const replyToName = this.getAttribute('data-reply-to'); |
||||
|
||||
// Получаем контейнер для формы ответа
|
||||
const replyFormContainer = document.getElementById('reply-form-' + commentId); |
||||
|
||||
// Если форма уже открыта, скрываем её
|
||||
if (replyFormContainer.style.display !== 'none') { |
||||
replyFormContainer.style.display = 'none'; |
||||
return; |
||||
} |
||||
|
||||
// Скрываем все открытые формы ответов
|
||||
document.querySelectorAll('.reply-form-container').forEach(container => { |
||||
container.style.display = 'none'; |
||||
}); |
||||
|
||||
// Клонируем основную форму комментариев
|
||||
const originalForm = document.getElementById('commentform'); |
||||
if (originalForm) { |
||||
const clonedForm = originalForm.cloneNode(true); |
||||
|
||||
// Изменяем атрибуты формы для ответа
|
||||
clonedForm.id = 'commentform-reply-' + commentId; |
||||
|
||||
// Добавляем скрытое поле с ID родительского комментария
|
||||
const hiddenInput = document.createElement('input'); |
||||
hiddenInput.type = 'hidden'; |
||||
hiddenInput.name = 'comment_parent'; |
||||
hiddenInput.value = commentId; |
||||
clonedForm.appendChild(hiddenInput); |
||||
|
||||
// Изменяем заголовок формы
|
||||
const formTitle = clonedForm.querySelector('.comment-reply-title'); |
||||
if (formTitle) { |
||||
formTitle.textContent = 'Ответить ' + replyToName; |
||||
} |
||||
|
||||
// Добавляем кнопку отмены
|
||||
const cancelButton = document.createElement('button'); |
||||
cancelButton.type = 'button'; |
||||
cancelButton.className = 'cancel-reply-btn'; |
||||
cancelButton.textContent = 'Отменить'; |
||||
cancelButton.addEventListener('click', function() { |
||||
replyFormContainer.style.display = 'none'; |
||||
}); |
||||
|
||||
// Добавляем кнопку отмены в форму
|
||||
const submitContainer = clonedForm.querySelector('.form-submit'); |
||||
if (submitContainer) { |
||||
submitContainer.appendChild(cancelButton); |
||||
} |
||||
|
||||
// Очищаем контейнер и добавляем клонированную форму
|
||||
replyFormContainer.innerHTML = ''; |
||||
replyFormContainer.appendChild(clonedForm); |
||||
|
||||
// Показываем форму
|
||||
replyFormContainer.style.display = 'block'; |
||||
|
||||
// Фокусируемся на текстовой области
|
||||
const textarea = clonedForm.querySelector('textarea'); |
||||
if (textarea) { |
||||
textarea.focus(); |
||||
} |
||||
} |
||||
}); |
||||
}); |
||||
}); |
||||
|
@ -1,200 +1,200 @@ |
||||
/* Editorial */ |
||||
.editorial { |
||||
padding-bottom: 68px; |
||||
} |
||||
|
||||
.editorial-head { |
||||
position: relative; |
||||
z-index: 1; |
||||
max-width: 841px; |
||||
margin-bottom: 37px; |
||||
} |
||||
|
||||
.editorial-head__title { |
||||
font-size: 82px; |
||||
line-height: 96px; |
||||
font-weight: bold; |
||||
color: var(--main_white); |
||||
text-transform: uppercase; |
||||
} |
||||
|
||||
.editorial-head__img { |
||||
position: absolute; |
||||
z-index: -1; |
||||
top: -14px; |
||||
right: -20px; |
||||
width: 221px; |
||||
} |
||||
|
||||
.editorial-head__star { |
||||
position: absolute; |
||||
top: 8.26px; |
||||
right: -13.5px; |
||||
transform: translateX(100%); |
||||
width: 87.5px; |
||||
} |
||||
|
||||
.editorial-card__wrap { |
||||
display: grid; |
||||
grid-template-columns: repeat(2, minmax(0, 1fr)); |
||||
gap: 31px 25px; |
||||
position: relative; |
||||
z-index: 1; |
||||
} |
||||
|
||||
.editorial-card { |
||||
border: 2px solid var(--creme-white); |
||||
border-radius: 30px; |
||||
display: flex; |
||||
align-items: stretch; |
||||
overflow: hidden; |
||||
background: var(--linear); |
||||
backdrop-filter: blur(28px); |
||||
} |
||||
|
||||
.editorial-card .main-img { |
||||
min-height: 282px; |
||||
width: 207px; |
||||
border-radius: 29px; |
||||
overflow: hidden; |
||||
flex-shrink: 0; |
||||
} |
||||
|
||||
.editorial-card:hover .main-img img{ |
||||
width: 120%; |
||||
height: 120%; |
||||
} |
||||
|
||||
.editorial-card .main-img img { |
||||
width: 100%; |
||||
height: 100%; |
||||
object-fit: cover; |
||||
transition: all .5s; |
||||
} |
||||
|
||||
.editorial-card__content { |
||||
padding: 42px 19px 19px 35px; |
||||
} |
||||
|
||||
.editorial-card__content-alerts { |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
align-items: center; |
||||
gap: 7px; |
||||
margin-bottom: 17px; |
||||
} |
||||
|
||||
.editorial-card__content-alerts a { |
||||
background: var(--main_black); |
||||
border-radius: 16px; |
||||
padding: 6px 8px; |
||||
font-size: 16px; |
||||
font-weight: 500; |
||||
line-height: 20px; |
||||
color: var(--background); |
||||
} |
||||
|
||||
.editorial-card__content-title { |
||||
font-size: 28px; |
||||
font-weight: bold; |
||||
line-height: 32px; |
||||
color: var(--grey-black); |
||||
text-transform: uppercase; |
||||
margin-bottom: 17px; |
||||
} |
||||
|
||||
.editorial-card__content-data { |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
gap: 5px 16px; |
||||
color: var(--interface_hover); |
||||
font-size: 16px; |
||||
font-weight: 500; |
||||
line-height: 20px; |
||||
} |
||||
|
||||
.editorial-card__content-data ul { |
||||
display: flex; |
||||
align-items: center; |
||||
gap: 16px; |
||||
} |
||||
|
||||
.editorial-card__content-data li { |
||||
display: flex; |
||||
align-items: center; |
||||
gap: 5px; |
||||
} |
||||
|
||||
.editorial-card__content-data .logo img { |
||||
width: 24px; |
||||
height: 24px; |
||||
border-radius: 50%; |
||||
object-fit: cover; |
||||
} |
||||
/* Editorial end */ |
||||
|
||||
@media (max-width: 1200px) { |
||||
.editorial-card__wrap { |
||||
grid-template-columns: repeat(1, minmax(0, 1fr)); |
||||
} |
||||
} |
||||
|
||||
@media (max-width: 992px) { |
||||
.editorial { |
||||
padding-bottom: 36px; |
||||
} |
||||
|
||||
.editorial-head { |
||||
margin-bottom: 36px; |
||||
max-width: 313px; |
||||
} |
||||
|
||||
.editorial-head__title { |
||||
font-size: 32px; |
||||
line-height: 38px; |
||||
} |
||||
|
||||
.editorial-head__img { |
||||
width: 100px; |
||||
top: -14px; |
||||
right: -22.5px; |
||||
} |
||||
|
||||
.editorial-head__star { |
||||
display: none; |
||||
} |
||||
} |
||||
|
||||
@media (max-width: 576px) { |
||||
.editorial-card { |
||||
flex-direction: column; |
||||
border-radius: 30px; |
||||
position: relative; |
||||
} |
||||
|
||||
.editorial-card .main-img { |
||||
width: 100%; |
||||
height: 203px; |
||||
} |
||||
|
||||
.editorial-card__content { |
||||
padding: 17px 13px 24px; |
||||
} |
||||
|
||||
.editorial-card__content-alerts { |
||||
position: absolute; |
||||
top: 13px; |
||||
left: 8px; |
||||
width: calc(100% - 16px); |
||||
} |
||||
|
||||
.editorial-card__content-title { |
||||
font-size: 20px; |
||||
line-height: 24px; |
||||
margin-bottom: 17px; |
||||
} |
||||
|
||||
.editorial-card__content-data { |
||||
gap: 5px 16px; |
||||
} |
||||
/* Editorial */ |
||||
.editorial { |
||||
padding-bottom: 68px; |
||||
} |
||||
|
||||
.editorial-head { |
||||
position: relative; |
||||
z-index: 1; |
||||
max-width: 841px; |
||||
margin-bottom: 37px; |
||||
} |
||||
|
||||
.editorial-head__title { |
||||
font-size: 82px; |
||||
line-height: 96px; |
||||
font-weight: bold; |
||||
color: var(--main_white); |
||||
text-transform: uppercase; |
||||
} |
||||
|
||||
.editorial-head__img { |
||||
position: absolute; |
||||
z-index: -1; |
||||
top: -14px; |
||||
right: -20px; |
||||
width: 221px; |
||||
} |
||||
|
||||
.editorial-head__star { |
||||
position: absolute; |
||||
top: 8.26px; |
||||
right: -13.5px; |
||||
transform: translateX(100%); |
||||
width: 87.5px; |
||||
} |
||||
|
||||
.editorial-card__wrap { |
||||
display: grid; |
||||
grid-template-columns: repeat(2, minmax(0, 1fr)); |
||||
gap: 31px 25px; |
||||
position: relative; |
||||
z-index: 1; |
||||
} |
||||
|
||||
.editorial-card { |
||||
border: 2px solid var(--creme-white); |
||||
border-radius: 30px; |
||||
display: flex; |
||||
align-items: stretch; |
||||
overflow: hidden; |
||||
background: var(--linear); |
||||
backdrop-filter: blur(28px); |
||||
} |
||||
|
||||
.editorial-card .main-img { |
||||
min-height: 282px; |
||||
width: 207px; |
||||
border-radius: 29px; |
||||
overflow: hidden; |
||||
flex-shrink: 0; |
||||
} |
||||
|
||||
.editorial-card:hover .main-img img{ |
||||
width: 120%; |
||||
height: 120%; |
||||
} |
||||
|
||||
.editorial-card .main-img img { |
||||
width: 100%; |
||||
height: 100%; |
||||
object-fit: cover; |
||||
transition: all .5s; |
||||
} |
||||
|
||||
.editorial-card__content { |
||||
padding: 42px 19px 19px 35px; |
||||
} |
||||
|
||||
.editorial-card__content-alerts { |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
align-items: center; |
||||
gap: 7px; |
||||
margin-bottom: 17px; |
||||
} |
||||
|
||||
.editorial-card__content-alerts a { |
||||
background: var(--main_black); |
||||
border-radius: 16px; |
||||
padding: 6px 8px; |
||||
font-size: 16px; |
||||
font-weight: 500; |
||||
line-height: 20px; |
||||
color: var(--background); |
||||
} |
||||
|
||||
.editorial-card__content-title { |
||||
font-size: 28px; |
||||
font-weight: bold; |
||||
line-height: 32px; |
||||
color: var(--grey-black); |
||||
text-transform: uppercase; |
||||
margin-bottom: 17px; |
||||
} |
||||
|
||||
.editorial-card__content-data { |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
gap: 5px 16px; |
||||
color: var(--interface_hover); |
||||
font-size: 16px; |
||||
font-weight: 500; |
||||
line-height: 20px; |
||||
} |
||||
|
||||
.editorial-card__content-data ul { |
||||
display: flex; |
||||
align-items: center; |
||||
gap: 16px; |
||||
} |
||||
|
||||
.editorial-card__content-data li { |
||||
display: flex; |
||||
align-items: center; |
||||
gap: 5px; |
||||
} |
||||
|
||||
.editorial-card__content-data .logo img { |
||||
width: 24px; |
||||
height: 24px; |
||||
border-radius: 50%; |
||||
object-fit: cover; |
||||
} |
||||
/* Editorial end */ |
||||
|
||||
@media (max-width: 1200px) { |
||||
.editorial-card__wrap { |
||||
grid-template-columns: repeat(1, minmax(0, 1fr)); |
||||
} |
||||
} |
||||
|
||||
@media (max-width: 992px) { |
||||
.editorial { |
||||
padding-bottom: 36px; |
||||
} |
||||
|
||||
.editorial-head { |
||||
margin-bottom: 36px; |
||||
max-width: 313px; |
||||
} |
||||
|
||||
.editorial-head__title { |
||||
font-size: 32px; |
||||
line-height: 38px; |
||||
} |
||||
|
||||
.editorial-head__img { |
||||
width: 100px; |
||||
top: -14px; |
||||
right: -22.5px; |
||||
} |
||||
|
||||
.editorial-head__star { |
||||
display: none; |
||||
} |
||||
} |
||||
|
||||
@media (max-width: 576px) { |
||||
.editorial-card { |
||||
flex-direction: column; |
||||
border-radius: 30px; |
||||
position: relative; |
||||
} |
||||
|
||||
.editorial-card .main-img { |
||||
width: 100%; |
||||
height: 203px; |
||||
} |
||||
|
||||
.editorial-card__content { |
||||
padding: 17px 13px 24px; |
||||
} |
||||
|
||||
.editorial-card__content-alerts { |
||||
position: absolute; |
||||
top: 13px; |
||||
left: 8px; |
||||
width: calc(100% - 16px); |
||||
} |
||||
|
||||
.editorial-card__content-title { |
||||
font-size: 20px; |
||||
line-height: 24px; |
||||
margin-bottom: 17px; |
||||
} |
||||
|
||||
.editorial-card__content-data { |
||||
gap: 5px 16px; |
||||
} |
||||
} |
@ -1,147 +1,147 @@ |
||||
jQuery(document).ready(function ($) { |
||||
$(".comment-btn button").on("click", function () { |
||||
var postId = $(this).data("post-id"); |
||||
var $button = $(this); |
||||
|
||||
$.ajax({ |
||||
url: "/wp-admin/admin-ajax.php", |
||||
type: "POST", |
||||
data: { |
||||
action: "add_post_like", |
||||
post_id: postId, |
||||
}, |
||||
success: function (response) { |
||||
if (response.error) { |
||||
alert(response.error); |
||||
window.location.href = "/wp-login.php"; |
||||
return; |
||||
} |
||||
|
||||
$(".comment-btn span").text(response.count); |
||||
|
||||
if (response.is_liked) { |
||||
$button.addClass("active"); |
||||
|
||||
$button.find("svg path").attr({ |
||||
fill: "rgba(255, 0, 0, 0.7)", |
||||
stroke: "#ff0000", |
||||
}); |
||||
} else { |
||||
$button.removeClass("active"); |
||||
|
||||
$button.find("svg path").attr({ |
||||
fill: "rgb(18, 18, 18)", |
||||
stroke: "#666666", |
||||
}); |
||||
} |
||||
}, |
||||
error: function (error) { |
||||
if (error.responseJSON && error.responseJSON.data) { |
||||
alert(error.responseJSON.data); |
||||
window.location.href = "/wp-login.php"; |
||||
} |
||||
}, |
||||
}); |
||||
}); |
||||
|
||||
$(document).on("click", ".comment-like-btn", function () { |
||||
var commentId = $(this).data("comment-id"); |
||||
var $button = $(this); |
||||
|
||||
$.ajax({ |
||||
url: "/wp-admin/admin-ajax.php", |
||||
type: "POST", |
||||
data: { |
||||
action: "add_comment_like", |
||||
comment_id: commentId, |
||||
}, |
||||
success: function (response) { |
||||
if (response.error) { |
||||
alert(response.error); |
||||
window.location.href = "/wp-login.php"; |
||||
return; |
||||
} |
||||
|
||||
if (response.is_liked) { |
||||
$button |
||||
.empty() |
||||
.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>' |
||||
) |
||||
) |
||||
.append(response.count); |
||||
$button.addClass("active"); |
||||
} else { |
||||
$button |
||||
.empty() |
||||
.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>' |
||||
) |
||||
) |
||||
.append(response.count); |
||||
$button.removeClass("active"); |
||||
} |
||||
}, |
||||
error: function (error) { |
||||
if (error.responseJSON && error.responseJSON.data) { |
||||
alert(error.responseJSON.data); |
||||
window.location.href = "/wp-login.php"; |
||||
} |
||||
}, |
||||
}); |
||||
}); |
||||
|
||||
function checkLikedPosts() { |
||||
if (!document.body.classList.contains("logged-in")) { |
||||
return; |
||||
} |
||||
|
||||
$.ajax({ |
||||
url: "/wp-admin/admin-ajax.php", |
||||
type: "POST", |
||||
data: { |
||||
action: "check_user_likes", |
||||
}, |
||||
success: function (response) { |
||||
if (response.error) { |
||||
return; |
||||
} |
||||
|
||||
try { |
||||
var data = JSON.parse(response); |
||||
|
||||
if (data.posts && data.posts.length > 0) { |
||||
for (var i = 0; i < data.posts.length; i++) { |
||||
var $button = $('.comment-btn button[data-post-id="' + data.posts[i] + '"]'); |
||||
$button.addClass("active"); |
||||
$button.find("svg path").attr({ |
||||
fill: "rgba(255, 0, 0, 0.7)", |
||||
stroke: "#ff0000", |
||||
}); |
||||
} |
||||
} |
||||
|
||||
if (data.comments && data.comments.length > 0) { |
||||
for (var j = 0; j < data.comments.length; j++) { |
||||
var $commentButton = $('.comment-like-btn[data-comment-id="' + data.comments[j] + '"]'); |
||||
$commentButton.addClass("active"); |
||||
|
||||
$commentButton.find("svg path").attr({ |
||||
fill: "rgba(255, 0, 0, 0.7)", |
||||
stroke: "#ff0000", |
||||
}); |
||||
} |
||||
} |
||||
} catch (e) {} |
||||
}, |
||||
error: function (error) {}, |
||||
}); |
||||
} |
||||
|
||||
if (document.body.classList.contains("logged-in")) { |
||||
checkLikedPosts(); |
||||
} |
||||
}); |
||||
jQuery(document).ready(function ($) { |
||||
$(".comment-btn button").on("click", function () { |
||||
var postId = $(this).data("post-id"); |
||||
var $button = $(this); |
||||
|
||||
$.ajax({ |
||||
url: "/wp-admin/admin-ajax.php", |
||||
type: "POST", |
||||
data: { |
||||
action: "add_post_like", |
||||
post_id: postId, |
||||
}, |
||||
success: function (response) { |
||||
if (response.error) { |
||||
alert(response.error); |
||||
window.location.href = "/wp-login.php"; |
||||
return; |
||||
} |
||||
|
||||
$(".comment-btn span").text(response.count); |
||||
|
||||
if (response.is_liked) { |
||||
$button.addClass("active"); |
||||
|
||||
$button.find("svg path").attr({ |
||||
fill: "rgba(255, 0, 0, 0.7)", |
||||
stroke: "#ff0000", |
||||
}); |
||||
} else { |
||||
$button.removeClass("active"); |
||||
|
||||
$button.find("svg path").attr({ |
||||
fill: "rgb(18, 18, 18)", |
||||
stroke: "#666666", |
||||
}); |
||||
} |
||||
}, |
||||
error: function (error) { |
||||
if (error.responseJSON && error.responseJSON.data) { |
||||
alert(error.responseJSON.data); |
||||
window.location.href = "/wp-login.php"; |
||||
} |
||||
}, |
||||
}); |
||||
}); |
||||
|
||||
$(document).on("click", ".comment-like-btn", function () { |
||||
var commentId = $(this).data("comment-id"); |
||||
var $button = $(this); |
||||
|
||||
$.ajax({ |
||||
url: "/wp-admin/admin-ajax.php", |
||||
type: "POST", |
||||
data: { |
||||
action: "add_comment_like", |
||||
comment_id: commentId, |
||||
}, |
||||
success: function (response) { |
||||
if (response.error) { |
||||
alert(response.error); |
||||
window.location.href = "/wp-login.php"; |
||||
return; |
||||
} |
||||
|
||||
if (response.is_liked) { |
||||
$button |
||||
.empty() |
||||
.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>' |
||||
) |
||||
) |
||||
.append(response.count); |
||||
$button.addClass("active"); |
||||
} else { |
||||
$button |
||||
.empty() |
||||
.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>' |
||||
) |
||||
) |
||||
.append(response.count); |
||||
$button.removeClass("active"); |
||||
} |
||||
}, |
||||
error: function (error) { |
||||
if (error.responseJSON && error.responseJSON.data) { |
||||
alert(error.responseJSON.data); |
||||
window.location.href = "/wp-login.php"; |
||||
} |
||||
}, |
||||
}); |
||||
}); |
||||
|
||||
function checkLikedPosts() { |
||||
if (!document.body.classList.contains("logged-in")) { |
||||
return; |
||||
} |
||||
|
||||
$.ajax({ |
||||
url: "/wp-admin/admin-ajax.php", |
||||
type: "POST", |
||||
data: { |
||||
action: "check_user_likes", |
||||
}, |
||||
success: function (response) { |
||||
if (response.error) { |
||||
return; |
||||
} |
||||
|
||||
try { |
||||
var data = JSON.parse(response); |
||||
|
||||
if (data.posts && data.posts.length > 0) { |
||||
for (var i = 0; i < data.posts.length; i++) { |
||||
var $button = $('.comment-btn button[data-post-id="' + data.posts[i] + '"]'); |
||||
$button.addClass("active"); |
||||
$button.find("svg path").attr({ |
||||
fill: "rgba(255, 0, 0, 0.7)", |
||||
stroke: "#ff0000", |
||||
}); |
||||
} |
||||
} |
||||
|
||||
if (data.comments && data.comments.length > 0) { |
||||
for (var j = 0; j < data.comments.length; j++) { |
||||
var $commentButton = $('.comment-like-btn[data-comment-id="' + data.comments[j] + '"]'); |
||||
$commentButton.addClass("active"); |
||||
|
||||
$commentButton.find("svg path").attr({ |
||||
fill: "rgba(255, 0, 0, 0.7)", |
||||
stroke: "#ff0000", |
||||
}); |
||||
} |
||||
} |
||||
} catch (e) {} |
||||
}, |
||||
error: function (error) {}, |
||||
}); |
||||
} |
||||
|
||||
if (document.body.classList.contains("logged-in")) { |
||||
checkLikedPosts(); |
||||
} |
||||
}); |
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,96 +1,96 @@ |
||||
'use strict'; |
||||
|
||||
|
||||
let widthPhoneCabinet = 1200; |
||||
|
||||
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) { |
||||
let elements = document.querySelectorAll(mainElement); |
||||
|
||||
elements.forEach(e => { |
||||
let thisMainElement = e, |
||||
thisButtonElement = e.querySelector(buttonElement), |
||||
thisHeightElement = e.querySelector(heightElement), |
||||
thisContentElement = e.querySelector(contentElement);
|
||||
if (thisButtonElement){ |
||||
thisButtonElement.onclick = function (e) { |
||||
let height = thisHeightElement.clientHeight; |
||||
|
||||
if (close == true && !thisMainElement.classList.contains('active')) { |
||||
elements.forEach(e => { |
||||
if (e.classList.contains('active')) { |
||||
e.classList.remove('active'); |
||||
e.querySelector(contentElement).style.height = null |
||||
}
|
||||
}) |
||||
} |
||||
|
||||
if (!thisMainElement.classList.contains('active')) { |
||||
thisContentElement.style.height = `${height}px`; |
||||
thisMainElement.classList.add('active'); |
||||
}else{ |
||||
thisContentElement.style.height = null; |
||||
thisMainElement.classList.remove('active'); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
}); |
||||
} |
||||
|
||||
jQuery('.cabinet-card__button').on('click', function(){ |
||||
var id = jQuery(this).data('edit') |
||||
jQuery(`#pet_edit_` + id).addClass('active') |
||||
}) |
||||
|
||||
jQuery('.form-sub__btn').on('click', function(){ |
||||
jQuery(`#subForm`).addClass('active') |
||||
}) |
||||
|
||||
jQuery('.user-edit-open').on('click', function(){ |
||||
jQuery(`#user_edit`).addClass('active') |
||||
}) |
||||
|
||||
jQuery('.cabinet-card__block-add-pets').on('click', function(){ |
||||
jQuery(`#pet_add_form`).addClass('active') |
||||
}) |
||||
|
||||
|
||||
jQuery(document).ready(function ($) { |
||||
$('.subscription-address-form').on('submit', function (e) { |
||||
e.preventDefault(); |
||||
|
||||
var $form = $(this); |
||||
var $message = $form.find('.form-message'); |
||||
var subscriptionId = $form.data('subscription-id'); |
||||
var address = $form.find('input[name="address"]').val(); |
||||
var comment = $form.find('textarea[name="comment"]').val(); |
||||
var nonce = $form.find('input[name="address_nonce"]').val(); |
||||
|
||||
$message.hide().removeClass('success error').empty(); |
||||
|
||||
$.ajax({ |
||||
url: '/wp-admin/admin-ajax.php', // Defined in wp_localize_script
|
||||
type: 'POST', |
||||
data: { |
||||
action: 'update_subscription_address', |
||||
subscription_id: subscriptionId, |
||||
address: address, |
||||
comment: comment, |
||||
address_nonce: nonce |
||||
}, |
||||
success: function (response) { |
||||
if (response.success) { |
||||
$message.addClass('success').text(response.data.message).show(); |
||||
} else { |
||||
$message.addClass('error').text(response.data.message).show(); |
||||
} |
||||
}, |
||||
error: function () { |
||||
|
||||
} |
||||
}); |
||||
}); |
||||
}); |
||||
'use strict'; |
||||
|
||||
|
||||
let widthPhoneCabinet = 1200; |
||||
|
||||
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) { |
||||
let elements = document.querySelectorAll(mainElement); |
||||
|
||||
elements.forEach(e => { |
||||
let thisMainElement = e, |
||||
thisButtonElement = e.querySelector(buttonElement), |
||||
thisHeightElement = e.querySelector(heightElement), |
||||
thisContentElement = e.querySelector(contentElement);
|
||||
if (thisButtonElement){ |
||||
thisButtonElement.onclick = function (e) { |
||||
let height = thisHeightElement.clientHeight; |
||||
|
||||
if (close == true && !thisMainElement.classList.contains('active')) { |
||||
elements.forEach(e => { |
||||
if (e.classList.contains('active')) { |
||||
e.classList.remove('active'); |
||||
e.querySelector(contentElement).style.height = null |
||||
}
|
||||
}) |
||||
} |
||||
|
||||
if (!thisMainElement.classList.contains('active')) { |
||||
thisContentElement.style.height = `${height}px`; |
||||
thisMainElement.classList.add('active'); |
||||
}else{ |
||||
thisContentElement.style.height = null; |
||||
thisMainElement.classList.remove('active'); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
}); |
||||
} |
||||
|
||||
jQuery('.cabinet-card__button').on('click', function(){ |
||||
var id = jQuery(this).data('edit') |
||||
jQuery(`#pet_edit_` + id).addClass('active') |
||||
}) |
||||
|
||||
jQuery('.form-sub__btn').on('click', function(){ |
||||
jQuery(`#subForm`).addClass('active') |
||||
}) |
||||
|
||||
jQuery('.user-edit-open').on('click', function(){ |
||||
jQuery(`#user_edit`).addClass('active') |
||||
}) |
||||
|
||||
jQuery('.cabinet-card__block-add-pets').on('click', function(){ |
||||
jQuery(`#pet_add_form`).addClass('active') |
||||
}) |
||||
|
||||
|
||||
jQuery(document).ready(function ($) { |
||||
$('.subscription-address-form').on('submit', function (e) { |
||||
e.preventDefault(); |
||||
|
||||
var $form = $(this); |
||||
var $message = $form.find('.form-message'); |
||||
var subscriptionId = $form.data('subscription-id'); |
||||
var address = $form.find('input[name="address"]').val(); |
||||
var comment = $form.find('textarea[name="comment"]').val(); |
||||
var nonce = $form.find('input[name="address_nonce"]').val(); |
||||
|
||||
$message.hide().removeClass('success error').empty(); |
||||
|
||||
$.ajax({ |
||||
url: '/wp-admin/admin-ajax.php', // Defined in wp_localize_script
|
||||
type: 'POST', |
||||
data: { |
||||
action: 'update_subscription_address', |
||||
subscription_id: subscriptionId, |
||||
address: address, |
||||
comment: comment, |
||||
address_nonce: nonce |
||||
}, |
||||
success: function (response) { |
||||
if (response.success) { |
||||
$message.addClass('success').text(response.data.message).show(); |
||||
} else { |
||||
$message.addClass('error').text(response.data.message).show(); |
||||
} |
||||
}, |
||||
error: function () { |
||||
|
||||
} |
||||
}); |
||||
}); |
||||
}); |
||||
|
@ -1,193 +1,193 @@ |
||||
<?php |
||||
|
||||
// namespace Cdek\UI; |
||||
|
||||
// use Cdek\UI\Cdek\CdekApi; |
||||
// use Cdek\UI\Cdek\Config; |
||||
// use Cdek\UI\Cdek\Helpers\WeightCalc; |
||||
// use Cdek\UI\Cdek\MetaKeys; |
||||
// use Cdek\UI\Exception; |
||||
// use Cdek\UI\WC_Order_Item_Shipping; |
||||
// $api = new CdekApi(); |
||||
|
||||
$context = Timber::get_context(); |
||||
|
||||
$current_user = wp_get_current_user(); |
||||
$context['current_user'] = $current_user; |
||||
$context['first_name'] = $current_user->user_firstname; |
||||
$context['last_name'] = $current_user->user_lastname; |
||||
$context['email'] = $current_user->user_email; |
||||
$context['phone'] = get_user_meta($current_user->ID, 'billing_phone', true); |
||||
$context['tg_account'] = get_user_meta($current_user->ID, 'tg_account', true); |
||||
|
||||
// ACF поля для пользователя |
||||
$context['activated'] = get_field('activated', 'user_' . get_current_user_id()); |
||||
$context['uuid'] = get_field('uuid', 'user_' . get_current_user_id()); |
||||
|
||||
// Запрос для питомцев |
||||
$current_user_id = get_current_user_id(); |
||||
if ($current_user_id) { |
||||
$args = [ |
||||
'post_type' => 'pets', |
||||
'meta_query' => [ |
||||
[ |
||||
'key' => 'user', |
||||
'value' => $current_user_id, |
||||
'compare' => '=' |
||||
] |
||||
] |
||||
]; |
||||
$context['pets'] = Timber::get_posts($args); |
||||
} |
||||
|
||||
// Заказы пользователя |
||||
$context['customer_orders'] = wc_get_orders(['customer_id' => $current_user->ID]); |
||||
// В page-profile.php, внутри цикла заказов |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// foreach ($context['customer_orders'] as &$order) { |
||||
// $meta_data = get_post_meta($order->get_id(), 'order_data', true); |
||||
// if (isset($meta_data['office_code'])) { |
||||
// $office_data = json_decode($api->getOffices(['code' => $meta_data['office_code']])['body'], true); |
||||
// $order->office_name = $office_data[0]['name'] ?? ''; |
||||
// } |
||||
// } |
||||
|
||||
|
||||
|
||||
|
||||
$context['bot_username'] = defined('BOT_USERNAME') ? BOT_USERNAME : ''; |
||||
|
||||
// Текущий пользователь |
||||
$current_user_id = get_current_user_id(); |
||||
$context['current_user_id'] = $current_user_id; |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Запрос для питомцев |
||||
// if ($current_user_id) { |
||||
// $args = [ |
||||
// 'post_type' => 'pets', |
||||
// 'meta_query' => [ |
||||
// [ |
||||
// 'key' => 'user', |
||||
// 'value' => $current_user_id, |
||||
// 'compare' => '=' |
||||
// ] |
||||
// ] |
||||
// ]; |
||||
// $pets = Timber::get_posts($args); |
||||
|
||||
// // Обработка ACF-полей для каждого питомца |
||||
// foreach ($pets as &$pet) { |
||||
// // ACF-поля |
||||
// $pet->weight = get_field('weight', $pet->ID); |
||||
// $pet->old = get_field('old', $pet->ID); |
||||
// $pet->activity = get_field('activity', $pet->ID); |
||||
|
||||
// // Перевод веса |
||||
// switch ($pet->weight) { |
||||
// case 'below_1_5': |
||||
// $pet->weight_text = __('from 0,5 kg to 1,5 kg', 'woodmart'); |
||||
// break; |
||||
// case '1_5-3': |
||||
// $pet->weight_text = __('from 1.5 to 3 kg', 'woodmart'); |
||||
// break; |
||||
// case '3-5': |
||||
// $pet->weight_text = __('from 3 to 5 kg', 'woodmart'); |
||||
// break; |
||||
// case '5-8': |
||||
// $pet->weight_text = __('from 5 to 8 kg', 'woodmart'); |
||||
// break; |
||||
// case '8-11': |
||||
// $pet->weight_text = __('from 8 to 11 kg', 'woodmart'); |
||||
// break; |
||||
// case '11-15': |
||||
// $pet->weight_text = __('from 11 to 15 kg', 'woodmart'); |
||||
// break; |
||||
// case '15-20': |
||||
// $pet->weight_text = __('from 15 to 20 kg', 'woodmart'); |
||||
// break; |
||||
// case '20-25': |
||||
// $pet->weight_text = __('from 20 to 25 kg', 'woodmart'); |
||||
// break; |
||||
// case '25-35': |
||||
// $pet->weight_text = __('from 25 to 35 kg', 'woodmart'); |
||||
// break; |
||||
// case 'more_35': |
||||
// $pet->weight_text = __('More than 35 kg', 'woodmart'); |
||||
// break; |
||||
// default: |
||||
// $pet->weight_text = ''; |
||||
// } |
||||
|
||||
// // Перевод возраста |
||||
// switch ($pet->old) { |
||||
// case 'normal': |
||||
// $pet->old_text = __('Adult (from 1 year to 7 years)', 'woodmart'); |
||||
// break; |
||||
// case 'old': |
||||
// $pet->old_text = __('Elderly (from 7 to 12 years)', 'woodmart'); |
||||
// break; |
||||
// case 'very_old': |
||||
// $pet->old_text = __('Aging (12 years and older)', 'woodmart'); |
||||
// break; |
||||
// case 'baby': |
||||
// $pet->old_text = __('Baby (from 0 to 1 year)', 'woodmart'); |
||||
// break; |
||||
// default: |
||||
// $pet->old_text = ''; |
||||
// } |
||||
|
||||
// // Перевод активности |
||||
// switch ($pet->activity) { |
||||
// case 'low': |
||||
// $pet->activity_text = __('Low', 'woodmart'); |
||||
// break; |
||||
// case 'moderate': |
||||
// $pet->activity_text = __('Moderate', 'woodmart'); |
||||
// break; |
||||
// case 'high': |
||||
// $pet->activity_text = __('High', 'woodmart'); |
||||
// break; |
||||
// default: |
||||
// $pet->activity_text = ''; |
||||
// } |
||||
// } |
||||
|
||||
// $context['pets'] = $pets; |
||||
// } |
||||
|
||||
|
||||
|
||||
|
||||
// Месяцы для локализации |
||||
$context['months'] = [ |
||||
__('january', 'woodmart'), |
||||
__('february', 'woodmart'), |
||||
__('march', 'woodmart'), |
||||
__('april', 'woodmart'), |
||||
__('may', 'woodmart'), // Исправлено 'mail' на 'may' |
||||
__('june', 'woodmart'), |
||||
__('july', 'woodmart'), |
||||
__('august', 'woodmart'), |
||||
__('september', 'woodmart'), |
||||
__('october', 'woodmart'), |
||||
__('november', 'woodmart'), |
||||
__('december', 'woodmart'), |
||||
]; |
||||
|
||||
|
||||
if ($orders_pg){ |
||||
Timber::render('profile/profile-orders.twig', $context); |
||||
} |
||||
else{ |
||||
Timber::render('profile/profile.twig', $context); |
||||
} |
||||
|
||||
?> |
||||
<?php |
||||
|
||||
// namespace Cdek\UI; |
||||
|
||||
// use Cdek\UI\Cdek\CdekApi; |
||||
// use Cdek\UI\Cdek\Config; |
||||
// use Cdek\UI\Cdek\Helpers\WeightCalc; |
||||
// use Cdek\UI\Cdek\MetaKeys; |
||||
// use Cdek\UI\Exception; |
||||
// use Cdek\UI\WC_Order_Item_Shipping; |
||||
// $api = new CdekApi(); |
||||
|
||||
$context = Timber::get_context(); |
||||
|
||||
$current_user = wp_get_current_user(); |
||||
$context['current_user'] = $current_user; |
||||
$context['first_name'] = $current_user->user_firstname; |
||||
$context['last_name'] = $current_user->user_lastname; |
||||
$context['email'] = $current_user->user_email; |
||||
$context['phone'] = get_user_meta($current_user->ID, 'billing_phone', true); |
||||
$context['tg_account'] = get_user_meta($current_user->ID, 'tg_account', true); |
||||
|
||||
// ACF поля для пользователя |
||||
$context['activated'] = get_field('activated', 'user_' . get_current_user_id()); |
||||
$context['uuid'] = get_field('uuid', 'user_' . get_current_user_id()); |
||||
|
||||
// Запрос для питомцев |
||||
$current_user_id = get_current_user_id(); |
||||
if ($current_user_id) { |
||||
$args = [ |
||||
'post_type' => 'pets', |
||||
'meta_query' => [ |
||||
[ |
||||
'key' => 'user', |
||||
'value' => $current_user_id, |
||||
'compare' => '=' |
||||
] |
||||
] |
||||
]; |
||||
$context['pets'] = Timber::get_posts($args); |
||||
} |
||||
|
||||
// Заказы пользователя |
||||
$context['customer_orders'] = wc_get_orders(['customer_id' => $current_user->ID]); |
||||
// В page-profile.php, внутри цикла заказов |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// foreach ($context['customer_orders'] as &$order) { |
||||
// $meta_data = get_post_meta($order->get_id(), 'order_data', true); |
||||
// if (isset($meta_data['office_code'])) { |
||||
// $office_data = json_decode($api->getOffices(['code' => $meta_data['office_code']])['body'], true); |
||||
// $order->office_name = $office_data[0]['name'] ?? ''; |
||||
// } |
||||
// } |
||||
|
||||
|
||||
|
||||
|
||||
$context['bot_username'] = defined('BOT_USERNAME') ? BOT_USERNAME : ''; |
||||
|
||||
// Текущий пользователь |
||||
$current_user_id = get_current_user_id(); |
||||
$context['current_user_id'] = $current_user_id; |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Запрос для питомцев |
||||
// if ($current_user_id) { |
||||
// $args = [ |
||||
// 'post_type' => 'pets', |
||||
// 'meta_query' => [ |
||||
// [ |
||||
// 'key' => 'user', |
||||
// 'value' => $current_user_id, |
||||
// 'compare' => '=' |
||||
// ] |
||||
// ] |
||||
// ]; |
||||
// $pets = Timber::get_posts($args); |
||||
|
||||
// // Обработка ACF-полей для каждого питомца |
||||
// foreach ($pets as &$pet) { |
||||
// // ACF-поля |
||||
// $pet->weight = get_field('weight', $pet->ID); |
||||
// $pet->old = get_field('old', $pet->ID); |
||||
// $pet->activity = get_field('activity', $pet->ID); |
||||
|
||||
// // Перевод веса |
||||
// switch ($pet->weight) { |
||||
// case 'below_1_5': |
||||
// $pet->weight_text = __('from 0,5 kg to 1,5 kg', 'woodmart'); |
||||
// break; |
||||
// case '1_5-3': |
||||
// $pet->weight_text = __('from 1.5 to 3 kg', 'woodmart'); |
||||
// break; |
||||
// case '3-5': |
||||
// $pet->weight_text = __('from 3 to 5 kg', 'woodmart'); |
||||
// break; |
||||
// case '5-8': |
||||
// $pet->weight_text = __('from 5 to 8 kg', 'woodmart'); |
||||
// break; |
||||
// case '8-11': |
||||
// $pet->weight_text = __('from 8 to 11 kg', 'woodmart'); |
||||
// break; |
||||
// case '11-15': |
||||
// $pet->weight_text = __('from 11 to 15 kg', 'woodmart'); |
||||
// break; |
||||
// case '15-20': |
||||
// $pet->weight_text = __('from 15 to 20 kg', 'woodmart'); |
||||
// break; |
||||
// case '20-25': |
||||
// $pet->weight_text = __('from 20 to 25 kg', 'woodmart'); |
||||
// break; |
||||
// case '25-35': |
||||
// $pet->weight_text = __('from 25 to 35 kg', 'woodmart'); |
||||
// break; |
||||
// case 'more_35': |
||||
// $pet->weight_text = __('More than 35 kg', 'woodmart'); |
||||
// break; |
||||
// default: |
||||
// $pet->weight_text = ''; |
||||
// } |
||||
|
||||
// // Перевод возраста |
||||
// switch ($pet->old) { |
||||
// case 'normal': |
||||
// $pet->old_text = __('Adult (from 1 year to 7 years)', 'woodmart'); |
||||
// break; |
||||
// case 'old': |
||||
// $pet->old_text = __('Elderly (from 7 to 12 years)', 'woodmart'); |
||||
// break; |
||||
// case 'very_old': |
||||
// $pet->old_text = __('Aging (12 years and older)', 'woodmart'); |
||||
// break; |
||||
// case 'baby': |
||||
// $pet->old_text = __('Baby (from 0 to 1 year)', 'woodmart'); |
||||
// break; |
||||
// default: |
||||
// $pet->old_text = ''; |
||||
// } |
||||
|
||||
// // Перевод активности |
||||
// switch ($pet->activity) { |
||||
// case 'low': |
||||
// $pet->activity_text = __('Low', 'woodmart'); |
||||
// break; |
||||
// case 'moderate': |
||||
// $pet->activity_text = __('Moderate', 'woodmart'); |
||||
// break; |
||||
// case 'high': |
||||
// $pet->activity_text = __('High', 'woodmart'); |
||||
// break; |
||||
// default: |
||||
// $pet->activity_text = ''; |
||||
// } |
||||
// } |
||||
|
||||
// $context['pets'] = $pets; |
||||
// } |
||||
|
||||
|
||||
|
||||
|
||||
// Месяцы для локализации |
||||
$context['months'] = [ |
||||
__('january', 'woodmart'), |
||||
__('february', 'woodmart'), |
||||
__('march', 'woodmart'), |
||||
__('april', 'woodmart'), |
||||
__('may', 'woodmart'), // Исправлено 'mail' на 'may' |
||||
__('june', 'woodmart'), |
||||
__('july', 'woodmart'), |
||||
__('august', 'woodmart'), |
||||
__('september', 'woodmart'), |
||||
__('october', 'woodmart'), |
||||
__('november', 'woodmart'), |
||||
__('december', 'woodmart'), |
||||
]; |
||||
|
||||
|
||||
if ($orders_pg){ |
||||
Timber::render('profile/profile-orders.twig', $context); |
||||
} |
||||
else{ |
||||
Timber::render('profile/profile.twig', $context); |
||||
} |
||||
|
||||
?> |
||||
|
@ -1,143 +1,143 @@ |
||||
<?php |
||||
if (!defined('ABSPATH')) { |
||||
exit; |
||||
} |
||||
use Timber\Timber; |
||||
add_filter('timber/twig/filters', function ($filters) { |
||||
$filters['wp_get_attachment_image_src'] = [ |
||||
'callable' => function ($attachment_id, $size = 'thumbnail', $icon = false) { |
||||
$image = wp_get_attachment_image_src($attachment_id, $size, $icon); |
||||
return $image ? $image[0] : ''; // Return the URL or empty string |
||||
}, |
||||
]; |
||||
return $filters; |
||||
}); |
||||
add_filter('timber/twig/functions', function ($functions) { |
||||
$functions['wc_get_page_permalink'] = [ |
||||
'callable' => 'wc_get_page_permalink', |
||||
]; |
||||
$functions['wc_get_endpoint_url'] = [ |
||||
'callable' => 'wc_get_endpoint_url', |
||||
]; |
||||
$functions['is_wc_endpoint_url'] = [ |
||||
'callable' => 'is_wc_endpoint_url', |
||||
]; |
||||
$functions['get_permalink'] = [ |
||||
'callable' => 'get_permalink', |
||||
]; |
||||
$functions['get_the_ID'] = [ |
||||
'callable' => 'get_the_ID', |
||||
]; |
||||
$functions['pll_e'] = [ |
||||
'callable' => 'pll_e', |
||||
]; |
||||
return $functions; |
||||
}); |
||||
|
||||
// Get subscription ID from URL (e.g., /my-account/view-subscription/7632/) |
||||
|
||||
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; |
||||
if (preg_match('/view-subscription\/(\d+)/', $request_uri, $matches)) { |
||||
$subscription_id = absint($matches[1]); |
||||
} |
||||
|
||||
|
||||
$subscription = $subscription_id ? wcs_get_subscription($subscription_id) : null; |
||||
|
||||
if (!$subscription || !wcs_is_subscription($subscription) || $subscription->get_user_id() !== get_current_user_id()) { |
||||
error_log('Invalid or inaccessible subscription ID: ' . $subscription_id); |
||||
$subscription = null; |
||||
} else { |
||||
error_log('Subscription ID: ' . $subscription->get_id() . ' | Status: ' . $subscription->get_status()); |
||||
|
||||
$items = array_map(function ($item) { |
||||
$product_id = $item->get_product_id(); |
||||
$variation_id = $item->get_variation_id(); |
||||
$wc_product = $product_id ? wc_get_product($variation_id ?: $product_id) : null; |
||||
$product_name = $wc_product ? $wc_product->get_name() : 'Unknown Product'; |
||||
$image_id = $wc_product ? $wc_product->get_image_id() : 0; |
||||
$status = $product_id ? get_post_status($product_id) : 'N/A'; |
||||
$permalink = $wc_product && $wc_product->is_visible() ? get_permalink($product_id) : ''; |
||||
$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); |
||||
|
||||
return [ |
||||
'product' => [ |
||||
'id' => $product_id ?: 0, |
||||
'name' => $product_name, |
||||
'image_id' => $image_id, |
||||
'variation_details' => $variation_details, |
||||
], |
||||
'quantity' => $item->get_quantity(), |
||||
'total' => $item->get_total(), |
||||
]; |
||||
}, $subscription->get_items()); |
||||
|
||||
|
||||
$cancel_url = ''; |
||||
if ($subscription->can_be_updated_to('cancelled')) { |
||||
$cancel_url = add_query_arg( |
||||
[ |
||||
'subscription_id' => $subscription->get_id(), |
||||
'change_subscription_to' => 'cancelled', |
||||
'_wpnonce' => wp_create_nonce('wcs_switch_request'), |
||||
], |
||||
wc_get_endpoint_url('view-subscription', $subscription->get_id(), wc_get_page_permalink('myaccount')) |
||||
); |
||||
} |
||||
|
||||
$subscription_data = [ |
||||
'id' => $subscription->get_id(), |
||||
'status' => $subscription->get_status(), |
||||
'date_created' => $subscription->get_date_created(), |
||||
'last_order_date' => $subscription->get_date('last_order_date_created'), |
||||
'next_payment_date' => $subscription->get_date('next_payment'), |
||||
'payment_method_title' => $subscription->get_payment_method_title(), |
||||
'total' => $subscription->get_total(), |
||||
'currency' => $subscription->get_currency(), |
||||
'items' => $items, |
||||
'cancel_url' => $cancel_url, |
||||
'shipping_address' => $subscription->get_formatted_shipping_address(), |
||||
'shipping_comment' => $subscription->get_customer_note(), |
||||
]; |
||||
} |
||||
|
||||
// Timber context |
||||
$context = Timber::context(); |
||||
|
||||
$current_user = wp_get_current_user(); |
||||
$context['current_user'] = $current_user; |
||||
$context['first_name'] = $current_user->user_firstname; |
||||
$context['last_name'] = $current_user->user_lastname; |
||||
$context['email'] = $current_user->user_email; |
||||
$context['phone'] = get_user_meta($current_user->ID, 'billing_phone', true); |
||||
$context['tg_account'] = get_user_meta($current_user->ID, 'tg_account', true); |
||||
|
||||
// ACF поля для пользователя |
||||
$context['activated'] = get_field('activated', 'user_' . get_current_user_id()); |
||||
$context['uuid'] = get_field('uuid', 'user_' . get_current_user_id()); |
||||
|
||||
// Запрос для питомцев |
||||
$current_user_id = get_current_user_id(); |
||||
if ($current_user_id) { |
||||
$args = [ |
||||
'post_type' => 'pets', |
||||
'meta_query' => [ |
||||
[ |
||||
'key' => 'user', |
||||
'value' => $current_user_id, |
||||
'compare' => '=' |
||||
] |
||||
] |
||||
]; |
||||
$context['pets'] = Timber::get_posts($args); |
||||
} |
||||
$context['bot_username'] = defined('BOT_USERNAME') ? BOT_USERNAME : ''; |
||||
$context['subscription'] = $subscription_data; |
||||
|
||||
// Debug: Log subscription data |
||||
error_log('Subscription Data: ' . print_r($subscription_data, true)); |
||||
|
||||
// Render the Twig template |
||||
Timber::render('profile/profile-subs-single.twig', $context); |
||||
?> |
||||
<?php |
||||
if (!defined('ABSPATH')) { |
||||
exit; |
||||
} |
||||
use Timber\Timber; |
||||
add_filter('timber/twig/filters', function ($filters) { |
||||
$filters['wp_get_attachment_image_src'] = [ |
||||
'callable' => function ($attachment_id, $size = 'thumbnail', $icon = false) { |
||||
$image = wp_get_attachment_image_src($attachment_id, $size, $icon); |
||||
return $image ? $image[0] : ''; // Return the URL or empty string |
||||
}, |
||||
]; |
||||
return $filters; |
||||
}); |
||||
add_filter('timber/twig/functions', function ($functions) { |
||||
$functions['wc_get_page_permalink'] = [ |
||||
'callable' => 'wc_get_page_permalink', |
||||
]; |
||||
$functions['wc_get_endpoint_url'] = [ |
||||
'callable' => 'wc_get_endpoint_url', |
||||
]; |
||||
$functions['is_wc_endpoint_url'] = [ |
||||
'callable' => 'is_wc_endpoint_url', |
||||
]; |
||||
$functions['get_permalink'] = [ |
||||
'callable' => 'get_permalink', |
||||
]; |
||||
$functions['get_the_ID'] = [ |
||||
'callable' => 'get_the_ID', |
||||
]; |
||||
$functions['pll_e'] = [ |
||||
'callable' => 'pll_e', |
||||
]; |
||||
return $functions; |
||||
}); |
||||
|
||||
// Get subscription ID from URL (e.g., /my-account/view-subscription/7632/) |
||||
|
||||
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; |
||||
if (preg_match('/view-subscription\/(\d+)/', $request_uri, $matches)) { |
||||
$subscription_id = absint($matches[1]); |
||||
} |
||||
|
||||
|
||||
$subscription = $subscription_id ? wcs_get_subscription($subscription_id) : null; |
||||
|
||||
if (!$subscription || !wcs_is_subscription($subscription) || $subscription->get_user_id() !== get_current_user_id()) { |
||||
error_log('Invalid or inaccessible subscription ID: ' . $subscription_id); |
||||
$subscription = null; |
||||
} else { |
||||
error_log('Subscription ID: ' . $subscription->get_id() . ' | Status: ' . $subscription->get_status()); |
||||
|
||||
$items = array_map(function ($item) { |
||||
$product_id = $item->get_product_id(); |
||||
$variation_id = $item->get_variation_id(); |
||||
$wc_product = $product_id ? wc_get_product($variation_id ?: $product_id) : null; |
||||
$product_name = $wc_product ? $wc_product->get_name() : 'Unknown Product'; |
||||
$image_id = $wc_product ? $wc_product->get_image_id() : 0; |
||||
$status = $product_id ? get_post_status($product_id) : 'N/A'; |
||||
$permalink = $wc_product && $wc_product->is_visible() ? get_permalink($product_id) : ''; |
||||
$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); |
||||
|
||||
return [ |
||||
'product' => [ |
||||
'id' => $product_id ?: 0, |
||||
'name' => $product_name, |
||||
'image_id' => $image_id, |
||||
'variation_details' => $variation_details, |
||||
], |
||||
'quantity' => $item->get_quantity(), |
||||
'total' => $item->get_total(), |
||||
]; |
||||
}, $subscription->get_items()); |
||||
|
||||
|
||||
$cancel_url = ''; |
||||
if ($subscription->can_be_updated_to('cancelled')) { |
||||
$cancel_url = add_query_arg( |
||||
[ |
||||
'subscription_id' => $subscription->get_id(), |
||||
'change_subscription_to' => 'cancelled', |
||||
'_wpnonce' => wp_create_nonce('wcs_switch_request'), |
||||
], |
||||
wc_get_endpoint_url('view-subscription', $subscription->get_id(), wc_get_page_permalink('myaccount')) |
||||
); |
||||
} |
||||
|
||||
$subscription_data = [ |
||||
'id' => $subscription->get_id(), |
||||
'status' => $subscription->get_status(), |
||||
'date_created' => $subscription->get_date_created(), |
||||
'last_order_date' => $subscription->get_date('last_order_date_created'), |
||||
'next_payment_date' => $subscription->get_date('next_payment'), |
||||
'payment_method_title' => $subscription->get_payment_method_title(), |
||||
'total' => $subscription->get_total(), |
||||
'currency' => $subscription->get_currency(), |
||||
'items' => $items, |
||||
'cancel_url' => $cancel_url, |
||||
'shipping_address' => $subscription->get_formatted_shipping_address(), |
||||
'shipping_comment' => $subscription->get_customer_note(), |
||||
]; |
||||
} |
||||
|
||||
// Timber context |
||||
$context = Timber::context(); |
||||
|
||||
$current_user = wp_get_current_user(); |
||||
$context['current_user'] = $current_user; |
||||
$context['first_name'] = $current_user->user_firstname; |
||||
$context['last_name'] = $current_user->user_lastname; |
||||
$context['email'] = $current_user->user_email; |
||||
$context['phone'] = get_user_meta($current_user->ID, 'billing_phone', true); |
||||
$context['tg_account'] = get_user_meta($current_user->ID, 'tg_account', true); |
||||
|
||||
// ACF поля для пользователя |
||||
$context['activated'] = get_field('activated', 'user_' . get_current_user_id()); |
||||
$context['uuid'] = get_field('uuid', 'user_' . get_current_user_id()); |
||||
|
||||
// Запрос для питомцев |
||||
$current_user_id = get_current_user_id(); |
||||
if ($current_user_id) { |
||||
$args = [ |
||||
'post_type' => 'pets', |
||||
'meta_query' => [ |
||||
[ |
||||
'key' => 'user', |
||||
'value' => $current_user_id, |
||||
'compare' => '=' |
||||
] |
||||
] |
||||
]; |
||||
$context['pets'] = Timber::get_posts($args); |
||||
} |
||||
$context['bot_username'] = defined('BOT_USERNAME') ? BOT_USERNAME : ''; |
||||
$context['subscription'] = $subscription_data; |
||||
|
||||
// Debug: Log subscription data |
||||
error_log('Subscription Data: ' . print_r($subscription_data, true)); |
||||
|
||||
// Render the Twig template |
||||
Timber::render('profile/profile-subs-single.twig', $context); |
||||
?> |
||||
|
@ -1,107 +1,107 @@ |
||||
<?php |
||||
if (!defined('ABSPATH')) { |
||||
exit; |
||||
} |
||||
add_filter('timber/twig/filters', function ($filters) { |
||||
$filters['wp_get_attachment_image_src'] = [ |
||||
'callable' => function ($attachment_id, $size = 'thumbnail', $icon = false) { |
||||
$image = wp_get_attachment_image_src($attachment_id, $size, $icon); |
||||
return $image ? $image[0] : ''; // Return the URL or empty string |
||||
}, |
||||
]; |
||||
return $filters; |
||||
}); |
||||
|
||||
|
||||
use Timber\Timber; |
||||
|
||||
|
||||
$context = Timber::context(); |
||||
if (!class_exists('WC_Subscriptions')) { |
||||
error_log('WooCommerce Subscriptions plugin is not active.'); |
||||
return; |
||||
} |
||||
|
||||
// Get the current user’s subscriptions |
||||
$user_id = get_current_user_id(); |
||||
$subscriptions = wcs_get_users_subscriptions($user_id); |
||||
|
||||
$subscription_data = []; |
||||
foreach ($subscriptions as $subscription) { |
||||
$view_url = $subscription->get_view_order_url(); |
||||
// Debug: Log the view_url to check its value |
||||
error_log('Subscription ID: ' . $subscription->get_id() . ' | View URL: ' . $view_url); |
||||
|
||||
$subscription_data[] = [ |
||||
'id' => $subscription->get_id(), |
||||
'date_created' => $subscription->get_date_created(), |
||||
'total' => $subscription->get_total(), |
||||
'currency' => $subscription->get_currency(), |
||||
'billing_period' => $subscription->get_billing_period(), |
||||
'next_payment_date' => $subscription->get_date('next_payment'), |
||||
'view_url' => esc_url($view_url), // Ensure URL is escaped for safety |
||||
'items' => array_map(function ($item) { |
||||
$product = $item->get_product(); |
||||
return [ |
||||
'product' => [ |
||||
'name' => $product->get_name(), |
||||
'image_id' => $product->get_image_id(), |
||||
], |
||||
]; |
||||
}, $subscription->get_items()), |
||||
]; |
||||
} |
||||
|
||||
$context['subscriptions'] = $subscription_data; |
||||
|
||||
// Debug: Log the entire subscriptions array |
||||
error_log('Subscriptions Data: ' . print_r($subscription_data, true)); |
||||
|
||||
// Render the Twig template |
||||
|
||||
$current_user = wp_get_current_user(); |
||||
$context['current_user'] = $current_user; |
||||
$context['first_name'] = $current_user->user_firstname; |
||||
$context['last_name'] = $current_user->user_lastname; |
||||
$context['email'] = $current_user->user_email; |
||||
$context['phone'] = get_user_meta($current_user->ID, 'billing_phone', true); |
||||
$context['tg_account'] = get_user_meta($current_user->ID, 'tg_account', true); |
||||
|
||||
// ACF поля для пользователя |
||||
$context['activated'] = get_field('activated', 'user_' . get_current_user_id()); |
||||
$context['uuid'] = get_field('uuid', 'user_' . get_current_user_id()); |
||||
$context['bot_username'] = defined('BOT_USERNAME') ? BOT_USERNAME : ''; |
||||
// Запрос для питомцев |
||||
$current_user_id = get_current_user_id(); |
||||
if ($current_user_id) { |
||||
$args = [ |
||||
'post_type' => 'pets', |
||||
'meta_query' => [ |
||||
[ |
||||
'key' => 'user', |
||||
'value' => $current_user_id, |
||||
'compare' => '=' |
||||
] |
||||
] |
||||
]; |
||||
$context['pets'] = Timber::get_posts($args); |
||||
} |
||||
|
||||
// Месяцы для локализации |
||||
$context['months'] = [ |
||||
__('january', 'woodmart'), |
||||
__('february', 'woodmart'), |
||||
__('march', 'woodmart'), |
||||
__('april', 'woodmart'), |
||||
__('may', 'woodmart'), |
||||
__('june', 'woodmart'), |
||||
__('july', 'woodmart'), |
||||
__('august', 'woodmart'), |
||||
__('september', 'woodmart'), |
||||
__('october', 'woodmart'), |
||||
__('november', 'woodmart'), |
||||
__('december', 'woodmart'), |
||||
]; |
||||
|
||||
Timber::render('profile/profile-subs.twig', $context); |
||||
?> |
||||
<?php |
||||
if (!defined('ABSPATH')) { |
||||
exit; |
||||
} |
||||
add_filter('timber/twig/filters', function ($filters) { |
||||
$filters['wp_get_attachment_image_src'] = [ |
||||
'callable' => function ($attachment_id, $size = 'thumbnail', $icon = false) { |
||||
$image = wp_get_attachment_image_src($attachment_id, $size, $icon); |
||||
return $image ? $image[0] : ''; // Return the URL or empty string |
||||
}, |
||||
]; |
||||
return $filters; |
||||
}); |
||||
|
||||
|
||||
use Timber\Timber; |
||||
|
||||
|
||||
$context = Timber::context(); |
||||
if (!class_exists('WC_Subscriptions')) { |
||||
error_log('WooCommerce Subscriptions plugin is not active.'); |
||||
return; |
||||
} |
||||
|
||||
// Get the current user’s subscriptions |
||||
$user_id = get_current_user_id(); |
||||
$subscriptions = wcs_get_users_subscriptions($user_id); |
||||
|
||||
$subscription_data = []; |
||||
foreach ($subscriptions as $subscription) { |
||||
$view_url = $subscription->get_view_order_url(); |
||||
// Debug: Log the view_url to check its value |
||||
error_log('Subscription ID: ' . $subscription->get_id() . ' | View URL: ' . $view_url); |
||||
|
||||
$subscription_data[] = [ |
||||
'id' => $subscription->get_id(), |
||||
'date_created' => $subscription->get_date_created(), |
||||
'total' => $subscription->get_total(), |
||||
'currency' => $subscription->get_currency(), |
||||
'billing_period' => $subscription->get_billing_period(), |
||||
'next_payment_date' => $subscription->get_date('next_payment'), |
||||
'view_url' => esc_url($view_url), // Ensure URL is escaped for safety |
||||
'items' => array_map(function ($item) { |
||||
$product = $item->get_product(); |
||||
return [ |
||||
'product' => [ |
||||
'name' => $product->get_name(), |
||||
'image_id' => $product->get_image_id(), |
||||
], |
||||
]; |
||||
}, $subscription->get_items()), |
||||
]; |
||||
} |
||||
|
||||
$context['subscriptions'] = $subscription_data; |
||||
|
||||
// Debug: Log the entire subscriptions array |
||||
error_log('Subscriptions Data: ' . print_r($subscription_data, true)); |
||||
|
||||
// Render the Twig template |
||||
|
||||
$current_user = wp_get_current_user(); |
||||
$context['current_user'] = $current_user; |
||||
$context['first_name'] = $current_user->user_firstname; |
||||
$context['last_name'] = $current_user->user_lastname; |
||||
$context['email'] = $current_user->user_email; |
||||
$context['phone'] = get_user_meta($current_user->ID, 'billing_phone', true); |
||||
$context['tg_account'] = get_user_meta($current_user->ID, 'tg_account', true); |
||||
|
||||
// ACF поля для пользователя |
||||
$context['activated'] = get_field('activated', 'user_' . get_current_user_id()); |
||||
$context['uuid'] = get_field('uuid', 'user_' . get_current_user_id()); |
||||
$context['bot_username'] = defined('BOT_USERNAME') ? BOT_USERNAME : ''; |
||||
// Запрос для питомцев |
||||
$current_user_id = get_current_user_id(); |
||||
if ($current_user_id) { |
||||
$args = [ |
||||
'post_type' => 'pets', |
||||
'meta_query' => [ |
||||
[ |
||||
'key' => 'user', |
||||
'value' => $current_user_id, |
||||
'compare' => '=' |
||||
] |
||||
] |
||||
]; |
||||
$context['pets'] = Timber::get_posts($args); |
||||
} |
||||
|
||||
// Месяцы для локализации |
||||
$context['months'] = [ |
||||
__('january', 'woodmart'), |
||||
__('february', 'woodmart'), |
||||
__('march', 'woodmart'), |
||||
__('april', 'woodmart'), |
||||
__('may', 'woodmart'), |
||||
__('june', 'woodmart'), |
||||
__('july', 'woodmart'), |
||||
__('august', 'woodmart'), |
||||
__('september', 'woodmart'), |
||||
__('october', 'woodmart'), |
||||
__('november', 'woodmart'), |
||||
__('december', 'woodmart'), |
||||
]; |
||||
|
||||
Timber::render('profile/profile-subs.twig', $context); |
||||
?> |
||||
|
@ -1,134 +1,271 @@ |
||||
<?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'); |
||||
|
||||
<<<<<<< HEAD |
||||
<?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'); |
||||
|
||||
======= |
||||
<?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($) { |
||||
// Открытие/закрытие модалки
|
||||
// $(document).on('click', '.cart-contents, .continue-shopping, .modal__close', function(e) {
|
||||
// e.preventDefault();
|
||||
// $('#modal-basket').toggleClass('active');
|
||||
// });
|
||||
|
||||
// Обновление количества через input
|
||||
$(document).on('change', '.counter__input', function() { |
||||
const key = $(this).data('key'); |
||||
const quantity = $(this).val(); |
||||
|
||||
if (quantity > 0) { |
||||
updateCart(key, quantity); |
||||
} else { |
||||
removeItem(key); |
||||
} |
||||
}); |
||||
|
||||
// Увеличение количества
|
||||
$(document).on('click', '.modal__basket .counter__button.plus', function(e) { |
||||
e.preventDefault(); |
||||
const key = $(this).data('key'); |
||||
const input = $(this).siblings('.counter__input'); |
||||
const quantity = parseInt(input.val()) + 1; |
||||
input.val(quantity).trigger('change'); |
||||
}); |
||||
|
||||
// Уменьшение количества
|
||||
$(document).on('click', '.modal__basket .counter__button.minus', function(e) { |
||||
e.preventDefault(); |
||||
const key = $(this).data('key'); |
||||
const input = $(this).siblings('.counter__input'); |
||||
let quantity = parseInt(input.val()) - 1; |
||||
|
||||
if (quantity <= 0) { |
||||
removeItem(key); // Вызываем удаление, если количество становится 0
|
||||
} else { |
||||
input.val(quantity).trigger('change'); // Обновляем количество, если больше 0
|
||||
} |
||||
}); |
||||
|
||||
$(document).on('click', '.remove-item', function() { |
||||
const key = $(this).data('key'); |
||||
removeItem(key); |
||||
}); |
||||
|
||||
// Удаление товара
|
||||
function formatMoney(amount) { |
||||
if (typeof woocommerce_params !== 'undefined' && woocommerce_params.currency_format) { |
||||
const format = woocommerce_params.currency_format; |
||||
return format |
||||
.replace('%1$s', woocommerce_params.currency_symbol) |
||||
.replace('%2$s', parseFloat(amount).toFixed(2)); |
||||
} |
||||
return woocommerce_params.currency_symbol + parseFloat(amount).toFixed(2); |
||||
} |
||||
|
||||
// Хранилище временно удалённых товаров
|
||||
const removedItemsStorageKey = 'woocommerce_removed_items'; |
||||
|
||||
function restoreRemovedItems() { |
||||
const removedItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || []; |
||||
|
||||
if (removedItems.length === 0) return; |
||||
|
||||
$('#modal-basket').addClass('loading'); |
||||
|
||||
// Создаем копию массива для работы
|
||||
let itemsToRemove = [...removedItems]; |
||||
|
||||
function processNextItem() { |
||||
if (itemsToRemove.length === 0) { |
||||
// Все элементы обработаны
|
||||
localStorage.removeItem(removedItemsStorageKey); |
||||
updateCartFragment(); |
||||
$('#modal-basket').removeClass('loading'); |
||||
return; |
||||
} |
||||
|
||||
const element = itemsToRemove.shift(); // Берем первый элемент
|
||||
|
||||
$.ajax({ |
||||
type: 'POST', |
||||
url: woocommerce_params.ajax_url, |
||||
data: { |
||||
action: 'remove_cart_item', |
||||
cart_item_key: element.key |
||||
}, |
||||
success: function(response) { |
||||
if (response.success) { |
||||
// Обновляем localStorage, удаляя только что обработанный элемент
|
||||
const currentItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || []; |
||||
const updatedItems = currentItems.filter(item => item.key !== element.key); |
||||
localStorage.setItem(removedItemsStorageKey, JSON.stringify(updatedItems)); |
||||
} |
||||
// Обрабатываем следующий элемент
|
||||
processNextItem(); |
||||
}, |
||||
error: function() { |
||||
// Продолжаем даже при ошибке
|
||||
processNextItem(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// Начинаем обработку
|
||||
processNextItem(); |
||||
} |
||||
|
||||
// Инициализация при загрузке
|
||||
restoreRemovedItems(); |
||||
|
||||
// Функция удаления товара с возможностью восстановления
|
||||
function removeItem(key) { |
||||
const $item = $(`[data-key="${key}"]`); |
||||
const productId = $item.data('product_id'); |
||||
const variationId = $item.data('variation_id') || 0; |
||||
const quantity = parseInt($item.find('.counter__input').val()); |
||||
|
||||
// Сохраняем во временное хранилище
|
||||
const removedItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || []; |
||||
removedItems.push({ product_id: productId, variation_id: variationId, quantity: quantity, key: key }); |
||||
localStorage.setItem(removedItemsStorageKey, JSON.stringify(removedItems)); |
||||
|
||||
// Показываем кнопку восстановления
|
||||
$item.html(` |
||||
<p class="modal-basket-item__title"> |
||||
Removing an item from the cart: <span id="${key}_timer" class="timer_counter">5</span>с |
||||
</p> |
||||
<div class="modal-basket-item__return-wrapper"> |
||||
<button class="modal-basket-item__return" data-key="${key}"> |
||||
${woocommerce_params.i18n_restore_item || 'Restore'} |
||||
</button> |
||||
</div> |
||||
`);
|
||||
|
||||
// Проверяем количество товаров в корзине
|
||||
$.ajax({ |
||||
type: 'POST', |
||||
url: woocommerce_params.ajax_url, |
||||
data: { |
||||
action: 'check_cart_count' |
||||
}, |
||||
success: function(response) { |
||||
if (response.success && response.data.count <= 1) { |
||||
// Если после удаления корзина станет пустой (1 товар сейчас, удаляем его)
|
||||
$('.proceed-to-checkout').css('display', 'none'); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
// Удаляем через 5 секунд, если не восстановили
|
||||
const removeTimeout = setTimeout(() => { |
||||
permanentRemoveItem(key, productId, variationId); |
||||
}, 5000); |
||||
|
||||
const product_remove_timer = setInterval(() => { |
||||
let number = Number($(`#${key}_timer`).html()) - 1; |
||||
$(`#${key}_timer`).html(number); |
||||
}, 1000); |
||||
|
||||
// Обработчик восстановления
|
||||
$(document).off('click', `[data-key="${key}"] .modal-basket-item__return`).on('click', `[data-key="${key}"] .modal-basket-item__return`, function(e) { |
||||
e.preventDefault(); |
||||
clearTimeout(removeTimeout); |
||||
clearInterval(product_remove_timer); // Очищаем интервал
|
||||
restoreItem(key, productId, variationId, quantity); |
||||
}); |
||||
} |
||||
|
||||
// Полное удаление товара
|
||||
function permanentRemoveItem(key, productId, variationId) { |
||||
$('#modal-basket').addClass('loading'); |
||||
|
||||
$.ajax({ |
||||
type: 'POST', |
||||
url: woocommerce_params.ajax_url, |
||||
data: { |
||||
action: 'remove_cart_item', |
||||
cart_item_key: key |
||||
}, |
||||
complete: function() { |
||||
$('#modal-basket').removeClass('loading'); |
||||
}, |
||||
success: function(response) { |
||||
if (response.success) { |
||||
// Удаляем из временного хранилища
|
||||
const removedItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || []; |
||||
const updatedItems = removedItems.filter(item =>
|
||||
!(item.product_id === productId && item.variation_id === variationId) |
||||
); |
||||
localStorage.setItem(removedItemsStorageKey, JSON.stringify(updatedItems)); |
||||
|
||||
updateCartFragment(); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// Восстановление товара
|
||||
function restoreItem(key, productId, variationId, quantity) { |
||||
$('#modal-basket').addClass('loading'); |
||||
|
||||
$.ajax({ |
||||
type: 'POST', |
||||
url: woocommerce_params.ajax_url, |
||||
data: { |
||||
action: 'restore_cart_item', |
||||
product_id: productId, |
||||
variation_id: variationId, |
||||
quantity: quantity |
||||
}, |
||||
complete: function() { |
||||
$('#modal-basket').removeClass('loading'); |
||||
}, |
||||
success: function(response) { |
||||
if (response.success) { |
||||
// Удаляем из временного хранилища
|
||||
const removedItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || []; |
||||
const updatedItems = removedItems.filter(item =>
|
||||
!(item.product_id === productId && item.variation_id === variationId) |
||||
); |
||||
localStorage.setItem(removedItemsStorageKey, JSON.stringify(updatedItems)); |
||||
|
||||
// Показываем кнопку Proceed to checkout
|
||||
$('.proceed-to-checkout').css('display', ''); |
||||
|
||||
updateCartFragment(); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// --- Работа с cookie ---
|
||||
function setCookie(name, value, days) { |
||||
let expires = ''; |
||||
if (days) { |
||||
const date = new Date(); |
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); |
||||
expires = '; expires=' + date.toUTCString(); |
||||
} |
||||
document.cookie = name + '=' + (value || '') + expires + '; path=/'; |
||||
} |
||||
function getCookie(name) { |
||||
const nameEQ = name + '='; |
||||
const ca = document.cookie.split(';'); |
||||
for(let i=0;i < ca.length;i++) { |
||||
let c = ca[i]; |
||||
while (c.charAt(0)==' ') c = c.substring(1,c.length); |
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); |
||||
} |
||||
return null; |
||||
} |
||||
// --- Конец работы с cookie ---
|
||||
|
||||
// Открытие корзины при первом добавлении товара
|
||||
function openBasketOnFirstAdd() { |
||||
if (!getCookie('basket_popup_shown')) { |
||||
console.log('[openBasketOnFirstAdd] Срабатывает открытие корзины'); |
||||
// Выбираем только модалку, в которой находится корзина
|
||||
var $basket = $('#modal-basket'); |
||||
var $modal = $basket.closest('.modal'); |
||||
var $aside = $modal.find('.modal__aside'); |
||||
var device = window.screen.width; |
||||
|
||||
// Сброс только внутри этой модалки
|
||||
var $items = $modal.find('.modal__item'); |
||||
console.log('[openBasketOnFirstAdd] modal:', $modal.get(), 'modal__item:', $items.get()); |
||||
$items.removeClass('active').attr('style', ''); |
||||
$modal.addClass('active').show(); |
||||
$basket.addClass('active').css({opacity: 1, filter: 'blur(0px)'}); |
||||
console.log('[openBasketOnFirstAdd] basket:', $basket.get()); |
||||
var width = $basket[0] ? $basket[0].clientWidth : 600; |
||||
setTimeout(function() { |
||||
if (device <= 720) { |
||||
$aside.css('width', device + 'px'); |
||||
console.log('[openBasketOnFirstAdd] aside width:', device + 'px'); |
||||
} else { |
||||
$aside.css('width', width + 'px'); |
||||
console.log('[openBasketOnFirstAdd] aside width:', width + 'px'); |
||||
} |
||||
}, 10); |
||||
setCookie('basket_popup_shown', '1', 30); |
||||
} else { |
||||
console.log('[openBasketOnFirstAdd] Куки уже установлены, попап не открывается'); |
||||
} |
||||
} |
||||
|
||||
// Обновление корзины при добавлении товара
|
||||
$(document.body).on('added_to_cart', function() { |
||||
updateCartFragment(); |
||||
openBasketOnFirstAdd(); |
||||
}); |
||||
|
||||
// Функция обновления количества
|
||||
function updateCart(key, quantity) { |
||||
$.ajax({ |
||||
type: 'POST', |
||||
url: '/wp-admin/admin-ajax.php', // Используем стандартный параметр WooCommerce
|
||||
data: { |
||||
action: 'update_cart_quantity', |
||||
cart_item_key: key, |
||||
quantity: quantity |
||||
}, |
||||
beforeSend: function() { |
||||
$('#modal-basket').addClass('loading'); |
||||
}, |
||||
complete: function() { |
||||
$('#modal-basket').removeClass('loading'); |
||||
}, |
||||
success: function(response) { |
||||
if (response.success) { |
||||
updateCartFragment(); |
||||
} else { |
||||
console.error('Ошибка при обновлении корзины'); |
||||
} |
||||
}, |
||||
error: function(xhr, status, error) { |
||||
console.error('AJAX ошибка:', error); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// Обновление фрагментов корзины
|
||||
function updateCartFragment() { |
||||
$.ajax({ |
||||
type: 'POST', |
||||
url: woocommerce_params.ajax_url, |
||||
data: { |
||||
action: 'get_cart_fragment' |
||||
}, |
||||
beforeSend: function() { |
||||
$('#modal-basket').addClass('loading'); |
||||
}, |
||||
complete: function() { |
||||
$('#modal-basket').removeClass('loading'); |
||||
}, |
||||
success: function(response) { |
||||
console.log(response); |
||||
if (response.success) { |
||||
$('#modal-basket-content').html(response.data.contents); |
||||
$('.modal-block-price__price').html(response.data.total); |
||||
$('.mini-profile__button--counter').text(response.data.count); |
||||
if (response.data.count > 0) { |
||||
$('.mini-profile__button--counter').removeClass('disabled'); |
||||
$('.proceed-to-checkout').css('display', ''); // Показываем кнопку, если есть товары
|
||||
} else { |
||||
$('.mini-profile__button--counter').addClass('disabled'); |
||||
$('.proceed-to-checkout').css('display', 'none'); // Скрываем кнопку, если корзина пуста
|
||||
} |
||||
} |
||||
}, |
||||
error: function(xhr, status, error) { |
||||
console.error('AJAX error:', error); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// Добавляем спиннер на кнопку 'Добавить в корзину' в корзине
|
||||
$('body').on('click', '.add_to_cart_button', function() { |
||||
var btn = $(this); |
||||
if (!btn.hasClass('loading')) { |
||||
btn.addClass('loading'); |
||||
btn.data('original-text', btn.html()); |
||||
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>'); |
||||
} |
||||
}); |
||||
|
||||
// Убираем спиннер после завершения ajax WooCommerce
|
||||
$(document.body).on('added_to_cart', function(e, fragments, cart_hash, $button) { |
||||
if ($button && $button.length) { |
||||
$button.removeClass('loading'); |
||||
if ($button.data('original-text')) { |
||||
$button.html($button.data('original-text')); |
||||
$button.removeData('original-text'); |
||||
} |
||||
} |
||||
}); |
||||
jQuery(document).ready(function($) { |
||||
// Открытие/закрытие модалки
|
||||
// $(document).on('click', '.cart-contents, .continue-shopping, .modal__close', function(e) {
|
||||
// e.preventDefault();
|
||||
// $('#modal-basket').toggleClass('active');
|
||||
// });
|
||||
|
||||
// Обновление количества через input
|
||||
$(document).on('change', '.counter__input', function() { |
||||
const key = $(this).data('key'); |
||||
const quantity = $(this).val(); |
||||
|
||||
if (quantity > 0) { |
||||
updateCart(key, quantity); |
||||
} else { |
||||
removeItem(key); |
||||
} |
||||
}); |
||||
|
||||
// Увеличение количества
|
||||
$(document).on('click', '.modal__basket .counter__button.plus', function(e) { |
||||
e.preventDefault(); |
||||
const key = $(this).data('key'); |
||||
const input = $(this).siblings('.counter__input'); |
||||
const quantity = parseInt(input.val()) + 1; |
||||
input.val(quantity).trigger('change'); |
||||
}); |
||||
|
||||
// Уменьшение количества
|
||||
$(document).on('click', '.modal__basket .counter__button.minus', function(e) { |
||||
e.preventDefault(); |
||||
const key = $(this).data('key'); |
||||
const input = $(this).siblings('.counter__input'); |
||||
let quantity = parseInt(input.val()) - 1; |
||||
|
||||
if (quantity <= 0) { |
||||
removeItem(key); // Вызываем удаление, если количество становится 0
|
||||
} else { |
||||
input.val(quantity).trigger('change'); // Обновляем количество, если больше 0
|
||||
} |
||||
}); |
||||
|
||||
$(document).on('click', '.remove-item', function() { |
||||
const key = $(this).data('key'); |
||||
removeItem(key); |
||||
}); |
||||
|
||||
// Удаление товара
|
||||
function formatMoney(amount) { |
||||
if (typeof woocommerce_params !== 'undefined' && woocommerce_params.currency_format) { |
||||
const format = woocommerce_params.currency_format; |
||||
return format |
||||
.replace('%1$s', woocommerce_params.currency_symbol) |
||||
.replace('%2$s', parseFloat(amount).toFixed(2)); |
||||
} |
||||
return woocommerce_params.currency_symbol + parseFloat(amount).toFixed(2); |
||||
} |
||||
|
||||
// Хранилище временно удалённых товаров
|
||||
const removedItemsStorageKey = 'woocommerce_removed_items'; |
||||
|
||||
function restoreRemovedItems() { |
||||
const removedItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || []; |
||||
|
||||
if (removedItems.length === 0) return; |
||||
|
||||
$('#modal-basket').addClass('loading'); |
||||
|
||||
// Создаем копию массива для работы
|
||||
let itemsToRemove = [...removedItems]; |
||||
|
||||
function processNextItem() { |
||||
if (itemsToRemove.length === 0) { |
||||
// Все элементы обработаны
|
||||
localStorage.removeItem(removedItemsStorageKey); |
||||
updateCartFragment(); |
||||
$('#modal-basket').removeClass('loading'); |
||||
return; |
||||
} |
||||
|
||||
const element = itemsToRemove.shift(); // Берем первый элемент
|
||||
|
||||
$.ajax({ |
||||
type: 'POST', |
||||
url: woocommerce_params.ajax_url, |
||||
data: { |
||||
action: 'remove_cart_item', |
||||
cart_item_key: element.key |
||||
}, |
||||
success: function(response) { |
||||
if (response.success) { |
||||
// Обновляем localStorage, удаляя только что обработанный элемент
|
||||
const currentItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || []; |
||||
const updatedItems = currentItems.filter(item => item.key !== element.key); |
||||
localStorage.setItem(removedItemsStorageKey, JSON.stringify(updatedItems)); |
||||
} |
||||
// Обрабатываем следующий элемент
|
||||
processNextItem(); |
||||
}, |
||||
error: function() { |
||||
// Продолжаем даже при ошибке
|
||||
processNextItem(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// Начинаем обработку
|
||||
processNextItem(); |
||||
} |
||||
|
||||
// Инициализация при загрузке
|
||||
restoreRemovedItems(); |
||||
|
||||
// Функция удаления товара с возможностью восстановления
|
||||
function removeItem(key) { |
||||
const $item = $(`[data-key="${key}"]`); |
||||
const productId = $item.data('product_id'); |
||||
const variationId = $item.data('variation_id') || 0; |
||||
const quantity = parseInt($item.find('.counter__input').val()); |
||||
|
||||
// Сохраняем во временное хранилище
|
||||
const removedItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || []; |
||||
removedItems.push({ product_id: productId, variation_id: variationId, quantity: quantity, key: key }); |
||||
localStorage.setItem(removedItemsStorageKey, JSON.stringify(removedItems)); |
||||
|
||||
// Показываем кнопку восстановления
|
||||
$item.html(` |
||||
<p class="modal-basket-item__title"> |
||||
Removing an item from the cart: <span id="${key}_timer" class="timer_counter">5</span>с |
||||
</p> |
||||
<div class="modal-basket-item__return-wrapper"> |
||||
<button class="modal-basket-item__return" data-key="${key}"> |
||||
${woocommerce_params.i18n_restore_item || 'Restore'} |
||||
</button> |
||||
</div> |
||||
`);
|
||||
|
||||
// Проверяем количество товаров в корзине
|
||||
$.ajax({ |
||||
type: 'POST', |
||||
url: woocommerce_params.ajax_url, |
||||
data: { |
||||
action: 'check_cart_count' |
||||
}, |
||||
success: function(response) { |
||||
if (response.success && response.data.count <= 1) { |
||||
// Если после удаления корзина станет пустой (1 товар сейчас, удаляем его)
|
||||
$('.proceed-to-checkout').css('display', 'none'); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
// Удаляем через 5 секунд, если не восстановили
|
||||
const removeTimeout = setTimeout(() => { |
||||
permanentRemoveItem(key, productId, variationId); |
||||
}, 5000); |
||||
|
||||
const product_remove_timer = setInterval(() => { |
||||
let number = Number($(`#${key}_timer`).html()) - 1; |
||||
$(`#${key}_timer`).html(number); |
||||
}, 1000); |
||||
|
||||
// Обработчик восстановления
|
||||
$(document).off('click', `[data-key="${key}"] .modal-basket-item__return`).on('click', `[data-key="${key}"] .modal-basket-item__return`, function(e) { |
||||
e.preventDefault(); |
||||
clearTimeout(removeTimeout); |
||||
clearInterval(product_remove_timer); // Очищаем интервал
|
||||
restoreItem(key, productId, variationId, quantity); |
||||
}); |
||||
} |
||||
|
||||
// Полное удаление товара
|
||||
function permanentRemoveItem(key, productId, variationId) { |
||||
$('#modal-basket').addClass('loading'); |
||||
|
||||
$.ajax({ |
||||
type: 'POST', |
||||
url: woocommerce_params.ajax_url, |
||||
data: { |
||||
action: 'remove_cart_item', |
||||
cart_item_key: key |
||||
}, |
||||
complete: function() { |
||||
$('#modal-basket').removeClass('loading'); |
||||
}, |
||||
success: function(response) { |
||||
if (response.success) { |
||||
// Удаляем из временного хранилища
|
||||
const removedItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || []; |
||||
const updatedItems = removedItems.filter(item =>
|
||||
!(item.product_id === productId && item.variation_id === variationId) |
||||
); |
||||
localStorage.setItem(removedItemsStorageKey, JSON.stringify(updatedItems)); |
||||
|
||||
updateCartFragment(); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// Восстановление товара
|
||||
function restoreItem(key, productId, variationId, quantity) { |
||||
$('#modal-basket').addClass('loading'); |
||||
|
||||
$.ajax({ |
||||
type: 'POST', |
||||
url: woocommerce_params.ajax_url, |
||||
data: { |
||||
action: 'restore_cart_item', |
||||
product_id: productId, |
||||
variation_id: variationId, |
||||
quantity: quantity |
||||
}, |
||||
complete: function() { |
||||
$('#modal-basket').removeClass('loading'); |
||||
}, |
||||
success: function(response) { |
||||
if (response.success) { |
||||
// Удаляем из временного хранилища
|
||||
const removedItems = JSON.parse(localStorage.getItem(removedItemsStorageKey)) || []; |
||||
const updatedItems = removedItems.filter(item =>
|
||||
!(item.product_id === productId && item.variation_id === variationId) |
||||
); |
||||
localStorage.setItem(removedItemsStorageKey, JSON.stringify(updatedItems)); |
||||
|
||||
// Показываем кнопку Proceed to checkout
|
||||
$('.proceed-to-checkout').css('display', ''); |
||||
|
||||
updateCartFragment(); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// --- Работа с cookie ---
|
||||
function setCookie(name, value, days) { |
||||
let expires = ''; |
||||
if (days) { |
||||
const date = new Date(); |
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); |
||||
expires = '; expires=' + date.toUTCString(); |
||||
} |
||||
document.cookie = name + '=' + (value || '') + expires + '; path=/'; |
||||
} |
||||
function getCookie(name) { |
||||
const nameEQ = name + '='; |
||||
const ca = document.cookie.split(';'); |
||||
for(let i=0;i < ca.length;i++) { |
||||
let c = ca[i]; |
||||
while (c.charAt(0)==' ') c = c.substring(1,c.length); |
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); |
||||
} |
||||
return null; |
||||
} |
||||
// --- Конец работы с cookie ---
|
||||
|
||||
// Открытие корзины при первом добавлении товара
|
||||
function openBasketOnFirstAdd() { |
||||
if (!getCookie('basket_popup_shown')) { |
||||
console.log('[openBasketOnFirstAdd] Срабатывает открытие корзины'); |
||||
// Выбираем только модалку, в которой находится корзина
|
||||
var $basket = $('#modal-basket'); |
||||
var $modal = $basket.closest('.modal'); |
||||
var $aside = $modal.find('.modal__aside'); |
||||
var device = window.screen.width; |
||||
|
||||
// Сброс только внутри этой модалки
|
||||
var $items = $modal.find('.modal__item'); |
||||
console.log('[openBasketOnFirstAdd] modal:', $modal.get(), 'modal__item:', $items.get()); |
||||
$items.removeClass('active').attr('style', ''); |
||||
$modal.addClass('active').show(); |
||||
$basket.addClass('active').css({opacity: 1, filter: 'blur(0px)'}); |
||||
console.log('[openBasketOnFirstAdd] basket:', $basket.get()); |
||||
var width = $basket[0] ? $basket[0].clientWidth : 600; |
||||
setTimeout(function() { |
||||
if (device <= 720) { |
||||
$aside.css('width', device + 'px'); |
||||
console.log('[openBasketOnFirstAdd] aside width:', device + 'px'); |
||||
} else { |
||||
$aside.css('width', width + 'px'); |
||||
console.log('[openBasketOnFirstAdd] aside width:', width + 'px'); |
||||
} |
||||
}, 10); |
||||
setCookie('basket_popup_shown', '1', 30); |
||||
} else { |
||||
console.log('[openBasketOnFirstAdd] Куки уже установлены, попап не открывается'); |
||||
} |
||||
} |
||||
|
||||
// Обновление корзины при добавлении товара
|
||||
$(document.body).on('added_to_cart', function() { |
||||
updateCartFragment(); |
||||
openBasketOnFirstAdd(); |
||||
}); |
||||
|
||||
// Функция обновления количества
|
||||
function updateCart(key, quantity) { |
||||
$.ajax({ |
||||
type: 'POST', |
||||
url: '/wp-admin/admin-ajax.php', // Используем стандартный параметр WooCommerce
|
||||
data: { |
||||
action: 'update_cart_quantity', |
||||
cart_item_key: key, |
||||
quantity: quantity |
||||
}, |
||||
beforeSend: function() { |
||||
$('#modal-basket').addClass('loading'); |
||||
}, |
||||
complete: function() { |
||||
$('#modal-basket').removeClass('loading'); |
||||
}, |
||||
success: function(response) { |
||||
if (response.success) { |
||||
updateCartFragment(); |
||||
} else { |
||||
console.error('Ошибка при обновлении корзины'); |
||||
} |
||||
}, |
||||
error: function(xhr, status, error) { |
||||
console.error('AJAX ошибка:', error); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// Обновление фрагментов корзины
|
||||
function updateCartFragment() { |
||||
$.ajax({ |
||||
type: 'POST', |
||||
url: woocommerce_params.ajax_url, |
||||
data: { |
||||
action: 'get_cart_fragment' |
||||
}, |
||||
beforeSend: function() { |
||||
$('#modal-basket').addClass('loading'); |
||||
}, |
||||
complete: function() { |
||||
$('#modal-basket').removeClass('loading'); |
||||
}, |
||||
success: function(response) { |
||||
console.log(response); |
||||
if (response.success) { |
||||
$('#modal-basket-content').html(response.data.contents); |
||||
$('.modal-block-price__price').html(response.data.total); |
||||
$('.mini-profile__button--counter').text(response.data.count); |
||||
if (response.data.count > 0) { |
||||
$('.mini-profile__button--counter').removeClass('disabled'); |
||||
$('.proceed-to-checkout').css('display', ''); // Показываем кнопку, если есть товары
|
||||
} else { |
||||
$('.mini-profile__button--counter').addClass('disabled'); |
||||
$('.proceed-to-checkout').css('display', 'none'); // Скрываем кнопку, если корзина пуста
|
||||
} |
||||
} |
||||
}, |
||||
error: function(xhr, status, error) { |
||||
console.error('AJAX error:', error); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// Добавляем спиннер на кнопку 'Добавить в корзину' в корзине
|
||||
$('body').on('click', '.add_to_cart_button', function() { |
||||
var btn = $(this); |
||||
if (!btn.hasClass('loading')) { |
||||
btn.addClass('loading'); |
||||
btn.data('original-text', btn.html()); |
||||
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>'); |
||||
} |
||||
}); |
||||
|
||||
// Убираем спиннер после завершения ajax WooCommerce
|
||||
$(document.body).on('added_to_cart', function(e, fragments, cart_hash, $button) { |
||||
if ($button && $button.length) { |
||||
$button.removeClass('loading'); |
||||
if ($button.data('original-text')) { |
||||
$button.html($button.data('original-text')); |
||||
$button.removeData('original-text'); |
||||
} |
||||
} |
||||
}); |
||||
}); |
@ -1,13 +1,13 @@ |
||||
<?php |
||||
|
||||
// add_filter('woocommerce_get_script_data', 'add_custom_woocommerce_params', 10, 2); |
||||
// function add_custom_woocommerce_params($params, $handle) { |
||||
// // Добавляем только для скрипта корзины |
||||
// $params['i18n_restore_item'] = pll__('Восстановить'); |
||||
// return $params; |
||||
// } |
||||
|
||||
add_filter('timber/context', function($context) { |
||||
$context['cart_count'] = WC()->cart->get_cart_contents_count(); |
||||
return $context; |
||||
<?php |
||||
|
||||
// add_filter('woocommerce_get_script_data', 'add_custom_woocommerce_params', 10, 2); |
||||
// function add_custom_woocommerce_params($params, $handle) { |
||||
// // Добавляем только для скрипта корзины |
||||
// $params['i18n_restore_item'] = pll__('Восстановить'); |
||||
// return $params; |
||||
// } |
||||
|
||||
add_filter('timber/context', function($context) { |
||||
$context['cart_count'] = WC()->cart->get_cart_contents_count(); |
||||
return $context; |
||||
}); |
File diff suppressed because it is too large
Load Diff
@ -1,332 +1,332 @@ |
||||
jQuery(document).ready(function($) { |
||||
jQuery(document.body).on('updated_checkout', function() { |
||||
// Найти новые методы доставки внутри shop_table
|
||||
var shippingMethodsHtml = jQuery('.woocommerce-checkout-review-order-table .woocommerce-shipping-methods').html(); |
||||
// Обновить кастомный блок
|
||||
if(!shippingMethodsHtml){ |
||||
shippingMethodsHtml ='<p>Не удалось получить доступные методы доставки! <br>Укажите свой город для получения доступных методов.</p>' |
||||
} |
||||
jQuery('#custom-shipping-methods').html(shippingMethodsHtml); |
||||
jQuery('.order-contacts__delivery').removeClass('loading'); |
||||
|
||||
jQuery('.modal-map-control__item.active').click() |
||||
}); |
||||
|
||||
|
||||
$(document.body).on('update_checkout', function() { |
||||
jQuery('.order-contacts__delivery').addClass('loading'); |
||||
}); |
||||
|
||||
$('body').on('click', '.modal-map-control__item', function(){ |
||||
if (!$(this).hasClass('active')){ |
||||
$('#addr_inp').val('') |
||||
$('#pvz_inp').val('') |
||||
$('#billing_address_1').val('') |
||||
$('#billing_address_2').val('') |
||||
} |
||||
$('.shipping-add-info').removeClass('active') |
||||
var remote = $(this).data('remote') |
||||
$('.shipping-add-info[data-remote="' + remote + '"]').addClass('active') |
||||
}) |
||||
|
||||
jQuery('#addr_inp').on('click', function(){ |
||||
jQuery('#address_input').addClass('active') |
||||
}) |
||||
|
||||
}); |
||||
|
||||
|
||||
|
||||
jQuery(document).ready(function($) { |
||||
// Перехват отправки формы купона
|
||||
$(document).on('click', 'button[name="apply_coupon"]', function(e) { |
||||
e.preventDefault(); // Останавливаем отправку основной формы
|
||||
|
||||
// Отправка данных купона через AJAX
|
||||
var couponCode = $('#coupon_code').val(); |
||||
|
||||
if (!couponCode) { |
||||
alert('Пожалуйста, введите код купона.'); |
||||
return; |
||||
} |
||||
|
||||
$.ajax({ |
||||
url: wc_checkout_params.ajax_url, // URL для AJAX-запроса WooCommerce
|
||||
type: 'POST', |
||||
data: { |
||||
action: 'apply_coupon', |
||||
coupon_code: couponCode |
||||
}, |
||||
success: function(response) { |
||||
if (response.success) { |
||||
$(document.body).trigger('update_checkout'); |
||||
$('#promo_form').hide() |
||||
$('#promo_delete').show() |
||||
$('#promo_err').hide() |
||||
$('#coupon_code_app').val('Применен промокод: ' + couponCode) |
||||
$('#delete_coupon').data('coupon', couponCode) |
||||
} else { |
||||
$('#promo_err').show() |
||||
} |
||||
}, |
||||
error: function() { |
||||
alert('Произошла ошибка. Попробуйте ещё раз.'); |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
jQuery('#pvz_inp').on('click', function(){ |
||||
jQuery('.open-pvz-btn').click() |
||||
}) |
||||
|
||||
$('#address_input input').on('change, input, keyup', function(){ |
||||
var address = $('#f_address').val() |
||||
var apart = $('#f_apartment').val() |
||||
var floor = $('#f_floor').val() |
||||
var entrance = $('#f_entrance').val() |
||||
var number_phone = $('#f_number-phone').val() |
||||
|
||||
var address_2 = '' |
||||
|
||||
if (apart){ |
||||
address_2 += ' кв ' + apart |
||||
} |
||||
if (floor){ |
||||
address_2 += ' этаж ' + floor |
||||
} |
||||
if (entrance){ |
||||
address_2 += ' подъезд ' + entrance |
||||
} |
||||
if (number_phone){ |
||||
address_2 += ' домофон ' + number_phone |
||||
} |
||||
$('#addr_inp').val(address + address_2) |
||||
$('#billing_address_1').val(address) |
||||
$('#billing_address_2').val(address_2) |
||||
}) |
||||
}); |
||||
|
||||
|
||||
jQuery(document).ready(function ($) { |
||||
$(document.body).on('checkout_error', function () { |
||||
// $('.woocommerce-error').remove();
|
||||
$('.form-input__error').removeClass('active'); |
||||
|
||||
// // Добавляем ошибки рядом с полями
|
||||
$('.woocommerce-error li').each(function () { |
||||
var errorMessage = $(this).text().trim(); |
||||
var fieldKey = $(this).data('id'); // Предполагается, что ошибка содержит data-id
|
||||
console.log(errorMessage) |
||||
console.log(fieldKey) |
||||
if (fieldKey) { |
||||
var errorContainer = $('#' + fieldKey + '-error'); |
||||
if (errorContainer.length) { |
||||
errorContainer.html('<span class="error-message">' + errorMessage + '</span>'); |
||||
$('#' + fieldKey + '-error').addClass('active'); |
||||
} |
||||
} |
||||
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').addClass('active'); |
||||
} |
||||
if (errorMessage == 'Order pickup point not selected.' || errorMessage == 'Не выбран ПВЗ для доставки заказа.'){ |
||||
$('#pvz-error').html('Не выбран ПВЗ для доставки заказа.') |
||||
$('#pvz-error').addClass('active'); |
||||
} |
||||
if (errorMessage == 'adress_error'){ |
||||
$('#adr-error').html('Не указан адрес доставки') |
||||
$('#adr-error').addClass('active'); |
||||
} |
||||
if (errorMessage == 'Неверный адрес эл. почты для выставления счета'){ |
||||
$('#billing_email-error').html(errorMessage).addClass('active'); |
||||
} |
||||
if(errorMessage == 'Не выбран метод доставки. Пожалуйста перепроверьте ваш адрес или обратитесь за помощью к администрации сайта.'){ |
||||
$('#billing_city-error').html(errorMessage).addClass('active'); |
||||
} |
||||
if(errorMessage == 'Этот email уже зарегистрирован.'){ |
||||
$('#acc-error').html('Этот email уже зарегистрирован. Войдите в свой аккаунт или укажите другой E-mail.').addClass('active'); |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
$('#delete_coupon').on('click', function(){ |
||||
$('.woocommerce-remove-coupon[data-coupon=' + $(this).data('coupon') + ']').click() |
||||
}) |
||||
$('.woocommerce-remove-coupon').on('click', function(){ |
||||
|
||||
$('#promo_form').show() |
||||
$('#promo_delete').hide() |
||||
}) |
||||
}); |
||||
|
||||
jQuery(document).ready(function($) { |
||||
// Функция для получения активных фильтров из URL
|
||||
function getActiveFilters() { |
||||
const params = new URLSearchParams(window.location.search); |
||||
const filters = []; |
||||
|
||||
params.forEach((value, key) => { |
||||
if (key.startsWith('filter_') || key === 'min_price' || key === 'max_price') { |
||||
let filterName = key.replace('filter_', '').replace('_', ' '); |
||||
let filterValue = value.split(',').map(val => decodeURIComponent(val.replace(/\+/g, ' '))); |
||||
|
||||
if (key === 'min_price') { |
||||
filterName = 'Цена от'; |
||||
filterValue = [value + ' ₽']; |
||||
} else if (key === 'max_price') { |
||||
filterName = 'Цена до'; |
||||
filterValue = [value + ' ₽']; |
||||
} |
||||
|
||||
filters.push({ |
||||
key: key, |
||||
name: filterName.charAt( W1).toUpperCase() + filterName.slice(1), |
||||
values: filterValue |
||||
}); |
||||
} |
||||
}); |
||||
|
||||
return filters; |
||||
} |
||||
|
||||
// Функция для отображения активных фильтров
|
||||
function displayActiveFilters() { |
||||
const $filterList = $('.active-filters__list'); |
||||
const $filterContainer = $('.active-filters'); |
||||
const $clearButton = $('.active-filters__clear'); |
||||
$filterList.empty(); |
||||
|
||||
const activeFilters = getActiveFilters(); |
||||
|
||||
if (activeFilters.length > 0) { |
||||
$filterContainer.show(); |
||||
$clearButton.show(); |
||||
|
||||
activeFilters.forEach(filter => { |
||||
filter.values.forEach(value => { |
||||
const $filterTag = $('<span>', { |
||||
class: 'active-filters__tag', |
||||
html: `${filter.name}: ${value} <span class="active-filters__remove" data-key="${filter.key}" data-value="${value}">×</span>` |
||||
}); |
||||
$filterList.append($filterTag); |
||||
}); |
||||
}); |
||||
W2 else { |
||||
$filterContainer.hide(); |
||||
$clearButton.hide(); |
||||
} |
||||
} |
||||
|
||||
// Инициализация при загрузке страницы
|
||||
displayActiveFilters(); |
||||
|
||||
// Обновление фильтров после AJAX-фильтрации
|
||||
$(document).on('wcpf_after_filtering', function() { |
||||
displayActiveFilters(); |
||||
}); |
||||
|
||||
// Удаление фильтра
|
||||
$(document).on('click', '.active-filters__remove', function() { |
||||
const key = $(this).data('key'); |
||||
const value = $(this).data('value'); |
||||
const params = new URLSearchParams(window.location.search); |
||||
|
||||
if (key === 'min_price' || key === 'max_price') { |
||||
params.delete(key); |
||||
} else { |
||||
let values = params.get(key) ? params.get(key).split(',') : []; |
||||
values = values.filter(val => decodeURIComponent(val.replace(/\+/g, ' ')) !== value); |
||||
if (values.length > 0) { |
||||
params.set(key, values.join(',')); |
||||
} else { |
||||
params.delete(key); |
||||
} |
||||
} |
||||
|
||||
const newUrl = window.location.pathname + (params.toString() ? '?' + params.toString() : ''); |
||||
window.history.pushState({}, '', newUrl); |
||||
|
||||
// Запуск AJAX-фильтрации
|
||||
$.ajax({ |
||||
url: wc_checkout_params.ajax_url, |
||||
type: 'POST', |
||||
data: { |
||||
action: 'wcpf_filter', |
||||
query: params.toString(), |
||||
category_id: $('#load-more-products').data('category_id'), |
||||
category_type: $('#load-more-products').data('category_type') |
||||
}, |
||||
success: function(response) { |
||||
if (response.success) { |
||||
$('.product__main').html(response.data.products); |
||||
displayActiveFilters(); |
||||
$(document.body).trigger('wc_fragments_refreshed'); |
||||
} |
||||
}, |
||||
error: function() { |
||||
alert('Ошибка при обновлении фильтров'); |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
// Очистка всех фильтров
|
||||
$(document).on('click', '.active-filters__clear', function() { |
||||
const params = new URLSearchParams(window.location.search); |
||||
const newUrl = window.location.pathname; |
||||
window.history.pushState({}, '', newUrl); |
||||
|
||||
$.ajax({ |
||||
url: wc_checkout_params.ajax_url, |
||||
type: 'POST', |
||||
data: { |
||||
action: 'wcpf_filter', |
||||
query: '', |
||||
category_id: $('#load-more-products').data('category_id'), |
||||
category_type: $('#load-more-products').data('category_type') |
||||
}, |
||||
success: function(response) { |
||||
if (response.success) { |
||||
$('.product__main').html(response.data.products); |
||||
displayActiveFilters(); |
||||
$(document.body).trigger('wc_fragments_refreshed'); |
||||
} |
||||
}, |
||||
error: function() { |
||||
alert('Ошибка при очистке фильтров'); |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
// Обработка загрузки дополнительных продуктов
|
||||
$(document).on('click', '#load-more-products', function() { |
||||
const $button = $(this); |
||||
const categoryId = $button.data('category_id'); |
||||
const categoryType = $button.data('category_type'); |
||||
const page = parseInt($button.data('page') || 1) + 1; |
||||
|
||||
$.ajax({ |
||||
url: wc_checkout_params.ajax_url, |
||||
type: 'POST', |
||||
data: { |
||||
action: 'load_more_products', |
||||
category_id: categoryId, |
||||
category_type: categoryType, |
||||
page: page, |
||||
query: window.location.search |
||||
}, |
||||
success: function(response) { |
||||
if (response.success) { |
||||
$('.product__main').append(response.data.products); |
||||
$button.data('page', page); |
||||
if (!response.data.has_more) { |
||||
$button.hide(); |
||||
} |
||||
} |
||||
}, |
||||
error: function() { |
||||
alert('Ошибка при загрузке продуктов'); |
||||
} |
||||
}); |
||||
}); |
||||
}); |
||||
|
||||
jQuery(document).ready(function($) { |
||||
jQuery(document.body).on('updated_checkout', function() { |
||||
// Найти новые методы доставки внутри shop_table
|
||||
var shippingMethodsHtml = jQuery('.woocommerce-checkout-review-order-table .woocommerce-shipping-methods').html(); |
||||
// Обновить кастомный блок
|
||||
if(!shippingMethodsHtml){ |
||||
shippingMethodsHtml ='<p>Не удалось получить доступные методы доставки! <br>Укажите свой город для получения доступных методов.</p>' |
||||
} |
||||
jQuery('#custom-shipping-methods').html(shippingMethodsHtml); |
||||
jQuery('.order-contacts__delivery').removeClass('loading'); |
||||
|
||||
jQuery('.modal-map-control__item.active').click() |
||||
}); |
||||
|
||||
|
||||
$(document.body).on('update_checkout', function() { |
||||
jQuery('.order-contacts__delivery').addClass('loading'); |
||||
}); |
||||
|
||||
$('body').on('click', '.modal-map-control__item', function(){ |
||||
if (!$(this).hasClass('active')){ |
||||
$('#addr_inp').val('') |
||||
$('#pvz_inp').val('') |
||||
$('#billing_address_1').val('') |
||||
$('#billing_address_2').val('') |
||||
} |
||||
$('.shipping-add-info').removeClass('active') |
||||
var remote = $(this).data('remote') |
||||
$('.shipping-add-info[data-remote="' + remote + '"]').addClass('active') |
||||
}) |
||||
|
||||
jQuery('#addr_inp').on('click', function(){ |
||||
jQuery('#address_input').addClass('active') |
||||
}) |
||||
|
||||
}); |
||||
|
||||
|
||||
|
||||
jQuery(document).ready(function($) { |
||||
// Перехват отправки формы купона
|
||||
$(document).on('click', 'button[name="apply_coupon"]', function(e) { |
||||
e.preventDefault(); // Останавливаем отправку основной формы
|
||||
|
||||
// Отправка данных купона через AJAX
|
||||
var couponCode = $('#coupon_code').val(); |
||||
|
||||
if (!couponCode) { |
||||
alert('Пожалуйста, введите код купона.'); |
||||
return; |
||||
} |
||||
|
||||
$.ajax({ |
||||
url: wc_checkout_params.ajax_url, // URL для AJAX-запроса WooCommerce
|
||||
type: 'POST', |
||||
data: { |
||||
action: 'apply_coupon', |
||||
coupon_code: couponCode |
||||
}, |
||||
success: function(response) { |
||||
if (response.success) { |
||||
$(document.body).trigger('update_checkout'); |
||||
$('#promo_form').hide() |
||||
$('#promo_delete').show() |
||||
$('#promo_err').hide() |
||||
$('#coupon_code_app').val('Применен промокод: ' + couponCode) |
||||
$('#delete_coupon').data('coupon', couponCode) |
||||
} else { |
||||
$('#promo_err').show() |
||||
} |
||||
}, |
||||
error: function() { |
||||
alert('Произошла ошибка. Попробуйте ещё раз.'); |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
jQuery('#pvz_inp').on('click', function(){ |
||||
jQuery('.open-pvz-btn').click() |
||||
}) |
||||
|
||||
$('#address_input input').on('change, input, keyup', function(){ |
||||
var address = $('#f_address').val() |
||||
var apart = $('#f_apartment').val() |
||||
var floor = $('#f_floor').val() |
||||
var entrance = $('#f_entrance').val() |
||||
var number_phone = $('#f_number-phone').val() |
||||
|
||||
var address_2 = '' |
||||
|
||||
if (apart){ |
||||
address_2 += ' кв ' + apart |
||||
} |
||||
if (floor){ |
||||
address_2 += ' этаж ' + floor |
||||
} |
||||
if (entrance){ |
||||
address_2 += ' подъезд ' + entrance |
||||
} |
||||
if (number_phone){ |
||||
address_2 += ' домофон ' + number_phone |
||||
} |
||||
$('#addr_inp').val(address + address_2) |
||||
$('#billing_address_1').val(address) |
||||
$('#billing_address_2').val(address_2) |
||||
}) |
||||
}); |
||||
|
||||
|
||||
jQuery(document).ready(function ($) { |
||||
$(document.body).on('checkout_error', function () { |
||||
// $('.woocommerce-error').remove();
|
||||
$('.form-input__error').removeClass('active'); |
||||
|
||||
// // Добавляем ошибки рядом с полями
|
||||
$('.woocommerce-error li').each(function () { |
||||
var errorMessage = $(this).text().trim(); |
||||
var fieldKey = $(this).data('id'); // Предполагается, что ошибка содержит data-id
|
||||
console.log(errorMessage) |
||||
console.log(fieldKey) |
||||
if (fieldKey) { |
||||
var errorContainer = $('#' + fieldKey + '-error'); |
||||
if (errorContainer.length) { |
||||
errorContainer.html('<span class="error-message">' + errorMessage + '</span>'); |
||||
$('#' + fieldKey + '-error').addClass('active'); |
||||
} |
||||
} |
||||
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').addClass('active'); |
||||
} |
||||
if (errorMessage == 'Order pickup point not selected.' || errorMessage == 'Не выбран ПВЗ для доставки заказа.'){ |
||||
$('#pvz-error').html('Не выбран ПВЗ для доставки заказа.') |
||||
$('#pvz-error').addClass('active'); |
||||
} |
||||
if (errorMessage == 'adress_error'){ |
||||
$('#adr-error').html('Не указан адрес доставки') |
||||
$('#adr-error').addClass('active'); |
||||
} |
||||
if (errorMessage == 'Неверный адрес эл. почты для выставления счета'){ |
||||
$('#billing_email-error').html(errorMessage).addClass('active'); |
||||
} |
||||
if(errorMessage == 'Не выбран метод доставки. Пожалуйста перепроверьте ваш адрес или обратитесь за помощью к администрации сайта.'){ |
||||
$('#billing_city-error').html(errorMessage).addClass('active'); |
||||
} |
||||
if(errorMessage == 'Этот email уже зарегистрирован.'){ |
||||
$('#acc-error').html('Этот email уже зарегистрирован. Войдите в свой аккаунт или укажите другой E-mail.').addClass('active'); |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
$('#delete_coupon').on('click', function(){ |
||||
$('.woocommerce-remove-coupon[data-coupon=' + $(this).data('coupon') + ']').click() |
||||
}) |
||||
$('.woocommerce-remove-coupon').on('click', function(){ |
||||
|
||||
$('#promo_form').show() |
||||
$('#promo_delete').hide() |
||||
}) |
||||
}); |
||||
|
||||
jQuery(document).ready(function($) { |
||||
// Функция для получения активных фильтров из URL
|
||||
function getActiveFilters() { |
||||
const params = new URLSearchParams(window.location.search); |
||||
const filters = []; |
||||
|
||||
params.forEach((value, key) => { |
||||
if (key.startsWith('filter_') || key === 'min_price' || key === 'max_price') { |
||||
let filterName = key.replace('filter_', '').replace('_', ' '); |
||||
let filterValue = value.split(',').map(val => decodeURIComponent(val.replace(/\+/g, ' '))); |
||||
|
||||
if (key === 'min_price') { |
||||
filterName = 'Цена от'; |
||||
filterValue = [value + ' ₽']; |
||||
} else if (key === 'max_price') { |
||||
filterName = 'Цена до'; |
||||
filterValue = [value + ' ₽']; |
||||
} |
||||
|
||||
filters.push({ |
||||
key: key, |
||||
name: filterName.charAt( W1).toUpperCase() + filterName.slice(1), |
||||
values: filterValue |
||||
}); |
||||
} |
||||
}); |
||||
|
||||
return filters; |
||||
} |
||||
|
||||
// Функция для отображения активных фильтров
|
||||
function displayActiveFilters() { |
||||
const $filterList = $('.active-filters__list'); |
||||
const $filterContainer = $('.active-filters'); |
||||
const $clearButton = $('.active-filters__clear'); |
||||
$filterList.empty(); |
||||
|
||||
const activeFilters = getActiveFilters(); |
||||
|
||||
if (activeFilters.length > 0) { |
||||
$filterContainer.show(); |
||||
$clearButton.show(); |
||||
|
||||
activeFilters.forEach(filter => { |
||||
filter.values.forEach(value => { |
||||
const $filterTag = $('<span>', { |
||||
class: 'active-filters__tag', |
||||
html: `${filter.name}: ${value} <span class="active-filters__remove" data-key="${filter.key}" data-value="${value}">×</span>` |
||||
}); |
||||
$filterList.append($filterTag); |
||||
}); |
||||
}); |
||||
} else { |
||||
$filterContainer.hide(); |
||||
$clearButton.hide(); |
||||
} |
||||
} |
||||
|
||||
// Инициализация при загрузке страницы
|
||||
displayActiveFilters(); |
||||
|
||||
// Обновление фильтров после AJAX-фильтрации
|
||||
$(document).on('wcpf_after_filtering', function() { |
||||
displayActiveFilters(); |
||||
}); |
||||
|
||||
// Удаление фильтра
|
||||
$(document).on('click', '.active-filters__remove', function() { |
||||
const key = $(this).data('key'); |
||||
const value = $(this).data('value'); |
||||
const params = new URLSearchParams(window.location.search); |
||||
|
||||
if (key === 'min_price' || key === 'max_price') { |
||||
params.delete(key); |
||||
} else { |
||||
let values = params.get(key) ? params.get(key).split(',') : []; |
||||
values = values.filter(val => decodeURIComponent(val.replace(/\+/g, ' ')) !== value); |
||||
if (values.length > 0) { |
||||
params.set(key, values.join(',')); |
||||
} else { |
||||
params.delete(key); |
||||
} |
||||
} |
||||
|
||||
const newUrl = window.location.pathname + (params.toString() ? '?' + params.toString() : ''); |
||||
window.history.pushState({}, '', newUrl); |
||||
|
||||
// Запуск AJAX-фильтрации
|
||||
$.ajax({ |
||||
url: wc_checkout_params.ajax_url, |
||||
type: 'POST', |
||||
data: { |
||||
action: 'wcpf_filter', |
||||
query: params.toString(), |
||||
category_id: $('#load-more-products').data('category_id'), |
||||
category_type: $('#load-more-products').data('category_type') |
||||
}, |
||||
success: function(response) { |
||||
if (response.success) { |
||||
$('.product__main').html(response.data.products); |
||||
displayActiveFilters(); |
||||
$(document.body).trigger('wc_fragments_refreshed'); |
||||
} |
||||
}, |
||||
error: function() { |
||||
alert('Ошибка при обновлении фильтров'); |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
// Очистка всех фильтров
|
||||
$(document).on('click', '.active-filters__clear', function() { |
||||
const params = new URLSearchParams(window.location.search); |
||||
const newUrl = window.location.pathname; |
||||
window.history.pushState({}, '', newUrl); |
||||
|
||||
$.ajax({ |
||||
url: wc_checkout_params.ajax_url, |
||||
type: 'POST', |
||||
data: { |
||||
action: 'wcpf_filter', |
||||
query: '', |
||||
category_id: $('#load-more-products').data('category_id'), |
||||
category_type: $('#load-more-products').data('category_type') |
||||
}, |
||||
success: function(response) { |
||||
if (response.success) { |
||||
$('.product__main').html(response.data.products); |
||||
displayActiveFilters(); |
||||
$(document.body).trigger('wc_fragments_refreshed'); |
||||
} |
||||
}, |
||||
error: function() { |
||||
alert('Ошибка при очистке фильтров'); |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
// Обработка загрузки дополнительных продуктов
|
||||
$(document).on('click', '#load-more-products', function() { |
||||
const $button = $(this); |
||||
const categoryId = $button.data('category_id'); |
||||
const categoryType = $button.data('category_type'); |
||||
const page = parseInt($button.data('page') || 1) + 1; |
||||
|
||||
$.ajax({ |
||||
url: wc_checkout_params.ajax_url, |
||||
type: 'POST', |
||||
data: { |
||||
action: 'load_more_products', |
||||
category_id: categoryId, |
||||
category_type: categoryType, |
||||
page: page, |
||||
query: window.location.search |
||||
}, |
||||
success: function(response) { |
||||
if (response.success) { |
||||
$('.product__main').append(response.data.products); |
||||
$button.data('page', page); |
||||
if (!response.data.has_more) { |
||||
$button.hide(); |
||||
} |
||||
} |
||||
}, |
||||
error: function() { |
||||
alert('Ошибка при загрузке продуктов'); |
||||
} |
||||
}); |
||||
}); |
||||
}); |
||||
|
||||
|
@ -1,74 +1,74 @@ |
||||
<?php |
||||
|
||||
|
||||
add_filter('timber/context', function($context) { |
||||
if (function_exists('is_product') && is_product()) { |
||||
$product_id = get_the_ID(); |
||||
$product = wc_get_product($product_id); |
||||
|
||||
if ($product) { |
||||
$attributes = []; |
||||
$product_attributes = $product->get_attributes(); |
||||
|
||||
if (!empty($product_attributes)) { |
||||
foreach ($product_attributes as $taxonomy => $attribute) { |
||||
if ($attribute->is_taxonomy()) { |
||||
$terms = wc_get_product_terms($product_id, $taxonomy, ['fields' => 'all']); |
||||
if (!empty($terms)) { |
||||
$attr_values = []; |
||||
foreach ($terms as $term) { |
||||
$attr_values[] = [ |
||||
'name' => $term->name, |
||||
'slug' => $term->slug, |
||||
'term_id' => $term->term_id, |
||||
'link' => get_term_link($term->term_id, $taxonomy), |
||||
]; |
||||
} |
||||
$attributes[wc_attribute_label($taxonomy)] = $attr_values; |
||||
} |
||||
} else { |
||||
$attributes[wc_attribute_label($taxonomy)] = $attribute->get_options(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
$context['product_attributes'] = $attributes; |
||||
|
||||
if ($product->is_type('variable')) { |
||||
$available_variations = $product->get_available_variations(); |
||||
$variations_data = []; |
||||
|
||||
foreach ($available_variations as $variation) { |
||||
$variation_id = $variation['variation_id']; |
||||
$variation_obj = wc_get_product($variation_id); |
||||
|
||||
$variations_data[] = [ |
||||
'variation_id' => $variation_id, |
||||
'price' => $variation_obj->get_price(), |
||||
'regular_price' => $variation_obj->get_regular_price(), |
||||
'sale_price' => $variation_obj->get_sale_price(), |
||||
'attributes' => $variation['attributes'] |
||||
]; |
||||
} |
||||
|
||||
$context['variations'] = $variations_data; |
||||
} |
||||
|
||||
$meta_fields = [ |
||||
'composition' => get_post_meta($product_id, '_composition', true), |
||||
'feeding_recommendations' => get_post_meta($product_id, '_feeding_recommendations', true), |
||||
'feeding_recommendations_table' => get_field('feeding_recommendations_table', $product_id), |
||||
|
||||
'nutritional_value' => get_post_meta($product_id, '_nutritional_value', true), |
||||
'vitamins' => get_post_meta($product_id, '_vitamins', true), |
||||
'additives' => get_post_meta($product_id, '_additives', true), |
||||
'energy_value' => get_post_meta($product_id, '_energy_value', true), |
||||
'important' => get_post_meta($product_id, '_important', true), |
||||
]; |
||||
|
||||
$context['product_meta'] = $meta_fields; |
||||
} |
||||
} |
||||
|
||||
return $context; |
||||
<?php |
||||
|
||||
|
||||
add_filter('timber/context', function($context) { |
||||
if (function_exists('is_product') && is_product()) { |
||||
$product_id = get_the_ID(); |
||||
$product = wc_get_product($product_id); |
||||
|
||||
if ($product) { |
||||
$attributes = []; |
||||
$product_attributes = $product->get_attributes(); |
||||
|
||||
if (!empty($product_attributes)) { |
||||
foreach ($product_attributes as $taxonomy => $attribute) { |
||||
if ($attribute->is_taxonomy()) { |
||||
$terms = wc_get_product_terms($product_id, $taxonomy, ['fields' => 'all']); |
||||
if (!empty($terms)) { |
||||
$attr_values = []; |
||||
foreach ($terms as $term) { |
||||
$attr_values[] = [ |
||||
'name' => $term->name, |
||||
'slug' => $term->slug, |
||||
'term_id' => $term->term_id, |
||||
'link' => get_term_link($term->term_id, $taxonomy), |
||||
]; |
||||
} |
||||
$attributes[wc_attribute_label($taxonomy)] = $attr_values; |
||||
} |
||||
} else { |
||||
$attributes[wc_attribute_label($taxonomy)] = $attribute->get_options(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
$context['product_attributes'] = $attributes; |
||||
|
||||
if ($product->is_type('variable')) { |
||||
$available_variations = $product->get_available_variations(); |
||||
$variations_data = []; |
||||
|
||||
foreach ($available_variations as $variation) { |
||||
$variation_id = $variation['variation_id']; |
||||
$variation_obj = wc_get_product($variation_id); |
||||
|
||||
$variations_data[] = [ |
||||
'variation_id' => $variation_id, |
||||
'price' => $variation_obj->get_price(), |
||||
'regular_price' => $variation_obj->get_regular_price(), |
||||
'sale_price' => $variation_obj->get_sale_price(), |
||||
'attributes' => $variation['attributes'] |
||||
]; |
||||
} |
||||
|
||||
$context['variations'] = $variations_data; |
||||
} |
||||
|
||||
$meta_fields = [ |
||||
'composition' => get_post_meta($product_id, '_composition', true), |
||||
'feeding_recommendations' => get_post_meta($product_id, '_feeding_recommendations', true), |
||||
'feeding_recommendations_table' => get_field('feeding_recommendations_table', $product_id), |
||||
|
||||
'nutritional_value' => get_post_meta($product_id, '_nutritional_value', true), |
||||
'vitamins' => get_post_meta($product_id, '_vitamins', true), |
||||
'additives' => get_post_meta($product_id, '_additives', true), |
||||
'energy_value' => get_post_meta($product_id, '_energy_value', true), |
||||
'important' => get_post_meta($product_id, '_important', true), |
||||
]; |
||||
|
||||
$context['product_meta'] = $meta_fields; |
||||
} |
||||
} |
||||
|
||||
return $context; |
||||
}); |
@ -1,444 +1,444 @@ |
||||
{% set current_path = template_path ~ '/modules/shop/components/single-product' %} |
||||
|
||||
{% set bodyClass = 'bg-white' %} |
||||
|
||||
{% set mainClass = 'wrapper' %} |
||||
|
||||
{% extends 'layout.twig' %} |
||||
|
||||
{% block content %} |
||||
<div class="wrapper"> |
||||
<div class="breadcrumbs"> |
||||
{% if wc_breadcrumbs %} |
||||
{% for crumb in wc_breadcrumbs %} |
||||
<a href="{{ crumb.url }}" class="breadcrumbs__item"> |
||||
{{ crumb.text }} |
||||
</a> |
||||
{% endfor %} |
||||
{% endif %} |
||||
</div> |
||||
|
||||
<a href="{{ fn('get_permalink', fn('wc_get_page_id', 'shop')) }}" class="back back-detail"> |
||||
{{ function('pll_e', 'к каталогу') }} |
||||
</a> |
||||
|
||||
<div class="detail"> |
||||
<div class="detail__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 }}"> |
||||
<img src="{{ image.src }}" alt="{{ image.alt }}" class=""> |
||||
</div> |
||||
{% endfor %} |
||||
<div class="swiper-pagination"></div> |
||||
</div> |
||||
|
||||
<div class="detail__content"> |
||||
<div class="detail__label"> |
||||
{% if product_attributes.Flavor is defined and product_attributes.Flavor|length > 0 %} |
||||
<div class="product-item-label__tag product-item-label__tag--black"> |
||||
{{ product_attributes.Flavor[0].name }} |
||||
</div> |
||||
{% endif %} |
||||
{% if product_attributes.Вкус is defined and product_attributes.Вкус|length > 0 %} |
||||
<div class="product-item-label__tag product-item-label__tag--black"> |
||||
<a href="{{ product_attributes.Вкус[0].link }}">{{ product_attributes.Вкус[0].name }}</a> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if product_attributes.Тег is defined and product_attributes.Тег|length > 0 %} |
||||
<div class="product-item-label__tag product-item-label__tag--title"> |
||||
<a href="{{ product_attributes.Тег[0].link }}">{{ product_attributes.Тег[0].name }}</a> |
||||
</div> |
||||
{% endif %} |
||||
{% if product.is_on_sale() %} |
||||
<div class="product-item-label__tag product-item-label__tag--sale"> |
||||
{{ function('pll_e', 'Распродажа %') }} |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
<h1 class="detail__title"> |
||||
{{ product.get_title }} |
||||
</h1> |
||||
|
||||
<div class="detail__images-phone"> |
||||
<div class="swiper-wrapper"> |
||||
{% for image in gallery_images %} |
||||
<div class="swiper-slide"> |
||||
<div class="detail-images-phone__image-block" data-count-img="{{ loop.index0 }}"> |
||||
<img src="{{ image.src }}" alt="{{ image.alt }}"> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<div class="swiper-pagination"></div> |
||||
</div> |
||||
|
||||
<div class="detail__block-price"> |
||||
<p class="detail-block-price__price"> |
||||
{{ product.get_price }} {{ fn('get_woocommerce_currency_symbol') }} |
||||
</p> |
||||
|
||||
{% if product.is_on_sale() %} |
||||
<div class="detail-block-price__sale"> |
||||
<p class="detail-block-price-sale__text"> |
||||
{{ product.get_regular_price }} {{ fn('get_woocommerce_currency_symbol') }} |
||||
</p> |
||||
<p class="detail-block-price-sale__perc"> |
||||
{{ ((product.get_regular_price - product.get_price) / product.get_regular_price * 100)|round }} |
||||
</p> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
<form action="" class="detail-block__form" data-product-id="{{ product.id }}"> |
||||
{% set collection = fn('wc_get_product_terms', product.id, 'pa_collection') %} |
||||
{% if collection %} |
||||
{% set siblings = function('get_collection_siblings', collection[0].term_id) %} |
||||
{% if siblings %} |
||||
<div class="detail-block-form__item detail-block-form__item--radio radio-button"> |
||||
{% for sibling in siblings %} |
||||
{% set weight = sibling.post_title|split(', ')|last %} |
||||
{% set current_weight = function('get_product_info', product.id, 'weight') %} |
||||
{% 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') }}"> |
||||
{{ weight|upper }} |
||||
</a> |
||||
{% endfor %} |
||||
<input type="text" class="radio-button__input" value="{{ current_weight|upper }}" readonly> |
||||
</div> |
||||
{% endif %} |
||||
{% endif %} |
||||
|
||||
|
||||
</form> |
||||
{{ function('do_action', 'woocommerce_' ~ product.get_type() ~ '_add_to_cart') }} |
||||
<div class="detail__toggle"> |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'ОПИСАНИЕ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
<p class="toggle__text"> |
||||
{{ product.get_description() }} |
||||
</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
{% if product_meta.composition %} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'СОСТАВ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
<p class="toggle__text"> |
||||
{{ product_meta.composition }} |
||||
</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if product_meta.feeding_recommendations_table %} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'РЕКОМЕНДАЦИИ ПО КОРМЛЕНИЮ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
<div class="toggle__table toggle__table--three"> |
||||
{% if product_meta.feeding_recommendations_table.header %} |
||||
<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> |
||||
{% for row in product_meta.feeding_recommendations_table.body %} |
||||
<div class="toggle-table__item"> |
||||
<p>{{ row.0 is iterable ? row.0|join(', ') : row.0 }}</p> |
||||
<div class="toggle-table-item__line"></div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<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> |
||||
{% for row in product_meta.feeding_recommendations_table.body %} |
||||
<div class="toggle-table__item"> |
||||
<p>{{ row.1 is iterable ? row.1|join(', ') : row.1 }}</p> |
||||
<div class="toggle-table-item__line"></div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<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> |
||||
{% for row in product_meta.feeding_recommendations_table.body %} |
||||
<div class="toggle-table__item"> |
||||
<p>{{ row.2 is iterable ? row.2|join(', ') : row.2 }}</p> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% elseif product_meta.feeding_recommendations %} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'РЕКОМЕНДАЦИИ ПО КОРМЛЕНИЮ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
{{ product_meta.feeding_recommendations }} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if product_meta.nutritional_value or product_meta.vitamins or product_meta.additives or product_meta.energy_value %} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'ПИЩЕВАЯ ЦЕННОСТЬ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
{% if product_meta.nutritional_value and product_meta.vitamins %} |
||||
<div class="toggle__table toggle__table--two"> |
||||
<div class="toggle-table__block "> |
||||
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ПИЩЕВАЯ ЦЕННОСТЬ') }}</p> |
||||
{{ product_meta.nutritional_value }} |
||||
</div> |
||||
<div class="toggle-table__block "> |
||||
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ВИТАМИНЫ НА КГ') }}</p> |
||||
{{ product_meta.vitamins }} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if product_meta.additives or product_meta.energy_value %} |
||||
<div class="toggle__table toggle__table--two"> |
||||
{% if product_meta.additives %} |
||||
<div class="toggle-table__block "> |
||||
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ПИТАТЕЛЬНЫЕ ДОБАВКИ НА КГ') }}</p> |
||||
{{ product_meta.additives }} |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if product_meta.energy_value %} |
||||
<div class="toggle-table__block "> |
||||
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ЭНЕРГЕТИЧЕСКАЯ ЦЕННОСТЬ НА 100 ГРАММ') }}</p> |
||||
<div class="toggle-table__item"> |
||||
<div class="detail__warning warning"> |
||||
<div class="detail-warning__content"> |
||||
<p class="detail-warning__title">{{ product_meta.energy_value }}</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
|
||||
</div> |
||||
|
||||
|
||||
<div class="detail__warning"> |
||||
<div class="detail-warning__content"> |
||||
<p class="detail-warning__title">{{ function('pll_e', 'Важно') }}</p> |
||||
<p class="detail-warning__text"> |
||||
{{ product_meta.important }} |
||||
</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="product__main"> |
||||
{% 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) %} |
||||
{% if related_products %} |
||||
<div class="detail__wrapper-catalot"> |
||||
<div class="detail__catalot"> |
||||
<div class="detail-catalot__header"> |
||||
<p class="detail-catalot__title"> |
||||
{{ function('pll_e', 'вашему питомцу может понравиться') }} |
||||
</p> |
||||
|
||||
<div class="detail-catalot__control"> |
||||
<button class="detail-catalot-control__button prev"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-left.svg" alt=""> |
||||
</button> |
||||
|
||||
<button class="detail-catalot-control__button next"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-right.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
<div class="detail-catalot__content swiper-wrapper"> |
||||
{% for related_product in related_products %} |
||||
<div class="swiper-slide"> |
||||
{% set post_id = related_product.ID is defined ? related_product.ID : related_product %} |
||||
{% set wc_product = fn('wc_get_product', post_id) %} |
||||
{% if wc_product %} |
||||
<div class="product__item"> |
||||
<div class="product-item__label"> |
||||
{% 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"> |
||||
{{ function('pll_e', 'Новинка') }} |
||||
</span> |
||||
{% endif %} |
||||
|
||||
{% if wc_product.is_on_sale() %} |
||||
<span href="#" class="product-item-label__tag product-item-label__tag--sale"> |
||||
{{ function('pll_e', 'Распродажа %') }} |
||||
</span> |
||||
{% endif %} |
||||
</div> |
||||
<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"> |
||||
</a> |
||||
<div class="product-item__content-card"> |
||||
<div class="compound"> |
||||
{% set compound = fn('wc_get_product_terms', post_id, 'pa_compound') %} |
||||
{% for option in compound %} |
||||
{% set term = get_term(option) %} |
||||
<a href="/compound/{{ term.slug }}" class="compound__item">{{ term.name }}</a> |
||||
{% endfor %} |
||||
</div> |
||||
<a href="{{ wc_product.get_permalink() }}" class="product-item__title">{{ wc_product.get_name() }}</a> |
||||
<div class="product-item__price"> |
||||
<p>{{ wc_product.get_price() }} {{ fn('get_woocommerce_currency_symbol') }}</p> |
||||
</div> |
||||
<div class="product-item__bye"> |
||||
<button class="button button--white button--100-perc open-overlay"> |
||||
{{ function('pll_e', 'Купить') }} |
||||
</button> |
||||
</div> |
||||
</div> |
||||
<div class="product-item__overlay"> |
||||
<div class="product-item-overlay__header"> |
||||
<a href="{{ wc_product.get_permalink() }}" class="product-item__title">{{ wc_product.get_name() }}</a> |
||||
<ul class="product-item-overlay__tags"> |
||||
{% set features = fn('wc_get_product_terms', post_id, 'pa_features') %} |
||||
{% for option in features %} |
||||
{% set term = get_term(option) %} |
||||
<li>{{ term.name }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
</div> |
||||
|
||||
<form class="product-item__form" method="post" action="/send-telegram.php"> |
||||
<div class="product-item-overlay__input-block"> |
||||
<div class="product-item-overlay__field"> |
||||
<p class="product-item-overlay-field__title">Объем</p> |
||||
|
||||
<div class="select"> |
||||
{% 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() }}"> |
||||
<div class="state__block"> |
||||
<ul class="state__content"> |
||||
{% set collection = fn('wc_get_product_terms', post_id, 'pa_collection') %} |
||||
{% for option in collection %} |
||||
{% set term = get_term(option) %} |
||||
{% if term %} |
||||
{% set siblings = function('get_collection_siblings', term.term_id) %} |
||||
|
||||
{% for sibling in siblings %} |
||||
{% set weight = function('get_product_info', sibling.ID, 'weight') %} |
||||
|
||||
{% set class = '' %} |
||||
{% if weight == cur_weight %} |
||||
{% set class = 'active' %} |
||||
{% endif %} |
||||
<li> |
||||
<button class="state__button {{ class }}" data-product_id="{{ sibling.ID }}" data-product_price="{{ function('get_product_info', sibling.ID, 'price') }}"> |
||||
{{ weight }} |
||||
</button> |
||||
</li> |
||||
{% endfor %} |
||||
{% endif %} |
||||
{% endfor %} |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="product-item-overlay__field"> |
||||
<p class="product-item-overlay-field__title">Количество</p> |
||||
|
||||
<div class="counter"> |
||||
<button class="counter__button minus"> |
||||
<img src="{{ theme.uri }}/woocommerce/assets/img/svg/main/minus.svg" alt=""> |
||||
</button> |
||||
<input type="text" class="counter__input" value="1"> |
||||
<button class="counter__button plus"> |
||||
<img src="{{ theme.uri }}/woocommerce/assets/img/svg/main/plus.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<p class="product-item-overlay__price"> |
||||
{{ wc_product.get_price() }} |
||||
</p> |
||||
<div class="product-item-overlay__block-button"> |
||||
<div class="product-item-overlay__button"> |
||||
{{ function('get_add_to_cart_button', post_id) }} |
||||
</div> |
||||
<div class="product-item-overlay__more_button"> |
||||
<a class="to-know button--100-perc" href="{{ wc_product.get_permalink() }}"> |
||||
<p>{{ function('pll_e', 'Подробнее') }}</p> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="gallery"> |
||||
<button class="gallery__close gallery-button"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
|
||||
<div class="gallery__wrapper"> |
||||
<div class="gallery__pagination"> |
||||
{% for image in gallery_images %} |
||||
<button class="gallery-pagination__item" data-count-img="{{ loop.index0 }}"> |
||||
<img src="{{ image.src }}" alt="{{ image.alt }}"> |
||||
</button> |
||||
{% endfor %} |
||||
</div> |
||||
|
||||
<div class="gallery__slider swiper"> |
||||
<div class="swiper-wrapper"> |
||||
{% for image in gallery_images %} |
||||
<div class="swiper-slide"> |
||||
<div class="gallery__block"> |
||||
<img src="{{ image.src }}" alt="{{ image.alt }}"> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
|
||||
<div class="swiper-pagination"></div> |
||||
|
||||
<div class="swiper-button-prev gallery-button"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-left.svg" alt=""> |
||||
</div> |
||||
<div class="swiper-button-next gallery-button"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-right.svg" alt=""> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
{% set current_path = template_path ~ '/modules/shop/components/single-product' %} |
||||
|
||||
{% set bodyClass = 'bg-white' %} |
||||
|
||||
{% set mainClass = 'wrapper' %} |
||||
|
||||
{% extends 'layout.twig' %} |
||||
|
||||
{% block content %} |
||||
<div class="wrapper"> |
||||
<div class="breadcrumbs"> |
||||
{% if wc_breadcrumbs %} |
||||
{% for crumb in wc_breadcrumbs %} |
||||
<a href="{{ crumb.url }}" class="breadcrumbs__item"> |
||||
{{ crumb.text }} |
||||
</a> |
||||
{% endfor %} |
||||
{% endif %} |
||||
</div> |
||||
|
||||
<a href="{{ fn('get_permalink', fn('wc_get_page_id', 'shop')) }}" class="back back-detail"> |
||||
{{ function('pll_e', 'к каталогу') }} |
||||
</a> |
||||
|
||||
<div class="detail"> |
||||
<div class="detail__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 }}"> |
||||
<img src="{{ image.src }}" alt="{{ image.alt }}" class=""> |
||||
</div> |
||||
{% endfor %} |
||||
<div class="swiper-pagination"></div> |
||||
</div> |
||||
|
||||
<div class="detail__content"> |
||||
<div class="detail__label"> |
||||
{% if product_attributes.Flavor is defined and product_attributes.Flavor|length > 0 %} |
||||
<div class="product-item-label__tag product-item-label__tag--black"> |
||||
{{ product_attributes.Flavor[0].name }} |
||||
</div> |
||||
{% endif %} |
||||
{% if product_attributes.Вкус is defined and product_attributes.Вкус|length > 0 %} |
||||
<div class="product-item-label__tag product-item-label__tag--black"> |
||||
<a href="{{ product_attributes.Вкус[0].link }}">{{ product_attributes.Вкус[0].name }}</a> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if product_attributes.Тег is defined and product_attributes.Тег|length > 0 %} |
||||
<div class="product-item-label__tag product-item-label__tag--title"> |
||||
<a href="{{ product_attributes.Тег[0].link }}">{{ product_attributes.Тег[0].name }}</a> |
||||
</div> |
||||
{% endif %} |
||||
{% if product.is_on_sale() %} |
||||
<div class="product-item-label__tag product-item-label__tag--sale"> |
||||
{{ function('pll_e', 'Распродажа %') }} |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
<h1 class="detail__title"> |
||||
{{ product.get_title }} |
||||
</h1> |
||||
|
||||
<div class="detail__images-phone"> |
||||
<div class="swiper-wrapper"> |
||||
{% for image in gallery_images %} |
||||
<div class="swiper-slide"> |
||||
<div class="detail-images-phone__image-block" data-count-img="{{ loop.index0 }}"> |
||||
<img src="{{ image.src }}" alt="{{ image.alt }}"> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<div class="swiper-pagination"></div> |
||||
</div> |
||||
|
||||
<div class="detail__block-price"> |
||||
<p class="detail-block-price__price"> |
||||
{{ product.get_price }} {{ fn('get_woocommerce_currency_symbol') }} |
||||
</p> |
||||
|
||||
{% if product.is_on_sale() %} |
||||
<div class="detail-block-price__sale"> |
||||
<p class="detail-block-price-sale__text"> |
||||
{{ product.get_regular_price }} {{ fn('get_woocommerce_currency_symbol') }} |
||||
</p> |
||||
<p class="detail-block-price-sale__perc"> |
||||
{{ ((product.get_regular_price - product.get_price) / product.get_regular_price * 100)|round }} |
||||
</p> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
<form action="" class="detail-block__form" data-product-id="{{ product.id }}"> |
||||
{% set collection = fn('wc_get_product_terms', product.id, 'pa_collection') %} |
||||
{% if collection %} |
||||
{% set siblings = function('get_collection_siblings', collection[0].term_id) %} |
||||
{% if siblings %} |
||||
<div class="detail-block-form__item detail-block-form__item--radio radio-button"> |
||||
{% for sibling in siblings %} |
||||
{% set weight = sibling.post_title|split(', ')|last %} |
||||
{% set current_weight = function('get_product_info', product.id, 'weight') %} |
||||
{% 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') }}"> |
||||
{{ weight|upper }} |
||||
</a> |
||||
{% endfor %} |
||||
<input type="text" class="radio-button__input" value="{{ current_weight|upper }}" readonly> |
||||
</div> |
||||
{% endif %} |
||||
{% endif %} |
||||
|
||||
|
||||
</form> |
||||
{{ function('do_action', 'woocommerce_' ~ product.get_type() ~ '_add_to_cart') }} |
||||
<div class="detail__toggle"> |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'ОПИСАНИЕ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
<p class="toggle__text"> |
||||
{{ product.get_description() }} |
||||
</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
{% if product_meta.composition %} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'СОСТАВ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
<p class="toggle__text"> |
||||
{{ product_meta.composition }} |
||||
</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if product_meta.feeding_recommendations_table %} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'РЕКОМЕНДАЦИИ ПО КОРМЛЕНИЮ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
<div class="toggle__table toggle__table--three"> |
||||
{% if product_meta.feeding_recommendations_table.header %} |
||||
<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> |
||||
{% for row in product_meta.feeding_recommendations_table.body %} |
||||
<div class="toggle-table__item"> |
||||
<p>{{ row.0 is iterable ? row.0|join(', ') : row.0 }}</p> |
||||
<div class="toggle-table-item__line"></div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<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> |
||||
{% for row in product_meta.feeding_recommendations_table.body %} |
||||
<div class="toggle-table__item"> |
||||
<p>{{ row.1 is iterable ? row.1|join(', ') : row.1 }}</p> |
||||
<div class="toggle-table-item__line"></div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<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> |
||||
{% for row in product_meta.feeding_recommendations_table.body %} |
||||
<div class="toggle-table__item"> |
||||
<p>{{ row.2 is iterable ? row.2|join(', ') : row.2 }}</p> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% elseif product_meta.feeding_recommendations %} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'РЕКОМЕНДАЦИИ ПО КОРМЛЕНИЮ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
{{ product_meta.feeding_recommendations }} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if product_meta.nutritional_value or product_meta.vitamins or product_meta.additives or product_meta.energy_value %} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'ПИЩЕВАЯ ЦЕННОСТЬ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
{% if product_meta.nutritional_value and product_meta.vitamins %} |
||||
<div class="toggle__table toggle__table--two"> |
||||
<div class="toggle-table__block "> |
||||
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ПИЩЕВАЯ ЦЕННОСТЬ') }}</p> |
||||
{{ product_meta.nutritional_value }} |
||||
</div> |
||||
<div class="toggle-table__block "> |
||||
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ВИТАМИНЫ НА КГ') }}</p> |
||||
{{ product_meta.vitamins }} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if product_meta.additives or product_meta.energy_value %} |
||||
<div class="toggle__table toggle__table--two"> |
||||
{% if product_meta.additives %} |
||||
<div class="toggle-table__block "> |
||||
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ПИТАТЕЛЬНЫЕ ДОБАВКИ НА КГ') }}</p> |
||||
{{ product_meta.additives }} |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if product_meta.energy_value %} |
||||
<div class="toggle-table__block "> |
||||
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ЭНЕРГЕТИЧЕСКАЯ ЦЕННОСТЬ НА 100 ГРАММ') }}</p> |
||||
<div class="toggle-table__item"> |
||||
<div class="detail__warning warning"> |
||||
<div class="detail-warning__content"> |
||||
<p class="detail-warning__title">{{ product_meta.energy_value }}</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
|
||||
</div> |
||||
|
||||
|
||||
<div class="detail__warning"> |
||||
<div class="detail-warning__content"> |
||||
<p class="detail-warning__title">{{ function('pll_e', 'Важно') }}</p> |
||||
<p class="detail-warning__text"> |
||||
{{ product_meta.important }} |
||||
</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="product__main"> |
||||
{% 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) %} |
||||
{% if related_products %} |
||||
<div class="detail__wrapper-catalot"> |
||||
<div class="detail__catalot"> |
||||
<div class="detail-catalot__header"> |
||||
<p class="detail-catalot__title"> |
||||
{{ function('pll_e', 'вашему питомцу может понравиться') }} |
||||
</p> |
||||
|
||||
<div class="detail-catalot__control"> |
||||
<button class="detail-catalot-control__button prev"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-left.svg" alt=""> |
||||
</button> |
||||
|
||||
<button class="detail-catalot-control__button next"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-right.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
<div class="detail-catalot__content swiper-wrapper"> |
||||
{% for related_product in related_products %} |
||||
<div class="swiper-slide"> |
||||
{% set post_id = related_product.ID is defined ? related_product.ID : related_product %} |
||||
{% set wc_product = fn('wc_get_product', post_id) %} |
||||
{% if wc_product %} |
||||
<div class="product__item"> |
||||
<div class="product-item__label"> |
||||
{% 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"> |
||||
{{ function('pll_e', 'Новинка') }} |
||||
</span> |
||||
{% endif %} |
||||
|
||||
{% if wc_product.is_on_sale() %} |
||||
<span href="#" class="product-item-label__tag product-item-label__tag--sale"> |
||||
{{ function('pll_e', 'Распродажа %') }} |
||||
</span> |
||||
{% endif %} |
||||
</div> |
||||
<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"> |
||||
</a> |
||||
<div class="product-item__content-card"> |
||||
<div class="compound"> |
||||
{% set compound = fn('wc_get_product_terms', post_id, 'pa_compound') %} |
||||
{% for option in compound %} |
||||
{% set term = get_term(option) %} |
||||
<a href="/compound/{{ term.slug }}" class="compound__item">{{ term.name }}</a> |
||||
{% endfor %} |
||||
</div> |
||||
<a href="{{ wc_product.get_permalink() }}" class="product-item__title">{{ wc_product.get_name() }}</a> |
||||
<div class="product-item__price"> |
||||
<p>{{ wc_product.get_price() }} {{ fn('get_woocommerce_currency_symbol') }}</p> |
||||
</div> |
||||
<div class="product-item__bye"> |
||||
<button class="button button--white button--100-perc open-overlay"> |
||||
{{ function('pll_e', 'Купить') }} |
||||
</button> |
||||
</div> |
||||
</div> |
||||
<div class="product-item__overlay"> |
||||
<div class="product-item-overlay__header"> |
||||
<a href="{{ wc_product.get_permalink() }}" class="product-item__title">{{ wc_product.get_name() }}</a> |
||||
<ul class="product-item-overlay__tags"> |
||||
{% set features = fn('wc_get_product_terms', post_id, 'pa_features') %} |
||||
{% for option in features %} |
||||
{% set term = get_term(option) %} |
||||
<li>{{ term.name }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
</div> |
||||
|
||||
<form class="product-item__form" method="post" action="/send-telegram.php"> |
||||
<div class="product-item-overlay__input-block"> |
||||
<div class="product-item-overlay__field"> |
||||
<p class="product-item-overlay-field__title">Объем</p> |
||||
|
||||
<div class="select"> |
||||
{% 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() }}"> |
||||
<div class="state__block"> |
||||
<ul class="state__content"> |
||||
{% set collection = fn('wc_get_product_terms', post_id, 'pa_collection') %} |
||||
{% for option in collection %} |
||||
{% set term = get_term(option) %} |
||||
{% if term %} |
||||
{% set siblings = function('get_collection_siblings', term.term_id) %} |
||||
|
||||
{% for sibling in siblings %} |
||||
{% set weight = function('get_product_info', sibling.ID, 'weight') %} |
||||
|
||||
{% set class = '' %} |
||||
{% if weight == cur_weight %} |
||||
{% set class = 'active' %} |
||||
{% endif %} |
||||
<li> |
||||
<button class="state__button {{ class }}" data-product_id="{{ sibling.ID }}" data-product_price="{{ function('get_product_info', sibling.ID, 'price') }}"> |
||||
{{ weight }} |
||||
</button> |
||||
</li> |
||||
{% endfor %} |
||||
{% endif %} |
||||
{% endfor %} |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="product-item-overlay__field"> |
||||
<p class="product-item-overlay-field__title">Количество</p> |
||||
|
||||
<div class="counter"> |
||||
<button class="counter__button minus"> |
||||
<img src="{{ theme.uri }}/woocommerce/assets/img/svg/main/minus.svg" alt=""> |
||||
</button> |
||||
<input type="text" class="counter__input" value="1"> |
||||
<button class="counter__button plus"> |
||||
<img src="{{ theme.uri }}/woocommerce/assets/img/svg/main/plus.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<p class="product-item-overlay__price"> |
||||
{{ wc_product.get_price() }} |
||||
</p> |
||||
<div class="product-item-overlay__block-button"> |
||||
<div class="product-item-overlay__button"> |
||||
{{ function('get_add_to_cart_button', post_id) }} |
||||
</div> |
||||
<div class="product-item-overlay__more_button"> |
||||
<a class="to-know button--100-perc" href="{{ wc_product.get_permalink() }}"> |
||||
<p>{{ function('pll_e', 'Подробнее') }}</p> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="gallery"> |
||||
<button class="gallery__close gallery-button"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
|
||||
<div class="gallery__wrapper"> |
||||
<div class="gallery__pagination"> |
||||
{% for image in gallery_images %} |
||||
<button class="gallery-pagination__item" data-count-img="{{ loop.index0 }}"> |
||||
<img src="{{ image.src }}" alt="{{ image.alt }}"> |
||||
</button> |
||||
{% endfor %} |
||||
</div> |
||||
|
||||
<div class="gallery__slider swiper"> |
||||
<div class="swiper-wrapper"> |
||||
{% for image in gallery_images %} |
||||
<div class="swiper-slide"> |
||||
<div class="gallery__block"> |
||||
<img src="{{ image.src }}" alt="{{ image.alt }}"> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
|
||||
<div class="swiper-pagination"></div> |
||||
|
||||
<div class="swiper-button-prev gallery-button"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-left.svg" alt=""> |
||||
</div> |
||||
<div class="swiper-button-next gallery-button"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-right.svg" alt=""> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
{% endblock %} |
@ -1,142 +1,142 @@ |
||||
<?php |
||||
|
||||
add_action( 'wp_ajax_apply_coupon', 'custom_apply_coupon' ); |
||||
add_action( 'wp_ajax_nopriv_apply_coupon', 'custom_apply_coupon' ); |
||||
|
||||
function custom_apply_coupon() { |
||||
$coupon_code = isset( $_POST['coupon_code'] ) ? sanitize_text_field( $_POST['coupon_code'] ) : ''; |
||||
|
||||
if ( empty( $coupon_code ) ) { |
||||
wp_send_json_error( array( 'message' => 'Код купона не указан.' ) ); |
||||
} |
||||
|
||||
// Применение купона |
||||
$applied = WC()->cart->apply_coupon( $coupon_code ); |
||||
|
||||
if ( $applied ) { |
||||
wp_send_json_success(); |
||||
} else { |
||||
wp_send_json_error( array( 'message' => 'Купон не применён. Проверьте код.' ) ); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Обработчик AJAX для обновления количества товара в корзине |
||||
*/ |
||||
add_action('wp_ajax_update_cart_quantity', 'update_cart_quantity_handler'); |
||||
add_action('wp_ajax_nopriv_update_cart_quantity', 'update_cart_quantity_handler'); |
||||
|
||||
function update_cart_quantity_handler() { |
||||
if (!isset($_POST['cart_item_key']) || !isset($_POST['quantity'])) { |
||||
wp_send_json_error('Недостаточно данных'); |
||||
return; |
||||
} |
||||
|
||||
$cart_item_key = sanitize_text_field($_POST['cart_item_key']); |
||||
$quantity = intval($_POST['quantity']); |
||||
|
||||
if ($quantity <= 0) { |
||||
wp_send_json_error('Некорректное количество'); |
||||
return; |
||||
} |
||||
|
||||
$cart = WC()->cart; |
||||
$cart_item = $cart->get_cart_item($cart_item_key); |
||||
|
||||
if (!$cart_item) { |
||||
wp_send_json_error('Товар не найден в корзине'); |
||||
return; |
||||
} |
||||
|
||||
$updated = $cart->set_quantity($cart_item_key, $quantity); |
||||
|
||||
if ($updated) { |
||||
wp_send_json_success(); |
||||
} else { |
||||
wp_send_json_error('Не удалось обновить количество'); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Обработчик AJAX для восстановления товара в корзине |
||||
*/ |
||||
add_action('wp_ajax_restore_cart_item', 'restore_cart_item_handler'); |
||||
add_action('wp_ajax_nopriv_restore_cart_item', 'restore_cart_item_handler'); |
||||
|
||||
function restore_cart_item_handler() { |
||||
if (!isset($_POST['product_id']) || !isset($_POST['quantity'])) { |
||||
wp_send_json_error('Недостаточно данных'); |
||||
return; |
||||
} |
||||
|
||||
$product_id = intval($_POST['product_id']); |
||||
$variation_id = isset($_POST['variation_id']) ? intval($_POST['variation_id']) : 0; |
||||
$quantity = intval($_POST['quantity']); |
||||
|
||||
if ($quantity <= 0) { |
||||
wp_send_json_error('Некорректное количество'); |
||||
return; |
||||
} |
||||
|
||||
$cart = WC()->cart; |
||||
$cart_item_key = $cart->add_to_cart($product_id, $quantity, $variation_id); |
||||
|
||||
if ($cart_item_key) { |
||||
wp_send_json_success(); |
||||
} else { |
||||
wp_send_json_error('Не удалось восстановить товар'); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Обработчик AJAX для получения фрагментов корзины |
||||
*/ |
||||
add_action('wp_ajax_get_cart_fragment', 'get_cart_fragment_handler'); |
||||
add_action('wp_ajax_nopriv_get_cart_fragment', 'get_cart_fragment_handler'); |
||||
|
||||
function get_cart_fragment_handler() { |
||||
ob_start(); |
||||
Timber::render('shop/cart-contents.twig', Timber::context()); |
||||
$contents = ob_get_clean(); |
||||
|
||||
$response = array( |
||||
'contents' => $contents, |
||||
'total' => WC()->cart->get_cart_total(), |
||||
'count' => WC()->cart->get_cart_contents_count() |
||||
); |
||||
|
||||
wp_send_json_success($response); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Инициализация WooCommerce AJAX |
||||
*/ |
||||
add_action('wp_enqueue_scripts', 'enqueue_woocommerce_ajax_scripts'); |
||||
function enqueue_woocommerce_ajax_scripts() { |
||||
wp_localize_script('jquery', 'woocommerce_params', array( |
||||
'ajax_url' => admin_url('admin-ajax.php'), |
||||
'currency_symbol' => get_woocommerce_currency_symbol(), |
||||
'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_nopriv_remove_cart_item', 'handle_remove_cart_item'); |
||||
|
||||
function handle_remove_cart_item() { |
||||
if (!isset($_POST['cart_item_key'])) { |
||||
wp_send_json_error('Не указан ключ элемента корзины'); |
||||
return; |
||||
} |
||||
|
||||
$cart_item_key = sanitize_text_field($_POST['cart_item_key']); |
||||
$cart = WC()->cart; |
||||
|
||||
if ($cart->remove_cart_item($cart_item_key)) { |
||||
wp_send_json_success(); |
||||
} else { |
||||
wp_send_json_error('Не удалось удалить товар из корзины'); |
||||
} |
||||
<?php |
||||
|
||||
add_action( 'wp_ajax_apply_coupon', 'custom_apply_coupon' ); |
||||
add_action( 'wp_ajax_nopriv_apply_coupon', 'custom_apply_coupon' ); |
||||
|
||||
function custom_apply_coupon() { |
||||
$coupon_code = isset( $_POST['coupon_code'] ) ? sanitize_text_field( $_POST['coupon_code'] ) : ''; |
||||
|
||||
if ( empty( $coupon_code ) ) { |
||||
wp_send_json_error( array( 'message' => 'Код купона не указан.' ) ); |
||||
} |
||||
|
||||
// Применение купона |
||||
$applied = WC()->cart->apply_coupon( $coupon_code ); |
||||
|
||||
if ( $applied ) { |
||||
wp_send_json_success(); |
||||
} else { |
||||
wp_send_json_error( array( 'message' => 'Купон не применён. Проверьте код.' ) ); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Обработчик AJAX для обновления количества товара в корзине |
||||
*/ |
||||
add_action('wp_ajax_update_cart_quantity', 'update_cart_quantity_handler'); |
||||
add_action('wp_ajax_nopriv_update_cart_quantity', 'update_cart_quantity_handler'); |
||||
|
||||
function update_cart_quantity_handler() { |
||||
if (!isset($_POST['cart_item_key']) || !isset($_POST['quantity'])) { |
||||
wp_send_json_error('Недостаточно данных'); |
||||
return; |
||||
} |
||||
|
||||
$cart_item_key = sanitize_text_field($_POST['cart_item_key']); |
||||
$quantity = intval($_POST['quantity']); |
||||
|
||||
if ($quantity <= 0) { |
||||
wp_send_json_error('Некорректное количество'); |
||||
return; |
||||
} |
||||
|
||||
$cart = WC()->cart; |
||||
$cart_item = $cart->get_cart_item($cart_item_key); |
||||
|
||||
if (!$cart_item) { |
||||
wp_send_json_error('Товар не найден в корзине'); |
||||
return; |
||||
} |
||||
|
||||
$updated = $cart->set_quantity($cart_item_key, $quantity); |
||||
|
||||
if ($updated) { |
||||
wp_send_json_success(); |
||||
} else { |
||||
wp_send_json_error('Не удалось обновить количество'); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Обработчик AJAX для восстановления товара в корзине |
||||
*/ |
||||
add_action('wp_ajax_restore_cart_item', 'restore_cart_item_handler'); |
||||
add_action('wp_ajax_nopriv_restore_cart_item', 'restore_cart_item_handler'); |
||||
|
||||
function restore_cart_item_handler() { |
||||
if (!isset($_POST['product_id']) || !isset($_POST['quantity'])) { |
||||
wp_send_json_error('Недостаточно данных'); |
||||
return; |
||||
} |
||||
|
||||
$product_id = intval($_POST['product_id']); |
||||
$variation_id = isset($_POST['variation_id']) ? intval($_POST['variation_id']) : 0; |
||||
$quantity = intval($_POST['quantity']); |
||||
|
||||
if ($quantity <= 0) { |
||||
wp_send_json_error('Некорректное количество'); |
||||
return; |
||||
} |
||||
|
||||
$cart = WC()->cart; |
||||
$cart_item_key = $cart->add_to_cart($product_id, $quantity, $variation_id); |
||||
|
||||
if ($cart_item_key) { |
||||
wp_send_json_success(); |
||||
} else { |
||||
wp_send_json_error('Не удалось восстановить товар'); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Обработчик AJAX для получения фрагментов корзины |
||||
*/ |
||||
add_action('wp_ajax_get_cart_fragment', 'get_cart_fragment_handler'); |
||||
add_action('wp_ajax_nopriv_get_cart_fragment', 'get_cart_fragment_handler'); |
||||
|
||||
function get_cart_fragment_handler() { |
||||
ob_start(); |
||||
Timber::render('shop/cart-contents.twig', Timber::context()); |
||||
$contents = ob_get_clean(); |
||||
|
||||
$response = array( |
||||
'contents' => $contents, |
||||
'total' => WC()->cart->get_cart_total(), |
||||
'count' => WC()->cart->get_cart_contents_count() |
||||
); |
||||
|
||||
wp_send_json_success($response); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Инициализация WooCommerce AJAX |
||||
*/ |
||||
add_action('wp_enqueue_scripts', 'enqueue_woocommerce_ajax_scripts'); |
||||
function enqueue_woocommerce_ajax_scripts() { |
||||
wp_localize_script('jquery', 'woocommerce_params', array( |
||||
'ajax_url' => admin_url('admin-ajax.php'), |
||||
'currency_symbol' => get_woocommerce_currency_symbol(), |
||||
'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_nopriv_remove_cart_item', 'handle_remove_cart_item'); |
||||
|
||||
function handle_remove_cart_item() { |
||||
if (!isset($_POST['cart_item_key'])) { |
||||
wp_send_json_error('Не указан ключ элемента корзины'); |
||||
return; |
||||
} |
||||
|
||||
$cart_item_key = sanitize_text_field($_POST['cart_item_key']); |
||||
$cart = WC()->cart; |
||||
|
||||
if ($cart->remove_cart_item($cart_item_key)) { |
||||
wp_send_json_success(); |
||||
} else { |
||||
wp_send_json_error('Не удалось удалить товар из корзины'); |
||||
} |
||||
} |
@ -1,387 +1,387 @@ |
||||
<?php |
||||
|
||||
add_filter( 'woocommerce_cart_needs_shipping_address', '__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_state', '__return_false' ); |
||||
add_filter( 'woocommerce_shipping_packages', 'display_all_shipping_methods' ); |
||||
|
||||
function display_all_shipping_methods( $packages ) { |
||||
foreach ( $packages as &$package ) { |
||||
// Убираем ограничения по адресу |
||||
$package['destination']['country'] = ''; |
||||
$package['destination']['state'] = ''; |
||||
$package['destination']['postcode'] = ''; |
||||
$package['destination']['city'] = ''; |
||||
} |
||||
return $packages; |
||||
} |
||||
|
||||
add_filter( 'woocommerce_checkout_fields', 'customize_billing_fields' ); |
||||
|
||||
function customize_billing_fields( $fields ) { |
||||
// Удаляем все стандартные поля |
||||
unset( $fields['billing']['billing_company'] ); |
||||
unset( $fields['billing']['billing_country'] ); |
||||
unset( $fields['billing']['billing_address_1'] ); |
||||
unset( $fields['billing']['billing_address_2'] ); |
||||
unset( $fields['billing']['billing_city'] ); |
||||
unset( $fields['billing']['billing_state'] ); |
||||
unset( $fields['billing']['billing_postcode'] ); |
||||
// Перенастраиваем только нужные поля |
||||
$fields['billing']['billing_first_name'] = array( |
||||
'type' => 'text', |
||||
'label' => __('Имя', 'woocommerce'), |
||||
'placeholder' => __('Ваше имя', 'woocommerce'), |
||||
'required' => true, |
||||
'class' => array('form-row-wide'), |
||||
'priority' => 10, |
||||
); |
||||
$fields['billing']['billing_last_name'] = array( |
||||
'type' => 'text', |
||||
'label' => __('Фамилия', 'woocommerce'), |
||||
'placeholder' => __('Ваша фамилия', 'woocommerce'), |
||||
'required' => true, |
||||
'class' => array('form-row-wide'), |
||||
'priority' => 10, |
||||
); |
||||
$fields['billing']['billing_email'] = array( |
||||
'type' => 'email', |
||||
'label' => __('E-mail', 'woocommerce'), |
||||
'placeholder' => __('Начните вводить ваш email', 'woocommerce'), |
||||
'required' => true, |
||||
'class' => array('form-row-wide'), |
||||
'priority' => 20, |
||||
); |
||||
$fields['billing']['billing_phone'] = array( |
||||
'type' => 'tel', |
||||
'label' => __('Телефон', 'woocommerce'), |
||||
'placeholder' => __('+7 ___ ___ ____', 'woocommerce'), |
||||
'required' => true, |
||||
'class' => array('form-row-wide'), |
||||
'priority' => 30, |
||||
); |
||||
$fields['billing']['billing_city'] = array( |
||||
'type' => 'text', |
||||
'label' => __('Населенный пункт', 'woocommerce'), |
||||
'placeholder' => __('Ваш город', 'woocommerce'), |
||||
'required' => true, |
||||
'class' => array('form-row-wide'), |
||||
'priority' => 40, |
||||
); |
||||
|
||||
$fields['billing']['billing_address_1'] = array( |
||||
'type' => 'text', |
||||
'label' => __('Адрес', 'woocommerce'), |
||||
'placeholder' => __('Адрес', 'woocommerce'), |
||||
'required' => false, |
||||
'class' => array('visually-hidden'), |
||||
'priority' => 40, |
||||
); |
||||
$fields['billing']['billing_address_2'] = array( |
||||
'type' => 'text', |
||||
'label' => __('Адрес 2', 'woocommerce'), |
||||
'placeholder' => __('Адрес 2', 'woocommerce'), |
||||
'required' => false, |
||||
'class' => array('visually-hidden'), |
||||
'priority' => 40, |
||||
); |
||||
|
||||
return $fields; |
||||
} |
||||
// remove_action( 'woocommerce_review_order_before_payment', 'woocommerce_review_order_shipping' ); |
||||
|
||||
add_action( 'init', function() { |
||||
update_option( 'woocommerce_enable_coupons', 'yes' ); // Включение купонов |
||||
} ); |
||||
|
||||
add_filter( 'woocommerce_available_payment_gateways', 'set_default_payment_gateway' ); |
||||
|
||||
function set_default_payment_gateway( $available_gateways ) { |
||||
if ( is_cart() || is_checkout() ) { |
||||
// Устанавливаем способ оплаты по умолчанию |
||||
$default_payment_gateway = 'tbank'; // ID способа оплаты, например 'cod' для "наличными при доставке" |
||||
|
||||
// Проверяем, доступен ли этот способ оплаты |
||||
if ( isset( $available_gateways[ $default_payment_gateway ] ) ) { |
||||
foreach ( $available_gateways as $gateway_id => $gateway ) { |
||||
// Оставляем только выбранный способ оплаты |
||||
if ( $gateway_id !== $default_payment_gateway ) { |
||||
unset( $available_gateways[ $gateway_id ] ); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
return $available_gateways; |
||||
} |
||||
|
||||
add_filter( 'woocommerce_checkout_terms_and_conditions_checkbox_enabled', '__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_terms_and_conditions', 'wc_terms_and_conditions_page_content', 30 ); |
||||
remove_action( 'woocommerce_checkout_after_terms_and_conditions', 'wc_privacy_policy_text', 20 ); |
||||
|
||||
add_action( 'woocommerce_checkout_process', 'remove_terms_validation' ); |
||||
|
||||
function remove_terms_validation() { |
||||
remove_action( 'woocommerce_checkout_process', 'woocommerce_checkout_terms_and_conditions' ); |
||||
} |
||||
|
||||
add_filter( 'woocommerce_order_button_html', 'custom_checkout_button_classes' ); |
||||
|
||||
function custom_checkout_button_classes( $button ) { |
||||
// Заменяем стандартные классы |
||||
$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> |
||||
</div>'; |
||||
return $button; |
||||
|
||||
|
||||
|
||||
} |
||||
|
||||
add_filter( 'woocommerce_checkout_fields', 'customize_checkout_registration_fields' ); |
||||
|
||||
function customize_checkout_registration_fields( $fields ) { |
||||
// Убираем поле ввода пароля |
||||
unset( $fields['account']['account_password'] ); |
||||
|
||||
return $fields; |
||||
} |
||||
|
||||
// Автоматическая генерация пароля |
||||
add_filter( 'woocommerce_checkout_posted_data', 'generate_password_for_registration' ); |
||||
|
||||
function generate_password_for_registration( $data ) { |
||||
|
||||
|
||||
$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_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_city = isset( $_POST['billing_city'] ) ? sanitize_text_field( $_POST['billing_city'] ) : ''; |
||||
$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_state = isset( $_POST['billing_state'] ) ? sanitize_text_field( $_POST['billing_state'] ) : ''; |
||||
$billing_phone = isset( $_POST['billing_phone'] ) ? sanitize_text_field( $_POST['billing_phone'] ) : ''; |
||||
$billing_email = isset( $_POST['billing_email'] ) ? sanitize_email( $_POST['billing_email'] ) : ''; |
||||
|
||||
|
||||
$data['shipping_first_name'] = $data['billing_first_name']; |
||||
$data['shipping_last_name'] = $data['billing_last_name']; |
||||
$data['shipping_address_1'] = $data['billing_address_1'] . $data['billing_address_2']; |
||||
$data['shipping_city'] = $data['billing_city']; |
||||
$data['shipping_postcode'] = $data['billing_postcode']; |
||||
$data['shipping_country'] = $data['billing_country']; |
||||
$data['shipping_state'] = $data['billing_state']; |
||||
|
||||
|
||||
|
||||
return $data; |
||||
} |
||||
|
||||
|
||||
function handle_user_registration_on_checkout() { |
||||
// Получаем данные из POST-запроса |
||||
if ( isset( $_POST['billing_email'] ) && isset( $_POST['reg'] )) { |
||||
if ($_POST['reg'] == '1'){ |
||||
|
||||
|
||||
$email = sanitize_email( $_POST['billing_email'] ); |
||||
$pass = sanitize_text_field( $_POST['pass'] ); |
||||
|
||||
// Регистрация пользователя |
||||
$user_id = custom_register_user_from_post( $email, $pass ); |
||||
|
||||
if ( is_wp_error( $user_id ) ) { |
||||
// Если email уже существует, выводим ошибку |
||||
wc_add_notice( $user_id->get_error_message(), 'error' ); |
||||
} else { |
||||
|
||||
wp_set_current_user( $user_id ); // Устанавливаем текущего пользователя |
||||
wp_set_auth_cookie( $user_id ); // Устанавливаем куки для авторизации |
||||
do_action( 'wp_login', $email, $user ); // Событие входа в систему |
||||
|
||||
}} |
||||
|
||||
} |
||||
} |
||||
add_action( 'woocommerce_checkout_process', 'handle_user_registration_on_checkout' ); |
||||
|
||||
|
||||
function custom_register_user_from_post( $email, $pass ) { |
||||
// Проверяем, есть ли уже пользователь с таким email |
||||
if ( email_exists( $email ) ) { |
||||
return new WP_Error( 'email_exists', 'Этот email уже зарегистрирован.' ); |
||||
} |
||||
|
||||
// Создаем пользователя в WordPress |
||||
$user_id = wp_create_user( $email, $pass, $email ); |
||||
if ( is_wp_error( $user_id ) ) { |
||||
return $user_id; // Возвращаем ошибку, если не удалось создать пользователя |
||||
} |
||||
|
||||
update_user_meta( $user_id, 'billing_email', $email ); // Устанавливаем email |
||||
update_user_meta( $user_id, 'user_email', $email ); // Устанавливаем email для входа |
||||
|
||||
// Устанавливаем роль пользователя как 'customer' для WooCommerce |
||||
$user = new WP_User( $user_id ); |
||||
$user->set_role( 'customer' ); |
||||
return $user_id; |
||||
} |
||||
|
||||
|
||||
add_filter( 'woocommerce_form_field', 'add_error_containers_to_checkout_fields', 10, 4 ); |
||||
|
||||
function add_error_containers_to_checkout_fields( $field, $key, $args, $value ) { |
||||
if ( is_checkout() ) { |
||||
// Добавляем контейнер для ошибок под полем |
||||
$error_container = '<div id="' . esc_attr( $key ) . '-error" class="form-input__error"></div>'; |
||||
$field .= $error_container; |
||||
} |
||||
return $field; |
||||
} |
||||
|
||||
add_filter( 'woocommerce_add_error', 'remove_payments_word_from_errors_multilang' ); |
||||
|
||||
function remove_payments_word_from_errors_multilang( $error ) { |
||||
// Слова для удаления в разных языках |
||||
$translations = array( |
||||
'Платежи', // Русский |
||||
'Billing', // Английский |
||||
); |
||||
|
||||
foreach ( $translations as $word ) { |
||||
$error = str_replace( $word, '', $error ); |
||||
} |
||||
|
||||
return trim( $error ); |
||||
} |
||||
|
||||
|
||||
add_action( 'woocommerce_checkout_process', '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'] ) : ''; |
||||
|
||||
// Проверяем формат телефона |
||||
if ( ! preg_match( '/^\+?[0-9\s\-\(\)]+$/', $phone ) ) { |
||||
wc_add_notice( 'phone_err', 'error', 'billing_phone' ); |
||||
} |
||||
} |
||||
|
||||
add_action( 'woocommerce_checkout_process', 'make_address_required_for_specific_shipping' ); |
||||
|
||||
function make_address_required_for_specific_shipping() { |
||||
// Получаем выбранный метод доставки |
||||
$chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods' ); |
||||
$chosen_shipping = isset( $chosen_shipping_methods[0] ) ? $chosen_shipping_methods[0] : ''; |
||||
|
||||
// Проверяем, выбран ли метод доставки "official_cdek:137" |
||||
if ( $chosen_shipping === 'official_cdek:137' ) { |
||||
// Проверяем, заполнен ли адрес |
||||
if ( empty( $_POST['billing_address_1'] ) ) { |
||||
wc_add_notice('adress_error', 'error' ); |
||||
} |
||||
} |
||||
} |
||||
|
||||
function auto_fill_shipping_fields_from_billing( $order_id ) { |
||||
// Получаем объект заказа |
||||
$order = wc_get_order( $order_id ); |
||||
|
||||
if ( ! $order ) { |
||||
return; // Если заказ недоступен, выходим |
||||
} |
||||
|
||||
// Получаем значения полей billing из глобального $_POST |
||||
$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_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_city = isset( $_POST['billing_city'] ) ? sanitize_text_field( $_POST['billing_city'] ) : ''; |
||||
$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_state = isset( $_POST['billing_state'] ) ? sanitize_text_field( $_POST['billing_state'] ) : ''; |
||||
$billing_phone = isset( $_POST['billing_phone'] ) ? sanitize_text_field( $_POST['billing_phone'] ) : ''; |
||||
$billing_email = isset( $_POST['billing_email'] ) ? sanitize_email( $_POST['billing_email'] ) : ''; |
||||
|
||||
// Копируем данные в поля доставки |
||||
$order->set_shipping_first_name( $billing_first_name ); |
||||
$order->set_shipping_last_name( $billing_last_name ); |
||||
$order->set_shipping_address_1( $billing_address_1 ); |
||||
$order->set_shipping_address_2( $billing_address_2 ); |
||||
$order->set_shipping_city( $billing_city ); |
||||
$order->set_shipping_postcode( $billing_postcode ); |
||||
$order->set_shipping_country( $billing_country ); |
||||
$order->set_shipping_state( $billing_state ); |
||||
|
||||
// Сохраняем изменения в заказе |
||||
$order->save(); |
||||
} |
||||
|
||||
add_filter('timber/context', function($context) { |
||||
if (function_exists('is_product') && is_product()) { |
||||
$product_id = get_the_ID(); |
||||
$product = wc_get_product($product_id); |
||||
|
||||
if ($product) { |
||||
$context['product'] = $product; |
||||
$context['product_id'] = $product_id; |
||||
|
||||
|
||||
$terms = get_the_terms($product_id, 'product_cat'); |
||||
if ($terms && !is_wp_error($terms)) { |
||||
$context['product_categories'] = $terms; |
||||
} |
||||
|
||||
|
||||
$attachment_ids = $product->get_gallery_image_ids(); |
||||
$gallery_images = []; |
||||
|
||||
$main_image_id = $product->get_image_id(); |
||||
if ($main_image_id) { |
||||
$gallery_images[] = [ |
||||
'id' => $main_image_id, |
||||
'src' => wp_get_attachment_image_url($main_image_id, 'full'), |
||||
'alt' => get_post_meta($main_image_id, '_wp_attachment_image_alt', true) |
||||
]; |
||||
} |
||||
|
||||
foreach ($attachment_ids as $attachment_id) { |
||||
$gallery_images[] = [ |
||||
'id' => $attachment_id, |
||||
'src' => wp_get_attachment_image_url($attachment_id, 'full'), |
||||
'alt' => get_post_meta($attachment_id, '_wp_attachment_image_alt', true) |
||||
]; |
||||
} |
||||
|
||||
$context['gallery_images'] = $gallery_images; |
||||
|
||||
$related_products_ids = wc_get_related_products($product_id, 5); |
||||
if (!empty($related_products_ids)) { |
||||
$related_products = []; |
||||
foreach ($related_products_ids as $related_id) { |
||||
$related_product = wc_get_product($related_id); |
||||
if ($related_product) { |
||||
$related_products[] = $related_product; |
||||
} |
||||
} |
||||
$context['related_products'] = $related_products; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return $context; |
||||
}); |
||||
|
||||
function conditional_dequeue_woocommerce_styles() { |
||||
if (function_exists('is_woocommerce') && !is_woocommerce() && !is_cart() && !is_checkout() && !is_account_page()) { |
||||
wp_dequeue_style('woocommerce-general'); |
||||
wp_dequeue_style('woocommerce-layout'); |
||||
wp_dequeue_style('woocommerce-smallscreen'); |
||||
} |
||||
} |
||||
<?php |
||||
|
||||
add_filter( 'woocommerce_cart_needs_shipping_address', '__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_state', '__return_false' ); |
||||
add_filter( 'woocommerce_shipping_packages', 'display_all_shipping_methods' ); |
||||
|
||||
function display_all_shipping_methods( $packages ) { |
||||
foreach ( $packages as &$package ) { |
||||
// Убираем ограничения по адресу |
||||
$package['destination']['country'] = ''; |
||||
$package['destination']['state'] = ''; |
||||
$package['destination']['postcode'] = ''; |
||||
$package['destination']['city'] = ''; |
||||
} |
||||
return $packages; |
||||
} |
||||
|
||||
add_filter( 'woocommerce_checkout_fields', 'customize_billing_fields' ); |
||||
|
||||
function customize_billing_fields( $fields ) { |
||||
// Удаляем все стандартные поля |
||||
unset( $fields['billing']['billing_company'] ); |
||||
unset( $fields['billing']['billing_country'] ); |
||||
unset( $fields['billing']['billing_address_1'] ); |
||||
unset( $fields['billing']['billing_address_2'] ); |
||||
unset( $fields['billing']['billing_city'] ); |
||||
unset( $fields['billing']['billing_state'] ); |
||||
unset( $fields['billing']['billing_postcode'] ); |
||||
// Перенастраиваем только нужные поля |
||||
$fields['billing']['billing_first_name'] = array( |
||||
'type' => 'text', |
||||
'label' => __('Имя', 'woocommerce'), |
||||
'placeholder' => __('Ваше имя', 'woocommerce'), |
||||
'required' => true, |
||||
'class' => array('form-row-wide'), |
||||
'priority' => 10, |
||||
); |
||||
$fields['billing']['billing_last_name'] = array( |
||||
'type' => 'text', |
||||
'label' => __('Фамилия', 'woocommerce'), |
||||
'placeholder' => __('Ваша фамилия', 'woocommerce'), |
||||
'required' => true, |
||||
'class' => array('form-row-wide'), |
||||
'priority' => 10, |
||||
); |
||||
$fields['billing']['billing_email'] = array( |
||||
'type' => 'email', |
||||
'label' => __('E-mail', 'woocommerce'), |
||||
'placeholder' => __('Начните вводить ваш email', 'woocommerce'), |
||||
'required' => true, |
||||
'class' => array('form-row-wide'), |
||||
'priority' => 20, |
||||
); |
||||
$fields['billing']['billing_phone'] = array( |
||||
'type' => 'tel', |
||||
'label' => __('Телефон', 'woocommerce'), |
||||
'placeholder' => __('+7 ___ ___ ____', 'woocommerce'), |
||||
'required' => true, |
||||
'class' => array('form-row-wide'), |
||||
'priority' => 30, |
||||
); |
||||
$fields['billing']['billing_city'] = array( |
||||
'type' => 'text', |
||||
'label' => __('Населенный пункт', 'woocommerce'), |
||||
'placeholder' => __('Ваш город', 'woocommerce'), |
||||
'required' => true, |
||||
'class' => array('form-row-wide'), |
||||
'priority' => 40, |
||||
); |
||||
|
||||
$fields['billing']['billing_address_1'] = array( |
||||
'type' => 'text', |
||||
'label' => __('Адрес', 'woocommerce'), |
||||
'placeholder' => __('Адрес', 'woocommerce'), |
||||
'required' => false, |
||||
'class' => array('visually-hidden'), |
||||
'priority' => 40, |
||||
); |
||||
$fields['billing']['billing_address_2'] = array( |
||||
'type' => 'text', |
||||
'label' => __('Адрес 2', 'woocommerce'), |
||||
'placeholder' => __('Адрес 2', 'woocommerce'), |
||||
'required' => false, |
||||
'class' => array('visually-hidden'), |
||||
'priority' => 40, |
||||
); |
||||
|
||||
return $fields; |
||||
} |
||||
// remove_action( 'woocommerce_review_order_before_payment', 'woocommerce_review_order_shipping' ); |
||||
|
||||
add_action( 'init', function() { |
||||
update_option( 'woocommerce_enable_coupons', 'yes' ); // Включение купонов |
||||
} ); |
||||
|
||||
add_filter( 'woocommerce_available_payment_gateways', 'set_default_payment_gateway' ); |
||||
|
||||
function set_default_payment_gateway( $available_gateways ) { |
||||
if ( is_cart() || is_checkout() ) { |
||||
// Устанавливаем способ оплаты по умолчанию |
||||
$default_payment_gateway = 'tbank'; // ID способа оплаты, например 'cod' для "наличными при доставке" |
||||
|
||||
// Проверяем, доступен ли этот способ оплаты |
||||
if ( isset( $available_gateways[ $default_payment_gateway ] ) ) { |
||||
foreach ( $available_gateways as $gateway_id => $gateway ) { |
||||
// Оставляем только выбранный способ оплаты |
||||
if ( $gateway_id !== $default_payment_gateway ) { |
||||
unset( $available_gateways[ $gateway_id ] ); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
return $available_gateways; |
||||
} |
||||
|
||||
add_filter( 'woocommerce_checkout_terms_and_conditions_checkbox_enabled', '__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_terms_and_conditions', 'wc_terms_and_conditions_page_content', 30 ); |
||||
remove_action( 'woocommerce_checkout_after_terms_and_conditions', 'wc_privacy_policy_text', 20 ); |
||||
|
||||
add_action( 'woocommerce_checkout_process', 'remove_terms_validation' ); |
||||
|
||||
function remove_terms_validation() { |
||||
remove_action( 'woocommerce_checkout_process', 'woocommerce_checkout_terms_and_conditions' ); |
||||
} |
||||
|
||||
add_filter( 'woocommerce_order_button_html', 'custom_checkout_button_classes' ); |
||||
|
||||
function custom_checkout_button_classes( $button ) { |
||||
// Заменяем стандартные классы |
||||
$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> |
||||
</div>'; |
||||
return $button; |
||||
|
||||
|
||||
|
||||
} |
||||
|
||||
add_filter( 'woocommerce_checkout_fields', 'customize_checkout_registration_fields' ); |
||||
|
||||
function customize_checkout_registration_fields( $fields ) { |
||||
// Убираем поле ввода пароля |
||||
unset( $fields['account']['account_password'] ); |
||||
|
||||
return $fields; |
||||
} |
||||
|
||||
// Автоматическая генерация пароля |
||||
add_filter( 'woocommerce_checkout_posted_data', 'generate_password_for_registration' ); |
||||
|
||||
function generate_password_for_registration( $data ) { |
||||
|
||||
|
||||
$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_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_city = isset( $_POST['billing_city'] ) ? sanitize_text_field( $_POST['billing_city'] ) : ''; |
||||
$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_state = isset( $_POST['billing_state'] ) ? sanitize_text_field( $_POST['billing_state'] ) : ''; |
||||
$billing_phone = isset( $_POST['billing_phone'] ) ? sanitize_text_field( $_POST['billing_phone'] ) : ''; |
||||
$billing_email = isset( $_POST['billing_email'] ) ? sanitize_email( $_POST['billing_email'] ) : ''; |
||||
|
||||
|
||||
$data['shipping_first_name'] = $data['billing_first_name']; |
||||
$data['shipping_last_name'] = $data['billing_last_name']; |
||||
$data['shipping_address_1'] = $data['billing_address_1'] . $data['billing_address_2']; |
||||
$data['shipping_city'] = $data['billing_city']; |
||||
$data['shipping_postcode'] = $data['billing_postcode']; |
||||
$data['shipping_country'] = $data['billing_country']; |
||||
$data['shipping_state'] = $data['billing_state']; |
||||
|
||||
|
||||
|
||||
return $data; |
||||
} |
||||
|
||||
|
||||
function handle_user_registration_on_checkout() { |
||||
// Получаем данные из POST-запроса |
||||
if ( isset( $_POST['billing_email'] ) && isset( $_POST['reg'] )) { |
||||
if ($_POST['reg'] == '1'){ |
||||
|
||||
|
||||
$email = sanitize_email( $_POST['billing_email'] ); |
||||
$pass = sanitize_text_field( $_POST['pass'] ); |
||||
|
||||
// Регистрация пользователя |
||||
$user_id = custom_register_user_from_post( $email, $pass ); |
||||
|
||||
if ( is_wp_error( $user_id ) ) { |
||||
// Если email уже существует, выводим ошибку |
||||
wc_add_notice( $user_id->get_error_message(), 'error' ); |
||||
} else { |
||||
|
||||
wp_set_current_user( $user_id ); // Устанавливаем текущего пользователя |
||||
wp_set_auth_cookie( $user_id ); // Устанавливаем куки для авторизации |
||||
do_action( 'wp_login', $email, $user ); // Событие входа в систему |
||||
|
||||
}} |
||||
|
||||
} |
||||
} |
||||
add_action( 'woocommerce_checkout_process', 'handle_user_registration_on_checkout' ); |
||||
|
||||
|
||||
function custom_register_user_from_post( $email, $pass ) { |
||||
// Проверяем, есть ли уже пользователь с таким email |
||||
if ( email_exists( $email ) ) { |
||||
return new WP_Error( 'email_exists', 'Этот email уже зарегистрирован.' ); |
||||
} |
||||
|
||||
// Создаем пользователя в WordPress |
||||
$user_id = wp_create_user( $email, $pass, $email ); |
||||
if ( is_wp_error( $user_id ) ) { |
||||
return $user_id; // Возвращаем ошибку, если не удалось создать пользователя |
||||
} |
||||
|
||||
update_user_meta( $user_id, 'billing_email', $email ); // Устанавливаем email |
||||
update_user_meta( $user_id, 'user_email', $email ); // Устанавливаем email для входа |
||||
|
||||
// Устанавливаем роль пользователя как 'customer' для WooCommerce |
||||
$user = new WP_User( $user_id ); |
||||
$user->set_role( 'customer' ); |
||||
return $user_id; |
||||
} |
||||
|
||||
|
||||
add_filter( 'woocommerce_form_field', 'add_error_containers_to_checkout_fields', 10, 4 ); |
||||
|
||||
function add_error_containers_to_checkout_fields( $field, $key, $args, $value ) { |
||||
if ( is_checkout() ) { |
||||
// Добавляем контейнер для ошибок под полем |
||||
$error_container = '<div id="' . esc_attr( $key ) . '-error" class="form-input__error"></div>'; |
||||
$field .= $error_container; |
||||
} |
||||
return $field; |
||||
} |
||||
|
||||
add_filter( 'woocommerce_add_error', 'remove_payments_word_from_errors_multilang' ); |
||||
|
||||
function remove_payments_word_from_errors_multilang( $error ) { |
||||
// Слова для удаления в разных языках |
||||
$translations = array( |
||||
'Платежи', // Русский |
||||
'Billing', // Английский |
||||
); |
||||
|
||||
foreach ( $translations as $word ) { |
||||
$error = str_replace( $word, '', $error ); |
||||
} |
||||
|
||||
return trim( $error ); |
||||
} |
||||
|
||||
|
||||
add_action( 'woocommerce_checkout_process', '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'] ) : ''; |
||||
|
||||
// Проверяем формат телефона |
||||
if ( ! preg_match( '/^\+?[0-9\s\-\(\)]+$/', $phone ) ) { |
||||
wc_add_notice( 'phone_err', 'error', 'billing_phone' ); |
||||
} |
||||
} |
||||
|
||||
add_action( 'woocommerce_checkout_process', 'make_address_required_for_specific_shipping' ); |
||||
|
||||
function make_address_required_for_specific_shipping() { |
||||
// Получаем выбранный метод доставки |
||||
$chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods' ); |
||||
$chosen_shipping = isset( $chosen_shipping_methods[0] ) ? $chosen_shipping_methods[0] : ''; |
||||
|
||||
// Проверяем, выбран ли метод доставки "official_cdek:137" |
||||
if ( $chosen_shipping === 'official_cdek:137' ) { |
||||
// Проверяем, заполнен ли адрес |
||||
if ( empty( $_POST['billing_address_1'] ) ) { |
||||
wc_add_notice('adress_error', 'error' ); |
||||
} |
||||
} |
||||
} |
||||
|
||||
function auto_fill_shipping_fields_from_billing( $order_id ) { |
||||
// Получаем объект заказа |
||||
$order = wc_get_order( $order_id ); |
||||
|
||||
if ( ! $order ) { |
||||
return; // Если заказ недоступен, выходим |
||||
} |
||||
|
||||
// Получаем значения полей billing из глобального $_POST |
||||
$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_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_city = isset( $_POST['billing_city'] ) ? sanitize_text_field( $_POST['billing_city'] ) : ''; |
||||
$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_state = isset( $_POST['billing_state'] ) ? sanitize_text_field( $_POST['billing_state'] ) : ''; |
||||
$billing_phone = isset( $_POST['billing_phone'] ) ? sanitize_text_field( $_POST['billing_phone'] ) : ''; |
||||
$billing_email = isset( $_POST['billing_email'] ) ? sanitize_email( $_POST['billing_email'] ) : ''; |
||||
|
||||
// Копируем данные в поля доставки |
||||
$order->set_shipping_first_name( $billing_first_name ); |
||||
$order->set_shipping_last_name( $billing_last_name ); |
||||
$order->set_shipping_address_1( $billing_address_1 ); |
||||
$order->set_shipping_address_2( $billing_address_2 ); |
||||
$order->set_shipping_city( $billing_city ); |
||||
$order->set_shipping_postcode( $billing_postcode ); |
||||
$order->set_shipping_country( $billing_country ); |
||||
$order->set_shipping_state( $billing_state ); |
||||
|
||||
// Сохраняем изменения в заказе |
||||
$order->save(); |
||||
} |
||||
|
||||
add_filter('timber/context', function($context) { |
||||
if (function_exists('is_product') && is_product()) { |
||||
$product_id = get_the_ID(); |
||||
$product = wc_get_product($product_id); |
||||
|
||||
if ($product) { |
||||
$context['product'] = $product; |
||||
$context['product_id'] = $product_id; |
||||
|
||||
|
||||
$terms = get_the_terms($product_id, 'product_cat'); |
||||
if ($terms && !is_wp_error($terms)) { |
||||
$context['product_categories'] = $terms; |
||||
} |
||||
|
||||
|
||||
$attachment_ids = $product->get_gallery_image_ids(); |
||||
$gallery_images = []; |
||||
|
||||
$main_image_id = $product->get_image_id(); |
||||
if ($main_image_id) { |
||||
$gallery_images[] = [ |
||||
'id' => $main_image_id, |
||||
'src' => wp_get_attachment_image_url($main_image_id, 'full'), |
||||
'alt' => get_post_meta($main_image_id, '_wp_attachment_image_alt', true) |
||||
]; |
||||
} |
||||
|
||||
foreach ($attachment_ids as $attachment_id) { |
||||
$gallery_images[] = [ |
||||
'id' => $attachment_id, |
||||
'src' => wp_get_attachment_image_url($attachment_id, 'full'), |
||||
'alt' => get_post_meta($attachment_id, '_wp_attachment_image_alt', true) |
||||
]; |
||||
} |
||||
|
||||
$context['gallery_images'] = $gallery_images; |
||||
|
||||
$related_products_ids = wc_get_related_products($product_id, 5); |
||||
if (!empty($related_products_ids)) { |
||||
$related_products = []; |
||||
foreach ($related_products_ids as $related_id) { |
||||
$related_product = wc_get_product($related_id); |
||||
if ($related_product) { |
||||
$related_products[] = $related_product; |
||||
} |
||||
} |
||||
$context['related_products'] = $related_products; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return $context; |
||||
}); |
||||
|
||||
function conditional_dequeue_woocommerce_styles() { |
||||
if (function_exists('is_woocommerce') && !is_woocommerce() && !is_cart() && !is_checkout() && !is_account_page()) { |
||||
wp_dequeue_style('woocommerce-general'); |
||||
wp_dequeue_style('woocommerce-layout'); |
||||
wp_dequeue_style('woocommerce-smallscreen'); |
||||
} |
||||
} |
||||
add_action('wp_enqueue_scripts', 'conditional_dequeue_woocommerce_styles', 999); |
@ -1,31 +1,31 @@ |
||||
<?php |
||||
/** |
||||
* The template for displaying all pages. |
||||
* |
||||
* This is the template that renders pages using Timber (Twig). |
||||
*/ |
||||
|
||||
|
||||
if (is_account_page() && !is_wc_endpoint_url()){ |
||||
include_module('profile'); |
||||
$orders_pg = false; |
||||
include_component('profile', 'profile'); |
||||
} |
||||
else if (is_account_page() && isset($wp->query_vars['orders'])){ |
||||
include_module('profile'); |
||||
$orders_pg = true; |
||||
include_component('profile', 'profile'); |
||||
} |
||||
elseif (is_account_page() && isset($wp->query_vars['subscriptions'])){ |
||||
include_module('profile'); |
||||
include_component('profile', 'subscriptions'); |
||||
} |
||||
|
||||
elseif (is_account_page() && isset($wp->query_vars['view-subscription'])){ |
||||
include_module('profile'); |
||||
include_component('profile', 'subscription_single'); |
||||
} |
||||
$context = Timber::context(); |
||||
$context['post'] = Timber::get_post(); |
||||
|
||||
<?php |
||||
/** |
||||
* The template for displaying all pages. |
||||
* |
||||
* This is the template that renders pages using Timber (Twig). |
||||
*/ |
||||
|
||||
|
||||
if (is_account_page() && !is_wc_endpoint_url()){ |
||||
include_module('profile'); |
||||
$orders_pg = false; |
||||
include_component('profile', 'profile'); |
||||
} |
||||
else if (is_account_page() && isset($wp->query_vars['orders'])){ |
||||
include_module('profile'); |
||||
$orders_pg = true; |
||||
include_component('profile', 'profile'); |
||||
} |
||||
elseif (is_account_page() && isset($wp->query_vars['subscriptions'])){ |
||||
include_module('profile'); |
||||
include_component('profile', 'subscriptions'); |
||||
} |
||||
|
||||
elseif (is_account_page() && isset($wp->query_vars['view-subscription'])){ |
||||
include_module('profile'); |
||||
include_component('profile', 'subscription_single'); |
||||
} |
||||
$context = Timber::context(); |
||||
$context['post'] = Timber::get_post(); |
||||
|
||||
Timber::render('page.twig', $context); |
@ -1,60 +1,60 @@ |
||||
<?php |
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) { |
||||
exit; |
||||
} |
||||
|
||||
if (is_product()) { |
||||
|
||||
include_module('shop'); |
||||
include_component('shop', 'single-product'); |
||||
|
||||
$context = Timber::get_context(); |
||||
$post = Timber::get_post(); |
||||
$context['post'] = $post; |
||||
|
||||
$context['wc_breadcrumbs'] = array(); |
||||
|
||||
if (function_exists('woocommerce_breadcrumb')) { |
||||
$args = array( |
||||
'delimiter' => '', |
||||
'wrap_before' => '', |
||||
'wrap_after' => '', |
||||
'before' => '', |
||||
'after' => '', |
||||
'home' => _x('Home', 'breadcrumb', 'woocommerce'), |
||||
); |
||||
|
||||
$breadcrumbs = new WC_Breadcrumb(); |
||||
$breadcrumbs->generate(); |
||||
|
||||
$formatted_breadcrumbs = array(); |
||||
foreach ($breadcrumbs->get_breadcrumb() as $crumb) { |
||||
$formatted_breadcrumbs[] = array( |
||||
'text' => $crumb[0], |
||||
'url' => $crumb[1] |
||||
); |
||||
} |
||||
|
||||
$context['wc_breadcrumbs'] = $formatted_breadcrumbs; |
||||
} |
||||
|
||||
$product_id = get_the_ID(); |
||||
$product = wc_get_product($product_id); |
||||
|
||||
$context['product'] = $product; |
||||
|
||||
$context['related_products'] = array(); |
||||
$related_products_ids = wc_get_related_products($product_id, 5); |
||||
|
||||
if ($related_products_ids) { |
||||
foreach ($related_products_ids as $related_id) { |
||||
$related_product = wc_get_product($related_id); |
||||
if ($related_product) { |
||||
$context['related_products'][] = $related_product; |
||||
} |
||||
} |
||||
} |
||||
|
||||
Timber::render('modules/shop/components/single-product/component-template.twig', $context); |
||||
<?php |
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) { |
||||
exit; |
||||
} |
||||
|
||||
if (is_product()) { |
||||
|
||||
include_module('shop'); |
||||
include_component('shop', 'single-product'); |
||||
|
||||
$context = Timber::get_context(); |
||||
$post = Timber::get_post(); |
||||
$context['post'] = $post; |
||||
|
||||
$context['wc_breadcrumbs'] = array(); |
||||
|
||||
if (function_exists('woocommerce_breadcrumb')) { |
||||
$args = array( |
||||
'delimiter' => '', |
||||
'wrap_before' => '', |
||||
'wrap_after' => '', |
||||
'before' => '', |
||||
'after' => '', |
||||
'home' => _x('Home', 'breadcrumb', 'woocommerce'), |
||||
); |
||||
|
||||
$breadcrumbs = new WC_Breadcrumb(); |
||||
$breadcrumbs->generate(); |
||||
|
||||
$formatted_breadcrumbs = array(); |
||||
foreach ($breadcrumbs->get_breadcrumb() as $crumb) { |
||||
$formatted_breadcrumbs[] = array( |
||||
'text' => $crumb[0], |
||||
'url' => $crumb[1] |
||||
); |
||||
} |
||||
|
||||
$context['wc_breadcrumbs'] = $formatted_breadcrumbs; |
||||
} |
||||
|
||||
$product_id = get_the_ID(); |
||||
$product = wc_get_product($product_id); |
||||
|
||||
$context['product'] = $product; |
||||
|
||||
$context['related_products'] = array(); |
||||
$related_products_ids = wc_get_related_products($product_id, 5); |
||||
|
||||
if ($related_products_ids) { |
||||
foreach ($related_products_ids as $related_id) { |
||||
$related_product = wc_get_product($related_id); |
||||
if ($related_product) { |
||||
$context['related_products'][] = $related_product; |
||||
} |
||||
} |
||||
} |
||||
|
||||
Timber::render('modules/shop/components/single-product/component-template.twig', $context); |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -1,60 +1,60 @@ |
||||
{% extends 'layout.twig' %} |
||||
|
||||
|
||||
{% block content %} |
||||
|
||||
{% set current_path = template_path ~ '/modules/author/' %} |
||||
|
||||
|
||||
|
||||
|
||||
<!-- Breadcrumb --> |
||||
<section class="breadcrumb"> |
||||
<div class="container"> |
||||
<a href="/">{{ function('pll_e', 'Главная') }}</a> / |
||||
<a href="/blog/">{{ function('pll_e', 'Блог') }}</a> / |
||||
<a href="/blog_author/">{{ function('pll_e', 'Наши авторы') }}</a> |
||||
</div> |
||||
</section> |
||||
<!-- Breadcrumb end --> |
||||
|
||||
<!-- Authors block --> |
||||
<section class="authors"> |
||||
<div class="container"> |
||||
<h1>{{ function('pll_e', 'Все авторы') }}</h1> |
||||
<ul> |
||||
{% for author in authors %} |
||||
<li> |
||||
<a href="{{ author.link }}"> |
||||
<div class="main-img"> |
||||
<img src="{{ author.thumbnail.src|default(author.thumbnail|default('https://via.placeholder.com/150')) }}" alt="{{ author.title }}"> |
||||
</div> |
||||
<div class="authors-name">{{ author.title }}</div> |
||||
<div class="authors-type">{{ author.position|default(author.meta('position')) }}</div> |
||||
<p>{{ function('pll_e', 'статей:') }} {{ author.post_count|default(0) }}</p> |
||||
</a> |
||||
</li> |
||||
{% else %} |
||||
<li>{{ function('pll_e', 'Нет авторов для отображения.') }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
</div> |
||||
|
||||
|
||||
</section> |
||||
|
||||
{% include 'forms/discount.twig' %} |
||||
<section class="blog-home other-home"> |
||||
<div class="container"> |
||||
<!-- Authors block end --> |
||||
{% include '/blog/featured-slider.twig' %} |
||||
</div> |
||||
</section> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{% extends 'layout.twig' %} |
||||
|
||||
|
||||
{% block content %} |
||||
|
||||
{% set current_path = template_path ~ '/modules/author/' %} |
||||
|
||||
|
||||
|
||||
|
||||
<!-- Breadcrumb --> |
||||
<section class="breadcrumb"> |
||||
<div class="container"> |
||||
<a href="/">{{ function('pll_e', 'Главная') }}</a> / |
||||
<a href="/blog/">{{ function('pll_e', 'Блог') }}</a> / |
||||
<a href="/blog_author/">{{ function('pll_e', 'Наши авторы') }}</a> |
||||
</div> |
||||
</section> |
||||
<!-- Breadcrumb end --> |
||||
|
||||
<!-- Authors block --> |
||||
<section class="authors"> |
||||
<div class="container"> |
||||
<h1>{{ function('pll_e', 'Все авторы') }}</h1> |
||||
<ul> |
||||
{% for author in authors %} |
||||
<li> |
||||
<a href="{{ author.link }}"> |
||||
<div class="main-img"> |
||||
<img src="{{ author.thumbnail.src|default(author.thumbnail|default('https://via.placeholder.com/150')) }}" alt="{{ author.title }}"> |
||||
</div> |
||||
<div class="authors-name">{{ author.title }}</div> |
||||
<div class="authors-type">{{ author.position|default(author.meta('position')) }}</div> |
||||
<p>{{ function('pll_e', 'статей:') }} {{ author.post_count|default(0) }}</p> |
||||
</a> |
||||
</li> |
||||
{% else %} |
||||
<li>{{ function('pll_e', 'Нет авторов для отображения.') }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
</div> |
||||
|
||||
|
||||
</section> |
||||
|
||||
{% include 'forms/discount.twig' %} |
||||
<section class="blog-home other-home"> |
||||
<div class="container"> |
||||
<!-- Authors block end --> |
||||
{% include '/blog/featured-slider.twig' %} |
||||
</div> |
||||
</section> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{% endblock %} |
@ -1,36 +1,36 @@ |
||||
{% for post in posts %} |
||||
<li class="anons-best__card light"> |
||||
<ul class="anons-best__card-alerts"> |
||||
{% for category in post.categories %} |
||||
<li> |
||||
<a href="{{ category.link }}">{{ category.name }}</a> |
||||
</li> |
||||
{% endfor %} |
||||
</ul> |
||||
<a href="{{ post.link }}" class="main-img"> |
||||
<img src="{{ post.thumbnail.src|default('https://via.placeholder.com/150') }}" alt="{{ post.thumbnail.alt }}"> |
||||
</a> |
||||
<div class="anons-best__card-body"> |
||||
<a href="{{ post.link }}" class="anons-best__card-body__title">{{ post.title }}</a> |
||||
<div class="anons-best__card-body__datas"> |
||||
<p>{{ post.date|date('d.m.Y') }}</p> |
||||
<p>{{ function('pll_e', 'время чтения:') }} {{ post.reading_time|default(function('pll_e', '5 мин.')) }}</p> |
||||
<ul> |
||||
{% if post.get_author_img %} |
||||
<li class="logo"> |
||||
<img src="{{ post.get_author_img }}" alt="{{ post.get_author_name }}"> |
||||
</li> |
||||
{% endif %} |
||||
<li> |
||||
<img src="{{ current_path }}/assets/img/heart-grey.svg" alt=""> |
||||
<span>{{ function('get_post_likes_count', post.ID) }}</span> |
||||
</li> |
||||
<li> |
||||
<img src="{{ current_path }}/assets/img/msg-grey.svg" alt=""> |
||||
<span>{{ post.comment_count }}</span> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</li> |
||||
{% for post in posts %} |
||||
<li class="anons-best__card light"> |
||||
<ul class="anons-best__card-alerts"> |
||||
{% for category in post.categories %} |
||||
<li> |
||||
<a href="{{ category.link }}">{{ category.name }}</a> |
||||
</li> |
||||
{% endfor %} |
||||
</ul> |
||||
<a href="{{ post.link }}" class="main-img"> |
||||
<img src="{{ post.thumbnail.src|default('https://via.placeholder.com/150') }}" alt="{{ post.thumbnail.alt }}"> |
||||
</a> |
||||
<div class="anons-best__card-body"> |
||||
<a href="{{ post.link }}" class="anons-best__card-body__title">{{ post.title }}</a> |
||||
<div class="anons-best__card-body__datas"> |
||||
<p>{{ post.date|date('d.m.Y') }}</p> |
||||
<p>{{ function('pll_e', 'время чтения:') }} {{ post.reading_time|default(function('pll_e', '5 мин.')) }}</p> |
||||
<ul> |
||||
{% if post.get_author_img %} |
||||
<li class="logo"> |
||||
<img src="{{ post.get_author_img }}" alt="{{ post.get_author_name }}"> |
||||
</li> |
||||
{% endif %} |
||||
<li> |
||||
<img src="{{ current_path }}/assets/img/heart-grey.svg" alt=""> |
||||
<span>{{ function('get_post_likes_count', post.ID) }}</span> |
||||
</li> |
||||
<li> |
||||
<img src="{{ current_path }}/assets/img/msg-grey.svg" alt=""> |
||||
<span>{{ post.comment_count }}</span> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</li> |
||||
{% endfor %} |
@ -1,92 +1,92 @@ |
||||
{% set current_path = template_path ~ '/modules/blog/components/news-list' %} |
||||
|
||||
{% extends 'layout.twig' %} |
||||
|
||||
{% block content %} |
||||
<main> |
||||
<!-- Breadcrumb --> |
||||
<section class="breadcrumb"> |
||||
<div class="container"> |
||||
<a href="/">{{ function('pll_e', 'Главная') }}</a> / |
||||
<a href="/blog">{{ function('pll_e', 'Блог') }}</a> / |
||||
<a href="#">{{ author.title }}</a> |
||||
</div> |
||||
</section> |
||||
<!-- Breadcrumb end --> |
||||
|
||||
<!-- Authors block --> |
||||
<section class="author-head"> |
||||
<div class="container"> |
||||
<div class="author-head-content"> |
||||
<div class="main-img"> |
||||
<img src="{{ author.thumbnail.src|default('https://via.placeholder.com/150') }}" alt="{{ author.title }}"> |
||||
</div> |
||||
<div> |
||||
<div class="author-name">{{ author.title }}</div> |
||||
<div class="author-type">{{ author.position }}</div> |
||||
<div class="author-description">{{ author.content|striptags }}</div> |
||||
<p>{{ function('pll_e', 'статей:') }} {{ author.post_count }}</p> |
||||
</div> |
||||
</div> |
||||
<h2>{{ author.meta('headline')|default(function('pll_e', 'Посты автора')) }}</h2> |
||||
</div> |
||||
</section> |
||||
|
||||
<section class="anons"> |
||||
<div class="container"> |
||||
<div class="anons-article"> |
||||
<ul class="anons-article__card-wrap"> |
||||
{% for post in author.posts %} |
||||
<li class="anons-best__card light"> |
||||
<ul class="anons-best__card-alerts"> |
||||
{% for category in post.categories %} |
||||
<li> |
||||
<a href="{{ category.link }}">{{ category.name }}</a> |
||||
</li> |
||||
{% endfor %} |
||||
</ul> |
||||
<a href="{{ post.link }}" class="main-img"> |
||||
<img src="{{ post.thumbnail.src|default('https://via.placeholder.com/150') }}" alt="{{ post.thumbnail.alt }}"> |
||||
</a> |
||||
<div class="anons-best__card-body"> |
||||
<a href="{{ post.link }}" class="anons-best__card-body__title">{{ post.title }}</a> |
||||
<div class="anons-best__card-body__datas"> |
||||
<p>{{ post.date|date('d.m.Y') }}</p> |
||||
<p>{{ function('pll_e', 'время чтения:') }} {{ post.reading_time|default(function('pll_e', '5 мин.')) }}</p> |
||||
<ul> |
||||
{% if post.get_author_img %} |
||||
<li class="logo"> |
||||
<img src="{{ post.get_author_img }}" alt="{{ post.get_author_name }}"> |
||||
</li> |
||||
{% endif %} |
||||
<li> |
||||
<img src="{{ current_path }}/assets/img/heart-grey.svg" alt=""> |
||||
<span>{{ function('get_post_likes_count', post.ID) }}</span> |
||||
</li> |
||||
<li> |
||||
<img src="{{ current_path }}/assets/img/msg-grey.svg" alt=""> |
||||
<span>{{ post.comment_count }}</span> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</li> |
||||
{% else %} |
||||
<li>{{ function('pll_e', 'Нет постов') }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
{% if total_pages > 1 %} |
||||
<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="action" value="get_author_posts"> |
||||
<button class="anons-article__more-link"> |
||||
{{ function('pll_e', 'ПОКАЗАТЬ ЕЩЁ') }} |
||||
</button> |
||||
</form> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</section> |
||||
<!-- Authors block end --> |
||||
</main> |
||||
{% set current_path = template_path ~ '/modules/blog/components/news-list' %} |
||||
|
||||
{% extends 'layout.twig' %} |
||||
|
||||
{% block content %} |
||||
<main> |
||||
<!-- Breadcrumb --> |
||||
<section class="breadcrumb"> |
||||
<div class="container"> |
||||
<a href="/">{{ function('pll_e', 'Главная') }}</a> / |
||||
<a href="/blog">{{ function('pll_e', 'Блог') }}</a> / |
||||
<a href="#">{{ author.title }}</a> |
||||
</div> |
||||
</section> |
||||
<!-- Breadcrumb end --> |
||||
|
||||
<!-- Authors block --> |
||||
<section class="author-head"> |
||||
<div class="container"> |
||||
<div class="author-head-content"> |
||||
<div class="main-img"> |
||||
<img src="{{ author.thumbnail.src|default('https://via.placeholder.com/150') }}" alt="{{ author.title }}"> |
||||
</div> |
||||
<div> |
||||
<div class="author-name">{{ author.title }}</div> |
||||
<div class="author-type">{{ author.position }}</div> |
||||
<div class="author-description">{{ author.content|striptags }}</div> |
||||
<p>{{ function('pll_e', 'статей:') }} {{ author.post_count }}</p> |
||||
</div> |
||||
</div> |
||||
<h2>{{ author.meta('headline')|default(function('pll_e', 'Посты автора')) }}</h2> |
||||
</div> |
||||
</section> |
||||
|
||||
<section class="anons"> |
||||
<div class="container"> |
||||
<div class="anons-article"> |
||||
<ul class="anons-article__card-wrap"> |
||||
{% for post in author.posts %} |
||||
<li class="anons-best__card light"> |
||||
<ul class="anons-best__card-alerts"> |
||||
{% for category in post.categories %} |
||||
<li> |
||||
<a href="{{ category.link }}">{{ category.name }}</a> |
||||
</li> |
||||
{% endfor %} |
||||
</ul> |
||||
<a href="{{ post.link }}" class="main-img"> |
||||
<img src="{{ post.thumbnail.src|default('https://via.placeholder.com/150') }}" alt="{{ post.thumbnail.alt }}"> |
||||
</a> |
||||
<div class="anons-best__card-body"> |
||||
<a href="{{ post.link }}" class="anons-best__card-body__title">{{ post.title }}</a> |
||||
<div class="anons-best__card-body__datas"> |
||||
<p>{{ post.date|date('d.m.Y') }}</p> |
||||
<p>{{ function('pll_e', 'время чтения:') }} {{ post.reading_time|default(function('pll_e', '5 мин.')) }}</p> |
||||
<ul> |
||||
{% if post.get_author_img %} |
||||
<li class="logo"> |
||||
<img src="{{ post.get_author_img }}" alt="{{ post.get_author_name }}"> |
||||
</li> |
||||
{% endif %} |
||||
<li> |
||||
<img src="{{ current_path }}/assets/img/heart-grey.svg" alt=""> |
||||
<span>{{ function('get_post_likes_count', post.ID) }}</span> |
||||
</li> |
||||
<li> |
||||
<img src="{{ current_path }}/assets/img/msg-grey.svg" alt=""> |
||||
<span>{{ post.comment_count }}</span> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</li> |
||||
{% else %} |
||||
<li>{{ function('pll_e', 'Нет постов') }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
{% if total_pages > 1 %} |
||||
<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="action" value="get_author_posts"> |
||||
<button class="anons-article__more-link"> |
||||
{{ function('pll_e', 'ПОКАЗАТЬ ЕЩЁ') }} |
||||
</button> |
||||
</form> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</section> |
||||
<!-- Authors block end --> |
||||
</main> |
||||
{% endblock %} |
@ -1,32 +1,32 @@ |
||||
<div class="comment-block"> |
||||
<div class="comment-user"> |
||||
<img src="{{ comment.avatar ?? function('get_avatar_url', comment.author.id)|default('') }}" alt="{{ comment.author.name }}"> |
||||
<div class="comment-user_text"> |
||||
<h6> |
||||
{{ comment.author.name }} |
||||
</h6> |
||||
<span> |
||||
{{ comment.date }} |
||||
</span> |
||||
</div> |
||||
</div> |
||||
<p> |
||||
{{ comment.content }} |
||||
</p> |
||||
<div class="comment-btns"> |
||||
<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"> |
||||
<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> |
||||
</svg> |
||||
{{ function('pll_e', 'Ответить') }} |
||||
</button> |
||||
<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"> |
||||
<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> |
||||
{{ comment.like_count|default('0') }} |
||||
</button> |
||||
</div> |
||||
<div class="reply-form-container" id="reply-form-{{ comment.ID }}" style="display: none;"></div> |
||||
<div class="comment-block"> |
||||
<div class="comment-user"> |
||||
<img src="{{ comment.avatar ?? function('get_avatar_url', comment.author.id)|default('') }}" alt="{{ comment.author.name }}"> |
||||
<div class="comment-user_text"> |
||||
<h6> |
||||
{{ comment.author.name }} |
||||
</h6> |
||||
<span> |
||||
{{ comment.date }} |
||||
</span> |
||||
</div> |
||||
</div> |
||||
<p> |
||||
{{ comment.content }} |
||||
</p> |
||||
<div class="comment-btns"> |
||||
<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"> |
||||
<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> |
||||
</svg> |
||||
{{ function('pll_e', 'Ответить') }} |
||||
</button> |
||||
<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"> |
||||
<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> |
||||
{{ comment.like_count|default('0') }} |
||||
</button> |
||||
</div> |
||||
<div class="reply-form-container" id="reply-form-{{ comment.ID }}" style="display: none;"></div> |
||||
</div> |
@ -1,45 +1,45 @@ |
||||
<section class="{% if class %} {{ class }}{% else %}discount__sale{% endif %} sec-bf"> |
||||
<div class="container"> |
||||
<div class="discount_top"> |
||||
<h3 class="discount_title">{{sub_title}}</span> |
||||
</h3> |
||||
<div class="discount_top-imgs"> |
||||
{% if class %} |
||||
<img class="dicount_dog-img img--desktop" |
||||
src="{{ theme.link }}/static/front-page/img/labrador%20with%20stars.png" |
||||
alt=""> |
||||
<img class="dicount_dog-img img--mobile" |
||||
src="{{ theme.link }}/static/front-page/img/labrador%20with%20stars%20--%20mobile.png" |
||||
alt=""> |
||||
{% else %} |
||||
<img class="dicount_dog-img img--desktop" |
||||
src="{{ theme.link }}/static/front-page/img/dicsount-sale.png" |
||||
alt=""> |
||||
<img class="dicount_dog-img img--mobile" |
||||
src="{{ theme.link }}/static/front-page/img/dicsount-sale-mob.png" |
||||
alt=""> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
<div class="dicsount__body"> |
||||
|
||||
<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> |
||||
<form class="form-process" action="subscribe_form" method="post" class="" aria-label="Контактная форма" novalidate="novalidate" data-status="init"> |
||||
|
||||
<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> |
||||
<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="form_name" value="Subscribtion form"> |
||||
<button class="discount_form-btn main_link" type="submit">{{ function('pll_e', 'подписаться') }}</button> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
<p class="discount_form-text"> |
||||
{{ function('pll_e', 'Подписываясь на рассылку, я даю согласие на обработку персональных данных, на получение рекламных сообщений и новостей о товарах и услугах') }}</p> |
||||
<p class="discount_text">{{sub_text}}</p> |
||||
</div> |
||||
</div> |
||||
<section class="{% if class %} {{ class }}{% else %}discount__sale{% endif %} sec-bf"> |
||||
<div class="container"> |
||||
<div class="discount_top"> |
||||
<h3 class="discount_title">{{sub_title}}</span> |
||||
</h3> |
||||
<div class="discount_top-imgs"> |
||||
{% if class %} |
||||
<img class="dicount_dog-img img--desktop" |
||||
src="{{ theme.link }}/static/front-page/img/labrador%20with%20stars.png" |
||||
alt=""> |
||||
<img class="dicount_dog-img img--mobile" |
||||
src="{{ theme.link }}/static/front-page/img/labrador%20with%20stars%20--%20mobile.png" |
||||
alt=""> |
||||
{% else %} |
||||
<img class="dicount_dog-img img--desktop" |
||||
src="{{ theme.link }}/static/front-page/img/dicsount-sale.png" |
||||
alt=""> |
||||
<img class="dicount_dog-img img--mobile" |
||||
src="{{ theme.link }}/static/front-page/img/dicsount-sale-mob.png" |
||||
alt=""> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
<div class="dicsount__body"> |
||||
|
||||
<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> |
||||
<form class="form-process" action="subscribe_form" method="post" class="" aria-label="Контактная форма" novalidate="novalidate" data-status="init"> |
||||
|
||||
<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> |
||||
<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="form_name" value="Subscribtion form"> |
||||
<button class="discount_form-btn main_link" type="submit">{{ function('pll_e', 'подписаться') }}</button> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
<p class="discount_form-text"> |
||||
{{ function('pll_e', 'Подписываясь на рассылку, я даю согласие на обработку персональных данных, на получение рекламных сообщений и новостей о товарах и услугах') }}</p> |
||||
<p class="discount_text">{{sub_text}}</p> |
||||
</div> |
||||
</div> |
||||
</section> |
@ -1,118 +1,118 @@ |
||||
|
||||
<!DOCTYPE html> |
||||
<html lang="ru"> |
||||
<head> |
||||
|
||||
{{ function('wp_head') }} |
||||
|
||||
<title>{{ function('wp_title') }} </title> |
||||
<meta charset="UTF-8"> |
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
<!-- Top.Mail.Ru counter --> |
||||
<script type="text/javascript"> |
||||
var _tmr = window._tmr || (window._tmr = []); |
||||
_tmr.push({id: "3569464", type: "pageView", start: (new Date()).getTime()}); |
||||
(function (d, w, id) { |
||||
if (d.getElementById(id)) return; |
||||
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"; |
||||
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(); } |
||||
})(document, window, "tmr-code"); |
||||
</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> |
||||
<!-- /Top.Mail.Ru counter --> |
||||
|
||||
<meta name="yandex-verification" content="2da3f924c37aec09" /> |
||||
<meta name="yandex-verification" content="2109bb636b61b248" /> |
||||
<meta name="facebook-domain-verification" content="0t1n3h5uw4gdcpc1smgnnceaya7ek9" /> |
||||
<meta name="google-site-verification" content="rHrHfWw6KM9echj8buJwfSPdVJLPECX0uhRTtyRX5F4" /> |
||||
|
||||
<!-- Google tag (gtag.js) --> |
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-WTY3GTXP5J"></script> |
||||
<script async> |
||||
window.dataLayer = window.dataLayer || []; |
||||
function gtag(){dataLayer.push(arguments);} |
||||
gtag('js', new Date()); |
||||
gtag('config', 'G-WTY3GTXP5J'); |
||||
</script> |
||||
<!-- /Google tag (gtag.js) --> |
||||
|
||||
<!-- Yandex.Metrika counter --> |
||||
{# RU - счетчик #} |
||||
<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)}; |
||||
m[i].l=1*new Date(); |
||||
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)}) |
||||
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym"); |
||||
|
||||
ym(96481053, "init", { |
||||
clickmap:true, |
||||
trackLinks:true, |
||||
accurateTrackBounce:true, |
||||
webvisor:true, |
||||
ecommerce:"dataLayer" |
||||
}); |
||||
window.dataLayer = window.dataLayer || []; |
||||
</script> |
||||
<noscript><div><img src="https://mc.yandex.ru/watch/96481053" style="position:absolute; left:-9999px;" alt="" /></div></noscript> |
||||
|
||||
{# AE - счетчик #} |
||||
<script> |
||||
(function(w,d,u){ |
||||
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); |
||||
})(window,document,'https://cdn-ru.bitrix24.ru/b33297602/crm/tag/call.tracker.js'); |
||||
|
||||
ym(100896819, "init", { |
||||
clickmap:true, |
||||
trackLinks:true, |
||||
accurateTrackBounce:true, |
||||
webvisor:true |
||||
}); |
||||
</script> |
||||
<noscript><div><img src="https://mc.yandex.ru/watch/100896819" style="position:absolute; left:-9999px;" alt="" /></div></noscript> |
||||
<!-- /Yandex.Metrika counter --> |
||||
|
||||
|
||||
|
||||
<!-- Meta Pixel Code --> |
||||
<script async> |
||||
!function(f,b,e,v,n,t,s) |
||||
{if(f.fbq)return;n=f.fbq=function(){n.callMethod? |
||||
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'; |
||||
n.queue=[];t=b.createElement(e);t.async=!0; |
||||
t.src=v;s=b.getElementsByTagName(e)[0]; |
||||
s.parentNode.insertBefore(t,s)}(window, document,'script', |
||||
'https://connect.facebook.net/en_US/fbevents.js'); |
||||
fbq('init', '1791804684725971'); |
||||
fbq('track', 'PageView'); |
||||
</script> |
||||
<noscript> |
||||
<img height="1" width="1" style="display:none" |
||||
src="https://www.facebook.com/tr?id=1791804684725971&ev=PageView&noscript=1" |
||||
/> |
||||
</noscript> |
||||
<!-- /Meta Pixel Code --> |
||||
|
||||
|
||||
|
||||
</head> |
||||
|
||||
<body class="{{bodyClass}}"> |
||||
{% include 'header.twig' %} |
||||
<main class="{{ mainClass }}"> |
||||
{% block content %} |
||||
{% endblock %} |
||||
{% include 'modal.twig' %} |
||||
</main> |
||||
{% include 'footer.twig' %} |
||||
</div> |
||||
{{ function('wp_footer') }} |
||||
</body> |
||||
</html> |
||||
|
||||
|
||||
<!DOCTYPE html> |
||||
<html lang="ru"> |
||||
<head> |
||||
|
||||
{{ function('wp_head') }} |
||||
|
||||
<title>{{ function('wp_title') }} </title> |
||||
<meta charset="UTF-8"> |
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
<!-- Top.Mail.Ru counter --> |
||||
<script type="text/javascript"> |
||||
var _tmr = window._tmr || (window._tmr = []); |
||||
_tmr.push({id: "3569464", type: "pageView", start: (new Date()).getTime()}); |
||||
(function (d, w, id) { |
||||
if (d.getElementById(id)) return; |
||||
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"; |
||||
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(); } |
||||
})(document, window, "tmr-code"); |
||||
</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> |
||||
<!-- /Top.Mail.Ru counter --> |
||||
|
||||
<meta name="yandex-verification" content="2da3f924c37aec09" /> |
||||
<meta name="yandex-verification" content="2109bb636b61b248" /> |
||||
<meta name="facebook-domain-verification" content="0t1n3h5uw4gdcpc1smgnnceaya7ek9" /> |
||||
<meta name="google-site-verification" content="rHrHfWw6KM9echj8buJwfSPdVJLPECX0uhRTtyRX5F4" /> |
||||
|
||||
<!-- Google tag (gtag.js) --> |
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-WTY3GTXP5J"></script> |
||||
<script async> |
||||
window.dataLayer = window.dataLayer || []; |
||||
function gtag(){dataLayer.push(arguments);} |
||||
gtag('js', new Date()); |
||||
gtag('config', 'G-WTY3GTXP5J'); |
||||
</script> |
||||
<!-- /Google tag (gtag.js) --> |
||||
|
||||
<!-- Yandex.Metrika counter --> |
||||
{# RU - счетчик #} |
||||
<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)}; |
||||
m[i].l=1*new Date(); |
||||
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)}) |
||||
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym"); |
||||
|
||||
ym(96481053, "init", { |
||||
clickmap:true, |
||||
trackLinks:true, |
||||
accurateTrackBounce:true, |
||||
webvisor:true, |
||||
ecommerce:"dataLayer" |
||||
}); |
||||
window.dataLayer = window.dataLayer || []; |
||||
</script> |
||||
<noscript><div><img src="https://mc.yandex.ru/watch/96481053" style="position:absolute; left:-9999px;" alt="" /></div></noscript> |
||||
|
||||
{# AE - счетчик #} |
||||
<script> |
||||
(function(w,d,u){ |
||||
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); |
||||
})(window,document,'https://cdn-ru.bitrix24.ru/b33297602/crm/tag/call.tracker.js'); |
||||
|
||||
ym(100896819, "init", { |
||||
clickmap:true, |
||||
trackLinks:true, |
||||
accurateTrackBounce:true, |
||||
webvisor:true |
||||
}); |
||||
</script> |
||||
<noscript><div><img src="https://mc.yandex.ru/watch/100896819" style="position:absolute; left:-9999px;" alt="" /></div></noscript> |
||||
<!-- /Yandex.Metrika counter --> |
||||
|
||||
|
||||
|
||||
<!-- Meta Pixel Code --> |
||||
<script async> |
||||
!function(f,b,e,v,n,t,s) |
||||
{if(f.fbq)return;n=f.fbq=function(){n.callMethod? |
||||
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'; |
||||
n.queue=[];t=b.createElement(e);t.async=!0; |
||||
t.src=v;s=b.getElementsByTagName(e)[0]; |
||||
s.parentNode.insertBefore(t,s)}(window, document,'script', |
||||
'https://connect.facebook.net/en_US/fbevents.js'); |
||||
fbq('init', '1791804684725971'); |
||||
fbq('track', 'PageView'); |
||||
</script> |
||||
<noscript> |
||||
<img height="1" width="1" style="display:none" |
||||
src="https://www.facebook.com/tr?id=1791804684725971&ev=PageView&noscript=1" |
||||
/> |
||||
</noscript> |
||||
<!-- /Meta Pixel Code --> |
||||
|
||||
|
||||
|
||||
</head> |
||||
|
||||
<body class="{{bodyClass}}"> |
||||
{% include 'header.twig' %} |
||||
<main class="{{ mainClass }}"> |
||||
{% block content %} |
||||
{% endblock %} |
||||
{% include 'modal.twig' %} |
||||
</main> |
||||
{% include 'footer.twig' %} |
||||
</div> |
||||
{{ function('wp_footer') }} |
||||
</body> |
||||
</html> |
||||
|
||||
|
@ -1,68 +1,68 @@ |
||||
|
||||
|
||||
|
||||
<div class="modal"> |
||||
<aside class="modal__aside"> |
||||
<div class="modal__item modal__filter"> |
||||
<button class="modal__close"> |
||||
<img src="{{ current_path }}assets/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
|
||||
<div class="modal__header"> |
||||
<p class="modal__title">{{ fn ('pll_e', 'Фильтры') }}</p> |
||||
{{sidebar_filters}} |
||||
</div> |
||||
</div> |
||||
|
||||
{% include 'modal/basket.twig' %} |
||||
|
||||
<div class="modal__item modal__to-know modal__item--no-title"> |
||||
<button class="modal__close"> |
||||
<img src="{{ current_path }}assets/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
<div class="modal__header"> |
||||
<p class="modal__small-title">{{ fn ('pll_e', 'Узнать о поступлении') }}</p> |
||||
<p class="modal__text"> |
||||
{{ fn ('pll_e', 'Оставьте свой e-mail, и мы оповестим вас, когда продукт появится') }} |
||||
</p> |
||||
|
||||
<form action="" class="modal__form-sub"> |
||||
<div class="label"> |
||||
<label for="mail" class="label__title"> |
||||
{{ fn ('pll_e', 'mail') }} |
||||
</label> |
||||
</div> |
||||
<input type="text" class="form__input" id="mail" placeholder="Email"> |
||||
<div class="checkbox checkbox--small"> |
||||
<div class="checkbox__state"></div> |
||||
<input type="checkbox" name="" id="" class="checkbox__input"> |
||||
<label for="" class="checkbox__label"> |
||||
{{ fn ('pll_e', 'Я ознакомился с <a href="#">политикой обработки персональных данных</a> и <a href="#">пользовательским соглашением') }}</a> |
||||
</label> |
||||
</div> |
||||
|
||||
<input type="submit" value="Оставить почту" class="button button--white button--red-48-px button--100-perc active modal-form-sub__submit"> |
||||
</form> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div class="modal__item modal__to-know-submit modal__item--no-title"> |
||||
<button class="modal__close"> |
||||
<img src="assets/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
<div class="modal__header"> |
||||
<p class="modal__small-title">{{ fn ('pll_e', 'Подписка на товар оформлена') }}</p> |
||||
<p class="modal__text"> |
||||
{{ fn ('pll_e', 'На ваш e-mail <span id="email_current"></span> придет письмо, как только продукт появится в наличии.') }} |
||||
</p> |
||||
<button class="button button--white button--red-48-px button--100-perc active modal-form-sub__submit"> |
||||
{{ fn ('pll_e', 'Продолжить покупки') }} |
||||
</button> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
{% include 'modal/login.twig' %} |
||||
</aside> |
||||
|
||||
|
||||
|
||||
<div class="modal"> |
||||
<aside class="modal__aside"> |
||||
<div class="modal__item modal__filter"> |
||||
<button class="modal__close"> |
||||
<img src="{{ current_path }}assets/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
|
||||
<div class="modal__header"> |
||||
<p class="modal__title">{{ fn ('pll_e', 'Фильтры') }}</p> |
||||
{{sidebar_filters}} |
||||
</div> |
||||
</div> |
||||
|
||||
{% include 'modal/basket.twig' %} |
||||
|
||||
<div class="modal__item modal__to-know modal__item--no-title"> |
||||
<button class="modal__close"> |
||||
<img src="{{ current_path }}assets/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
<div class="modal__header"> |
||||
<p class="modal__small-title">{{ fn ('pll_e', 'Узнать о поступлении') }}</p> |
||||
<p class="modal__text"> |
||||
{{ fn ('pll_e', 'Оставьте свой e-mail, и мы оповестим вас, когда продукт появится') }} |
||||
</p> |
||||
|
||||
<form action="" class="modal__form-sub"> |
||||
<div class="label"> |
||||
<label for="mail" class="label__title"> |
||||
{{ fn ('pll_e', 'mail') }} |
||||
</label> |
||||
</div> |
||||
<input type="text" class="form__input" id="mail" placeholder="Email"> |
||||
<div class="checkbox checkbox--small"> |
||||
<div class="checkbox__state"></div> |
||||
<input type="checkbox" name="" id="" class="checkbox__input"> |
||||
<label for="" class="checkbox__label"> |
||||
{{ fn ('pll_e', 'Я ознакомился с <a href="#">политикой обработки персональных данных</a> и <a href="#">пользовательским соглашением') }}</a> |
||||
</label> |
||||
</div> |
||||
|
||||
<input type="submit" value="Оставить почту" class="button button--white button--red-48-px button--100-perc active modal-form-sub__submit"> |
||||
</form> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div class="modal__item modal__to-know-submit modal__item--no-title"> |
||||
<button class="modal__close"> |
||||
<img src="assets/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
<div class="modal__header"> |
||||
<p class="modal__small-title">{{ fn ('pll_e', 'Подписка на товар оформлена') }}</p> |
||||
<p class="modal__text"> |
||||
{{ fn ('pll_e', 'На ваш e-mail <span id="email_current"></span> придет письмо, как только продукт появится в наличии.') }} |
||||
</p> |
||||
<button class="button button--white button--red-48-px button--100-perc active modal-form-sub__submit"> |
||||
{{ fn ('pll_e', 'Продолжить покупки') }} |
||||
</button> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
{% include 'modal/login.twig' %} |
||||
</aside> |
||||
</div> |
@ -1,44 +1,44 @@ |
||||
<div id="modal-basket" class="modal__item modal__basket"> |
||||
<button class="modal__close"> |
||||
<img src="{{ theme.link }}/static/img/svg/main/black-x.svg" alt="{{ __('Close cart', 'your-theme') }}"> |
||||
</button> |
||||
|
||||
<div class="modal-basket__loading"> |
||||
<div class="modal-basket__loader"></div> |
||||
</div> |
||||
|
||||
<div class="modal__header"> |
||||
<p class="modal__title">{{ __('Cart', 'woocommerce') }}</p> |
||||
|
||||
<div class="modal__content" id="modal-basket-content"> |
||||
{% include 'shop/cart-contents.twig' %} |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal__footer" id="modal-basket-footer"> |
||||
{% if not fn('WC').cart.is_empty and fn('WC').cart.get_total('raw') > 0 %} |
||||
<div class="modal__block-price"> |
||||
<p class="modal-block-price__title">{{ __('Total', 'woocommerce') }}</p> |
||||
<p class="modal-block-price__price"> |
||||
{{ fn('wc_cart_totals_order_total_html') }} |
||||
</p> |
||||
</div> |
||||
|
||||
<div class="modal__block-button"> |
||||
<div class="modal__button"> |
||||
<a href="{{ fn('wc_get_checkout_url') }}" class="button button--gradient button--high button--100-perc proceed-to-checkout"> |
||||
{{ __('Proceed to checkout', 'woocommerce') }} |
||||
</a> |
||||
</div> |
||||
</div> |
||||
{% else %} |
||||
<div class="modal__block-button"> |
||||
<a href="/shop/" class="modal__button"> |
||||
<button class="to-know button--100-perc to-know--background-none continue-shopping"> |
||||
<p>{{ __('Continue shopping', 'woocommerce') }}</p> |
||||
</button> |
||||
</a> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
<div id="modal-basket" class="modal__item modal__basket"> |
||||
<button class="modal__close"> |
||||
<img src="{{ theme.link }}/static/img/svg/main/black-x.svg" alt="{{ __('Close cart', 'your-theme') }}"> |
||||
</button> |
||||
|
||||
<div class="modal-basket__loading"> |
||||
<div class="modal-basket__loader"></div> |
||||
</div> |
||||
|
||||
<div class="modal__header"> |
||||
<p class="modal__title">{{ __('Cart', 'woocommerce') }}</p> |
||||
|
||||
<div class="modal__content" id="modal-basket-content"> |
||||
{% include 'shop/cart-contents.twig' %} |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal__footer" id="modal-basket-footer"> |
||||
{% if not fn('WC').cart.is_empty and fn('WC').cart.get_total('raw') > 0 %} |
||||
<div class="modal__block-price"> |
||||
<p class="modal-block-price__title">{{ __('Total', 'woocommerce') }}</p> |
||||
<p class="modal-block-price__price"> |
||||
{{ fn('wc_cart_totals_order_total_html') }} |
||||
</p> |
||||
</div> |
||||
|
||||
<div class="modal__block-button"> |
||||
<div class="modal__button"> |
||||
<a href="{{ fn('wc_get_checkout_url') }}" class="button button--gradient button--high button--100-perc proceed-to-checkout"> |
||||
{{ __('Proceed to checkout', 'woocommerce') }} |
||||
</a> |
||||
</div> |
||||
</div> |
||||
{% else %} |
||||
<div class="modal__block-button"> |
||||
<a href="/shop/" class="modal__button"> |
||||
<button class="to-know button--100-perc to-know--background-none continue-shopping"> |
||||
<p>{{ __('Continue shopping', 'woocommerce') }}</p> |
||||
</button> |
||||
</a> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
@ -1,51 +1,51 @@ |
||||
<div class="modal__item modal__login"> |
||||
<button class="modal__close"> |
||||
<img src="<?php bloginfo('template_url');?>/gp-include/assets/core/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
|
||||
<div class="login_wrap login_forms"> |
||||
<div class="login_inner step active"> |
||||
<h2 class="login_title">Войти или зарегистрироваться</h2> |
||||
<div class="login_subtitle">Подтвердите свой e-mail в письме</div> |
||||
<div class="login_input js-input-email"> |
||||
<input type="text" name="email" placeholder="example@example.com"/> |
||||
<div class="login_error"></div> |
||||
</div> |
||||
<button class="login_btn btn_gradient js-get-code">Получить код</button> |
||||
{{ function('tgWidget') }} |
||||
</div> |
||||
<div class="login_inner step"> |
||||
<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> |
||||
</div> |
||||
<h2 class="login_title">Введите код</h2> |
||||
<div class="login_subtitle">Код отправленный на e-mail:<span class="sended_email"></span></div> |
||||
<div class="login_input js-input-code"> |
||||
<input type="text" name="code" placeholder="0000"/> |
||||
<div class="login_error"></div> |
||||
</div> |
||||
<div class="login_timer">Запросить новый код: <span class="seconds">15</span> секунд</div> |
||||
<button class="login_btn btn_gradient js-repeat-code">Запросить новый код</button> |
||||
</div> |
||||
<div class="login_privacy"> |
||||
Нажимая на кнопку «Получить код», я даю согласие на обработку моих персональных данных в соответствии с <a href="/privacy-policy">политикой обработки персональных данных</a> |
||||
</div> |
||||
</div> |
||||
<div class="login_wrap login_success hide"> |
||||
<div class="login_inner active"> |
||||
<h2 class="login_title">Спасибо<br />за авторизацию</h2> |
||||
<div class="login_subtitle">Теперь вы можете получать промокоды за покупки.</div> |
||||
<img src="<?php bloginfo('template_url');?>/images/people.png" alt=""/> |
||||
<a href="/my-account" class="login_btn account_link">Заполнить профиль</a> |
||||
</div> |
||||
</div> |
||||
<div class="login_wrap login_auth hide"> |
||||
<div class="login_inner active"> |
||||
<h2 class="login_title --text-center"> |
||||
Вы вошли в систему</h2> |
||||
<img src="<?php bloginfo('template_url');?>/images/people.png" alt=""/> |
||||
<a href="/my-account" class="login_btn account_link">Профиль</a> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal__item modal__login"> |
||||
<button class="modal__close"> |
||||
<img src="<?php bloginfo('template_url');?>/gp-include/assets/core/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
|
||||
<div class="login_wrap login_forms"> |
||||
<div class="login_inner step active"> |
||||
<h2 class="login_title">Войти или зарегистрироваться</h2> |
||||
<div class="login_subtitle">Подтвердите свой e-mail в письме</div> |
||||
<div class="login_input js-input-email"> |
||||
<input type="text" name="email" placeholder="example@example.com"/> |
||||
<div class="login_error"></div> |
||||
</div> |
||||
<button class="login_btn btn_gradient js-get-code">Получить код</button> |
||||
{{ function('tgWidget') }} |
||||
</div> |
||||
<div class="login_inner step"> |
||||
<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> |
||||
</div> |
||||
<h2 class="login_title">Введите код</h2> |
||||
<div class="login_subtitle">Код отправленный на e-mail:<span class="sended_email"></span></div> |
||||
<div class="login_input js-input-code"> |
||||
<input type="text" name="code" placeholder="0000"/> |
||||
<div class="login_error"></div> |
||||
</div> |
||||
<div class="login_timer">Запросить новый код: <span class="seconds">15</span> секунд</div> |
||||
<button class="login_btn btn_gradient js-repeat-code">Запросить новый код</button> |
||||
</div> |
||||
<div class="login_privacy"> |
||||
Нажимая на кнопку «Получить код», я даю согласие на обработку моих персональных данных в соответствии с <a href="/privacy-policy">политикой обработки персональных данных</a> |
||||
</div> |
||||
</div> |
||||
<div class="login_wrap login_success hide"> |
||||
<div class="login_inner active"> |
||||
<h2 class="login_title">Спасибо<br />за авторизацию</h2> |
||||
<div class="login_subtitle">Теперь вы можете получать промокоды за покупки.</div> |
||||
<img src="<?php bloginfo('template_url');?>/images/people.png" alt=""/> |
||||
<a href="/my-account" class="login_btn account_link">Заполнить профиль</a> |
||||
</div> |
||||
</div> |
||||
<div class="login_wrap login_auth hide"> |
||||
<div class="login_inner active"> |
||||
<h2 class="login_title --text-center"> |
||||
Вы вошли в систему</h2> |
||||
<img src="<?php bloginfo('template_url');?>/images/people.png" alt=""/> |
||||
<a href="/my-account" class="login_btn account_link">Профиль</a> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
@ -1,10 +1,10 @@ |
||||
{% set bodyClass = 'bg-white' %} |
||||
{% set mainClass = 'wrapper' %} |
||||
|
||||
{% extends 'layout.twig' %} |
||||
|
||||
{% block content %} |
||||
|
||||
{{ post.content }} |
||||
|
||||
{% set bodyClass = 'bg-white' %} |
||||
{% set mainClass = 'wrapper' %} |
||||
|
||||
{% extends 'layout.twig' %} |
||||
|
||||
{% block content %} |
||||
|
||||
{{ post.content }} |
||||
|
||||
{% endblock %} |
@ -1,81 +1,81 @@ |
||||
<div class="cabinet-card cabinet-card--green"> |
||||
<div class="cabinet-card__content"> |
||||
<div class="cabinet-card__pet"> |
||||
<div class="cabinet-card-pet__icon"> |
||||
<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=""> |
||||
</div> |
||||
</div> |
||||
<p class="cabinet-card-pet__name">{{ function('get_the_title', pet_id) }}</p> |
||||
</div> |
||||
|
||||
<div class="cabinet-card__element"> |
||||
<p class="cabinet-card__label">{{ pll_e('Breed') }}:</p> |
||||
<p class="cabinet-card__text">{{ function('get_field', 'breed', pet_id) }}</p> |
||||
</div> |
||||
|
||||
<div class="cabinet-card__element"> |
||||
<p class="cabinet-card__label">{{ pll_e('Weight') }}:</p> |
||||
<p class="cabinet-card__text"> |
||||
{% 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') }} |
||||
{% 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 == '5-8' %}{{ pll_e('from 5 to 8 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 == '15-20' %}{{ pll_e('from 15 to 20 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 == 'more_35' %}{{ pll_e('More than 35 kg') }} |
||||
{% endif %} |
||||
</p> |
||||
</div> |
||||
|
||||
{% if function('get_field', 'old', pet_id) %} |
||||
<div class="cabinet-card__element"> |
||||
<p class="cabinet-card__label">{{ pll_e('Age') }}:</p> |
||||
<p class="cabinet-card__text"> |
||||
{% set age_key = function('get_field', 'old', pet_id) %} |
||||
{% 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 == 'very_old' %}{{ pll_e('Aging (12 years and older)') }} |
||||
{% elseif age_key == 'baby' %}{{ pll_e('Baby (from 0 to 1 year)') }} |
||||
{% endif %} |
||||
</p> |
||||
</div> |
||||
{% else %} |
||||
{% set month = function('get_field', 'month', pet_id) %} |
||||
{% set zero = month < 10 ? '0' : '' %} |
||||
<div class="cabinet-card__element"> |
||||
<p class="cabinet-card__label">{{ pll_e('Birthday') }}:</p> |
||||
<p class="cabinet-card__text"> |
||||
{{ function('get_field', 'day', pet_id) }}.{{ zero }}{{ month }}.{{ function('get_field', 'year', pet_id) }} |
||||
</p> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
<div class="cabinet-card__element"> |
||||
<p class="cabinet-card__label">{{ pll_e('Activity') }}:</p> |
||||
<p class="cabinet-card__text"> |
||||
{% set activity_key = function('get_field', 'activity', pet_id) %} |
||||
{% if activity_key == 'low' %}{{ pll_e('Low') }} |
||||
{% elseif activity_key == 'moderate' %}{{ pll_e('Moderate') }} |
||||
{% elseif activity_key == 'high' %}{{ pll_e('High') }} |
||||
{% endif %} |
||||
</p> |
||||
</div> |
||||
|
||||
{% if function('get_field', 'type', pet_id) == 'cat' and function('get_field', 'sterilized', pet_id) %} |
||||
<div class="cabinet-card__element"> |
||||
<p class="cabinet-card__label">{{ pll_e('Sterilized') }}</p> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
<div class="cabinet-card__element"> |
||||
<button class="cabinet-card__button" data-edit="{{ pet_id }}"> |
||||
{{ pll_e('Edit') }} |
||||
</button> |
||||
</div> |
||||
</div> |
||||
<div class="cabinet-card cabinet-card--green"> |
||||
<div class="cabinet-card__content"> |
||||
<div class="cabinet-card__pet"> |
||||
<div class="cabinet-card-pet__icon"> |
||||
<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=""> |
||||
</div> |
||||
</div> |
||||
<p class="cabinet-card-pet__name">{{ function('get_the_title', pet_id) }}</p> |
||||
</div> |
||||
|
||||
<div class="cabinet-card__element"> |
||||
<p class="cabinet-card__label">{{ pll_e('Breed') }}:</p> |
||||
<p class="cabinet-card__text">{{ function('get_field', 'breed', pet_id) }}</p> |
||||
</div> |
||||
|
||||
<div class="cabinet-card__element"> |
||||
<p class="cabinet-card__label">{{ pll_e('Weight') }}:</p> |
||||
<p class="cabinet-card__text"> |
||||
{% 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') }} |
||||
{% 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 == '5-8' %}{{ pll_e('from 5 to 8 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 == '15-20' %}{{ pll_e('from 15 to 20 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 == 'more_35' %}{{ pll_e('More than 35 kg') }} |
||||
{% endif %} |
||||
</p> |
||||
</div> |
||||
|
||||
{% if function('get_field', 'old', pet_id) %} |
||||
<div class="cabinet-card__element"> |
||||
<p class="cabinet-card__label">{{ pll_e('Age') }}:</p> |
||||
<p class="cabinet-card__text"> |
||||
{% set age_key = function('get_field', 'old', pet_id) %} |
||||
{% 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 == 'very_old' %}{{ pll_e('Aging (12 years and older)') }} |
||||
{% elseif age_key == 'baby' %}{{ pll_e('Baby (from 0 to 1 year)') }} |
||||
{% endif %} |
||||
</p> |
||||
</div> |
||||
{% else %} |
||||
{% set month = function('get_field', 'month', pet_id) %} |
||||
{% set zero = month < 10 ? '0' : '' %} |
||||
<div class="cabinet-card__element"> |
||||
<p class="cabinet-card__label">{{ pll_e('Birthday') }}:</p> |
||||
<p class="cabinet-card__text"> |
||||
{{ function('get_field', 'day', pet_id) }}.{{ zero }}{{ month }}.{{ function('get_field', 'year', pet_id) }} |
||||
</p> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
<div class="cabinet-card__element"> |
||||
<p class="cabinet-card__label">{{ pll_e('Activity') }}:</p> |
||||
<p class="cabinet-card__text"> |
||||
{% set activity_key = function('get_field', 'activity', pet_id) %} |
||||
{% if activity_key == 'low' %}{{ pll_e('Low') }} |
||||
{% elseif activity_key == 'moderate' %}{{ pll_e('Moderate') }} |
||||
{% elseif activity_key == 'high' %}{{ pll_e('High') }} |
||||
{% endif %} |
||||
</p> |
||||
</div> |
||||
|
||||
{% if function('get_field', 'type', pet_id) == 'cat' and function('get_field', 'sterilized', pet_id) %} |
||||
<div class="cabinet-card__element"> |
||||
<p class="cabinet-card__label">{{ pll_e('Sterilized') }}</p> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
<div class="cabinet-card__element"> |
||||
<button class="cabinet-card__button" data-edit="{{ pet_id }}"> |
||||
{{ pll_e('Edit') }} |
||||
</button> |
||||
</div> |
||||
</div> |
||||
</div> |
File diff suppressed because it is too large
Load Diff
@ -1,106 +1,106 @@ |
||||
{% extends 'profile/profile-base.twig' %} |
||||
|
||||
{% block profile_content%} |
||||
<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__content"> |
||||
<p class="cabinet-card__title">{{ function('pll_e', 'Feed subscription') }}</p> |
||||
<div class="cabinet-card__element"> |
||||
<p class="cabinet-card__text">{{ function('pll_e', 'Weekly food delivery for your pet') }}</p> |
||||
</div> |
||||
<div class="cabinet-card__element"> |
||||
<button class="button button--gradient button--high-46 form-sub__btn">{{ function('pll_e', 'Get details') }}</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% if customer_orders %} |
||||
{% for order in customer_orders %} |
||||
{% set meta_data = order.meta_data.order_data %} |
||||
{% set shipping_address = order.get_address('shipping') %} |
||||
<div class="cabinet-card cabinet-card--grey"> |
||||
<div class="cabinet-card__content"> |
||||
<div class="cabinet-card__order"> |
||||
<div class="cabinet-card-order__header"> |
||||
<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__number">{{ order.id }}</p> |
||||
</div> |
||||
<div class="cabinet-card-order__payment"> |
||||
<p class="cabinet-card-order-payment__title">{{ function('pll_e', 'Summary') }}:</p> |
||||
<p class="cabinet-card-order-payment__price">{{ order.get_total() }}</p> |
||||
</div> |
||||
</div> |
||||
<div class="cabinet-card-order__bottom"> |
||||
<div class="cabinet-card-order__content"> |
||||
{% set order_track = meta_data.order_number|default('') %} |
||||
<div class="cabinet-card-order__block-detail"> |
||||
<div class="cabinet-card-order__detail"> |
||||
<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__text"> |
||||
{% if meta_data.office_code %} |
||||
{{ function('pll_e', 'CDEK shipping point') }}<br> |
||||
{{ office_name }} |
||||
{% else %} |
||||
{{ shipping_address.city }} {{ shipping_address.address_1 }} |
||||
{% endif %} |
||||
</p> |
||||
</div> |
||||
<div class="cabinet-card-order-detail__main"> |
||||
<div class="cabinet-card-order-detail-main__products"> |
||||
{% for item in order.get_items %} |
||||
{% 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') %} |
||||
<div class="cabinet-card-order-detail-main__product"> |
||||
<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__description"> |
||||
<p class="cabinet-card-order-detail-main-product-description__what">{{ item.name }}</p> |
||||
</div> |
||||
<p class="cabinet-card-order-detail-main-product__count">{{ item.quantity }}</p> |
||||
<p class="cabinet-card-order-detail-main-product__price">{{ item.total }} {{ function('get_woocommerce_currency_symbol', code) }}</p> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<div class="cabinet-card-order-detail-main__links"> |
||||
{% 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"> |
||||
{{ function('pll_e', 'Track order') }} |
||||
</a> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<button class="cabinet-card-order__open-detail">{{ function('pll_e', 'Order details') }}</button> |
||||
</div> |
||||
<div class="cabinet-card-order__detail-short"> |
||||
{% for item in order.get_items %} |
||||
{% 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') %} |
||||
{% if thumbnail %} |
||||
<a href="{{ product.permalink }}"><img src="{{ thumbnail }}" alt="" class="cabinet-card-order-detail-short__item"></a> |
||||
{% endif %} |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
{% else %} |
||||
<div class="cabinet-card__no-orders"> |
||||
<div class="cabinet-card-no-orders__element"> |
||||
<p class="cabinet-card-no-orders__title">{{ function('pll_e', 'No orders yet') }}</p> |
||||
</div> |
||||
<div class="cabinet-card-no-orders__element"> |
||||
<a href="/shop/" class="to-know button--100-perc to-know--background-none"> |
||||
<p>{{ function('pll_e', 'Catalog') }}</p> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
{% extends 'profile/profile-base.twig' %} |
||||
|
||||
{% block profile_content%} |
||||
<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__content"> |
||||
<p class="cabinet-card__title">{{ function('pll_e', 'Feed subscription') }}</p> |
||||
<div class="cabinet-card__element"> |
||||
<p class="cabinet-card__text">{{ function('pll_e', 'Weekly food delivery for your pet') }}</p> |
||||
</div> |
||||
<div class="cabinet-card__element"> |
||||
<button class="button button--gradient button--high-46 form-sub__btn">{{ function('pll_e', 'Get details') }}</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% if customer_orders %} |
||||
{% for order in customer_orders %} |
||||
{% set meta_data = order.meta_data.order_data %} |
||||
{% set shipping_address = order.get_address('shipping') %} |
||||
<div class="cabinet-card cabinet-card--grey"> |
||||
<div class="cabinet-card__content"> |
||||
<div class="cabinet-card__order"> |
||||
<div class="cabinet-card-order__header"> |
||||
<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__number">{{ order.id }}</p> |
||||
</div> |
||||
<div class="cabinet-card-order__payment"> |
||||
<p class="cabinet-card-order-payment__title">{{ function('pll_e', 'Summary') }}:</p> |
||||
<p class="cabinet-card-order-payment__price">{{ order.get_total() }}</p> |
||||
</div> |
||||
</div> |
||||
<div class="cabinet-card-order__bottom"> |
||||
<div class="cabinet-card-order__content"> |
||||
{% set order_track = meta_data.order_number|default('') %} |
||||
<div class="cabinet-card-order__block-detail"> |
||||
<div class="cabinet-card-order__detail"> |
||||
<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__text"> |
||||
{% if meta_data.office_code %} |
||||
{{ function('pll_e', 'CDEK shipping point') }}<br> |
||||
{{ office_name }} |
||||
{% else %} |
||||
{{ shipping_address.city }} {{ shipping_address.address_1 }} |
||||
{% endif %} |
||||
</p> |
||||
</div> |
||||
<div class="cabinet-card-order-detail__main"> |
||||
<div class="cabinet-card-order-detail-main__products"> |
||||
{% for item in order.get_items %} |
||||
{% 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') %} |
||||
<div class="cabinet-card-order-detail-main__product"> |
||||
<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__description"> |
||||
<p class="cabinet-card-order-detail-main-product-description__what">{{ item.name }}</p> |
||||
</div> |
||||
<p class="cabinet-card-order-detail-main-product__count">{{ item.quantity }}</p> |
||||
<p class="cabinet-card-order-detail-main-product__price">{{ item.total }} {{ function('get_woocommerce_currency_symbol', code) }}</p> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<div class="cabinet-card-order-detail-main__links"> |
||||
{% 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"> |
||||
{{ function('pll_e', 'Track order') }} |
||||
</a> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<button class="cabinet-card-order__open-detail">{{ function('pll_e', 'Order details') }}</button> |
||||
</div> |
||||
<div class="cabinet-card-order__detail-short"> |
||||
{% for item in order.get_items %} |
||||
{% 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') %} |
||||
{% if thumbnail %} |
||||
<a href="{{ product.permalink }}"><img src="{{ thumbnail }}" alt="" class="cabinet-card-order-detail-short__item"></a> |
||||
{% endif %} |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
{% else %} |
||||
<div class="cabinet-card__no-orders"> |
||||
<div class="cabinet-card-no-orders__element"> |
||||
<p class="cabinet-card-no-orders__title">{{ function('pll_e', 'No orders yet') }}</p> |
||||
</div> |
||||
<div class="cabinet-card-no-orders__element"> |
||||
<a href="/shop/" class="to-know button--100-perc to-know--background-none"> |
||||
<p>{{ function('pll_e', 'Catalog') }}</p> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
{% endblock %} |
@ -1,133 +1,133 @@ |
||||
{% extends 'profile/profile-base.twig' %} |
||||
|
||||
{% block profile_content %} |
||||
|
||||
<div class="cabinet__orders cabinet__orders--no-cab cabinet-content active hide"> |
||||
{% if subscription %} |
||||
<div class="cabinet-card cabinet-card--grey"> |
||||
<div class="cabinet-card__content"> |
||||
<div class="cabinet-card__order"> |
||||
<div class="cabinet-card-order__header"> |
||||
<div class="cabinet-card-order__main"> |
||||
<p class="cabinet-card-order-main__date"> |
||||
{{ fn('pll_e', 'Подписка №') }} {{ subscription.id }} |
||||
</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="subscription"> |
||||
<div class="subscription__item"> |
||||
<p>{{ fn('pll_e', 'Статус') }}</p> |
||||
<p class="subscription__status--end">{{ subscription.status | capitalize }}</p> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<p>{{ fn('pll_e', 'Дата подписки') }}</p> |
||||
<p>{{ subscription.date_created | date('d.m.Y') }}</p> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<p>{{ fn('pll_e', 'Дата последнего заказа') }}</p> |
||||
<p>{{ subscription.last_order_date | date('d.m.Y') }}</p> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<p>{{ fn('pll_e', 'Следующий платеж') }}</p> |
||||
<p>{{ subscription.next_payment_date | date('d.m.Y')}}</p> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<p>{{ fn('pll_e', 'Способ оплаты') }}</p> |
||||
<p>{{ subscription.payment_method_title}}</p> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<div class="subscription__add"> |
||||
<div class="subscription__add-header"> |
||||
<p class="subscription__add-title">{{ fn('pll_e', 'Товары:') }}</p> |
||||
</div> |
||||
<div class="subscription__add-content"> |
||||
{% for item in subscription.items %} |
||||
{% set product = item.product %} |
||||
{% set image_id = product.image_id %} |
||||
{% set product_permalink = product.id ? fn('get_permalink', product.id) : '' %} |
||||
{# 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> |
||||
<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')) %} |
||||
<a href="{{ product_permalink }}"> |
||||
<img src="{{ image_id | wp_get_attachment_image_src('thumbnail') | default('assets/img/product/mini-card.png') }}" |
||||
alt="{{ product.name }}" |
||||
class="cabinet-card-order-detail-main-product__img"> |
||||
</a> |
||||
{% else %} |
||||
<img src="{{ image_id | wp_get_attachment_image_src('thumbnail') | default('assets/img/product/mini-card.png') }}" |
||||
alt="{{ product.name }}" |
||||
class="cabinet-card-order-detail-main-product__img"> |
||||
{% endif %} |
||||
<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__with-what">{{ product.variation_details | default('') }}</p> |
||||
</div> |
||||
<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__price">{{ item.total }}</p> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<p>{{ fn('pll_e', 'Сумма') }}</p> |
||||
<p><span>{{ subscription.total }} {{ subscription.currency }} <small>/ {{ fn('pll_e', 'месяц') }}</small></span></p> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<p>{{ fn('pll_e', 'Доставка') }}</p> |
||||
<p>{{ fn('pll_e', 'Бесплатно') }}</p> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<p>{{ fn('pll_e', 'Итого') }}</p> |
||||
<p><span>{{ subscription.total }} {{ subscription.currency }} <small>/ {{ fn('pll_e', 'месяц') }}</small></span></p> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<div class="subscription__add"> |
||||
<div class="subscription__add-header"> |
||||
<p class="subscription__add-title">{{ fn('pll_e', 'Доставка:') }}</p> |
||||
</div> |
||||
<div class="subscription__add-content" data-js-tabs=""> |
||||
<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__element"> |
||||
<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"> |
||||
<span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Адрес введен неверно') }}</span> |
||||
</div> |
||||
</div> |
||||
<div class="modal-form-content__line"> |
||||
<div class="modal-form-content-line__element"> |
||||
<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> |
||||
<span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Комментарий введен неверно') }}</span> |
||||
</div> |
||||
</div> |
||||
<input type="hidden" name="subscription_id" value="{{ subscription.id }}"> |
||||
<input type="hidden" name="address_nonce" value="{{ fn('wp_create_nonce', 'update_subscription_address') }}"> |
||||
<div class="modal-form-content__line"> |
||||
<button type="submit" style="width: 100%;" class="button button--gradient button--high-46">{{ fn('pll_e', 'Сохранить') }}</button> |
||||
</div> |
||||
<div class="form-message" style="display: none;"></div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<a href="{{ subscription.cancel_url }}" class="to-know to-know--start button--100-perc to-know--background-none"> |
||||
<p>{{ fn('pll_e', 'Отменить подписку') }}</p> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
{% else %} |
||||
<div class="cabinet-card-no-orders__element"> |
||||
<p>{{ fn('pll_e', 'Подписка не найдена.') }}</p> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{% extends 'profile/profile-base.twig' %} |
||||
|
||||
{% block profile_content %} |
||||
|
||||
<div class="cabinet__orders cabinet__orders--no-cab cabinet-content active hide"> |
||||
{% if subscription %} |
||||
<div class="cabinet-card cabinet-card--grey"> |
||||
<div class="cabinet-card__content"> |
||||
<div class="cabinet-card__order"> |
||||
<div class="cabinet-card-order__header"> |
||||
<div class="cabinet-card-order__main"> |
||||
<p class="cabinet-card-order-main__date"> |
||||
{{ fn('pll_e', 'Подписка №') }} {{ subscription.id }} |
||||
</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="subscription"> |
||||
<div class="subscription__item"> |
||||
<p>{{ fn('pll_e', 'Статус') }}</p> |
||||
<p class="subscription__status--end">{{ subscription.status | capitalize }}</p> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<p>{{ fn('pll_e', 'Дата подписки') }}</p> |
||||
<p>{{ subscription.date_created | date('d.m.Y') }}</p> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<p>{{ fn('pll_e', 'Дата последнего заказа') }}</p> |
||||
<p>{{ subscription.last_order_date | date('d.m.Y') }}</p> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<p>{{ fn('pll_e', 'Следующий платеж') }}</p> |
||||
<p>{{ subscription.next_payment_date | date('d.m.Y')}}</p> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<p>{{ fn('pll_e', 'Способ оплаты') }}</p> |
||||
<p>{{ subscription.payment_method_title}}</p> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<div class="subscription__add"> |
||||
<div class="subscription__add-header"> |
||||
<p class="subscription__add-title">{{ fn('pll_e', 'Товары:') }}</p> |
||||
</div> |
||||
<div class="subscription__add-content"> |
||||
{% for item in subscription.items %} |
||||
{% set product = item.product %} |
||||
{% set image_id = product.image_id %} |
||||
{% set product_permalink = product.id ? fn('get_permalink', product.id) : '' %} |
||||
{# 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> |
||||
<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')) %} |
||||
<a href="{{ product_permalink }}"> |
||||
<img src="{{ image_id | wp_get_attachment_image_src('thumbnail') | default('assets/img/product/mini-card.png') }}" |
||||
alt="{{ product.name }}" |
||||
class="cabinet-card-order-detail-main-product__img"> |
||||
</a> |
||||
{% else %} |
||||
<img src="{{ image_id | wp_get_attachment_image_src('thumbnail') | default('assets/img/product/mini-card.png') }}" |
||||
alt="{{ product.name }}" |
||||
class="cabinet-card-order-detail-main-product__img"> |
||||
{% endif %} |
||||
<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__with-what">{{ product.variation_details | default('') }}</p> |
||||
</div> |
||||
<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__price">{{ item.total }}</p> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<p>{{ fn('pll_e', 'Сумма') }}</p> |
||||
<p><span>{{ subscription.total }} {{ subscription.currency }} <small>/ {{ fn('pll_e', 'месяц') }}</small></span></p> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<p>{{ fn('pll_e', 'Доставка') }}</p> |
||||
<p>{{ fn('pll_e', 'Бесплатно') }}</p> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<p>{{ fn('pll_e', 'Итого') }}</p> |
||||
<p><span>{{ subscription.total }} {{ subscription.currency }} <small>/ {{ fn('pll_e', 'месяц') }}</small></span></p> |
||||
</div> |
||||
<div class="subscription__item"> |
||||
<div class="subscription__add"> |
||||
<div class="subscription__add-header"> |
||||
<p class="subscription__add-title">{{ fn('pll_e', 'Доставка:') }}</p> |
||||
</div> |
||||
<div class="subscription__add-content" data-js-tabs=""> |
||||
<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__element"> |
||||
<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"> |
||||
<span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Адрес введен неверно') }}</span> |
||||
</div> |
||||
</div> |
||||
<div class="modal-form-content__line"> |
||||
<div class="modal-form-content-line__element"> |
||||
<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> |
||||
<span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Комментарий введен неверно') }}</span> |
||||
</div> |
||||
</div> |
||||
<input type="hidden" name="subscription_id" value="{{ subscription.id }}"> |
||||
<input type="hidden" name="address_nonce" value="{{ fn('wp_create_nonce', 'update_subscription_address') }}"> |
||||
<div class="modal-form-content__line"> |
||||
<button type="submit" style="width: 100%;" class="button button--gradient button--high-46">{{ fn('pll_e', 'Сохранить') }}</button> |
||||
</div> |
||||
<div class="form-message" style="display: none;"></div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<a href="{{ subscription.cancel_url }}" class="to-know to-know--start button--100-perc to-know--background-none"> |
||||
<p>{{ fn('pll_e', 'Отменить подписку') }}</p> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
{% else %} |
||||
<div class="cabinet-card-no-orders__element"> |
||||
<p>{{ fn('pll_e', 'Подписка не найдена.') }}</p> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{% endblock %} |
@ -1,78 +1,78 @@ |
||||
{% extends 'profile/profile-base.twig' %} |
||||
|
||||
{% block profile_content %} |
||||
<div class="cabinet__orders cabinet__orders--no-cab cabinet-content active hide"> |
||||
{% for subscription in subscriptions %} |
||||
<div class="cabinet-card cabinet-card--grey"> |
||||
<div class="cabinet-card__content"> |
||||
<div class="cabinet-card__order"> |
||||
<div class="cabinet-card-order__header"> |
||||
<div class="cabinet-card-order__main"> |
||||
<p class="cabinet-card-order-main__date"> |
||||
{% if subscription.view_url %} |
||||
<a href="{{ subscription.view_url }}">{{ fn('pll_e', 'Подписка от') }} {{ subscription.date_created | date('d.m.Y') }}</a> |
||||
{% else %} |
||||
{{ fn('pll_e', 'Подписка от') }} {{ subscription.date_created | date('d.m.Y') }} |
||||
{% endif %} |
||||
</p> |
||||
<p class="cabinet-card-order-main__number"> |
||||
{{ subscription.id }} |
||||
</p> |
||||
</div> |
||||
<div class="cabinet-card-order__payment"> |
||||
<p class="cabinet-card-order-payment__title">{{ fn('pll_e', 'Сумма:') }}</p> |
||||
<p class="cabinet-card-order-payment__price cabinet-card-order-payment__price--add"> |
||||
{{ subscription.total }} {{ subscription.currency }} <span>/ {{ subscription.billing_period }}</span> |
||||
</p> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="cabinet-card-order__content"> |
||||
<div class="cabinet-card-order__payment-add"> |
||||
<p class="cabinet-card-order__sub-title"> |
||||
{{ fn('pll_e', 'Следующий платеж:') }} |
||||
</p> |
||||
<p class="cabinet-card-order__date"> |
||||
{{ subscription.next_payment_date | date('d.m.Y') }} |
||||
</p> |
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
|
||||
<div class="cabinet-card-order__detail-short mt-m-3"> |
||||
{% for item in subscription.items %} |
||||
{% set product = item.product %} |
||||
{% set image_id = product.image_id %} |
||||
{% if product.permalink %} |
||||
<a href="{{ product.permalink }}"> |
||||
<img src="{{ image_id | wp_get_attachment_image_src('thumbnail') | default('assets/img/product/mini-card.png') }}" |
||||
alt="{{ product.name }}" |
||||
class="cabinet-card-order-detail-short__item"> |
||||
</a> |
||||
{% else %} |
||||
<img src="{{ image_id | wp_get_attachment_image_src('thumbnail') | default('assets/img/product/mini-card.png') }}" |
||||
alt="{{ product.name }}" |
||||
class="cabinet-card-order-detail-short__item"> |
||||
{% endif %} |
||||
{% endfor %} |
||||
</div> |
||||
<div class="cabinet-card-order__link"> |
||||
{% if subscription.view_url %} |
||||
<a href="{{ subscription.view_url }}" class="to-know to-know--start button--100-perc to-know--background-none"> |
||||
<p>{{ fn('pll_e', 'Детали подписки') }}</p> |
||||
</a> |
||||
{% else %} |
||||
<p class="to-know to-know--start button--100-perc to-know--background-none disabled"> |
||||
{{ fn('pll_e', 'Детали недоступны') }} |
||||
</p> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% else %} |
||||
<p>{{ fn('pll_e', 'У вас нет активных подписок.') }}</p> |
||||
{% endfor %} |
||||
</div> |
||||
{% extends 'profile/profile-base.twig' %} |
||||
|
||||
{% block profile_content %} |
||||
<div class="cabinet__orders cabinet__orders--no-cab cabinet-content active hide"> |
||||
{% for subscription in subscriptions %} |
||||
<div class="cabinet-card cabinet-card--grey"> |
||||
<div class="cabinet-card__content"> |
||||
<div class="cabinet-card__order"> |
||||
<div class="cabinet-card-order__header"> |
||||
<div class="cabinet-card-order__main"> |
||||
<p class="cabinet-card-order-main__date"> |
||||
{% if subscription.view_url %} |
||||
<a href="{{ subscription.view_url }}">{{ fn('pll_e', 'Подписка от') }} {{ subscription.date_created | date('d.m.Y') }}</a> |
||||
{% else %} |
||||
{{ fn('pll_e', 'Подписка от') }} {{ subscription.date_created | date('d.m.Y') }} |
||||
{% endif %} |
||||
</p> |
||||
<p class="cabinet-card-order-main__number"> |
||||
{{ subscription.id }} |
||||
</p> |
||||
</div> |
||||
<div class="cabinet-card-order__payment"> |
||||
<p class="cabinet-card-order-payment__title">{{ fn('pll_e', 'Сумма:') }}</p> |
||||
<p class="cabinet-card-order-payment__price cabinet-card-order-payment__price--add"> |
||||
{{ subscription.total }} {{ subscription.currency }} <span>/ {{ subscription.billing_period }}</span> |
||||
</p> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="cabinet-card-order__content"> |
||||
<div class="cabinet-card-order__payment-add"> |
||||
<p class="cabinet-card-order__sub-title"> |
||||
{{ fn('pll_e', 'Следующий платеж:') }} |
||||
</p> |
||||
<p class="cabinet-card-order__date"> |
||||
{{ subscription.next_payment_date | date('d.m.Y') }} |
||||
</p> |
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
|
||||
<div class="cabinet-card-order__detail-short mt-m-3"> |
||||
{% for item in subscription.items %} |
||||
{% set product = item.product %} |
||||
{% set image_id = product.image_id %} |
||||
{% if product.permalink %} |
||||
<a href="{{ product.permalink }}"> |
||||
<img src="{{ image_id | wp_get_attachment_image_src('thumbnail') | default('assets/img/product/mini-card.png') }}" |
||||
alt="{{ product.name }}" |
||||
class="cabinet-card-order-detail-short__item"> |
||||
</a> |
||||
{% else %} |
||||
<img src="{{ image_id | wp_get_attachment_image_src('thumbnail') | default('assets/img/product/mini-card.png') }}" |
||||
alt="{{ product.name }}" |
||||
class="cabinet-card-order-detail-short__item"> |
||||
{% endif %} |
||||
{% endfor %} |
||||
</div> |
||||
<div class="cabinet-card-order__link"> |
||||
{% if subscription.view_url %} |
||||
<a href="{{ subscription.view_url }}" class="to-know to-know--start button--100-perc to-know--background-none"> |
||||
<p>{{ fn('pll_e', 'Детали подписки') }}</p> |
||||
</a> |
||||
{% else %} |
||||
<p class="to-know to-know--start button--100-perc to-know--background-none disabled"> |
||||
{{ fn('pll_e', 'Детали недоступны') }} |
||||
</p> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% else %} |
||||
<p>{{ fn('pll_e', 'У вас нет активных подписок.') }}</p> |
||||
{% endfor %} |
||||
</div> |
||||
{% endblock %} |
@ -1,415 +1,415 @@ |
||||
{% set profile_pg = 1 %} |
||||
|
||||
{% extends 'profile/profile-base.twig' %} |
||||
|
||||
{% block profile_content%} |
||||
<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__content"> |
||||
<p class="cabinet-card__title">{{ function('pll_e', 'Feed subscription') }}</p> |
||||
<div class="cabinet-card__element"> |
||||
<p class="cabinet-card__text">{{ function('pll_e', 'Weekly food delivery for your pet') }}</p> |
||||
</div> |
||||
<div class="cabinet-card__element"> |
||||
<button class="button button--gradient button--high-46 form-sub__btn">{{ function('pll_e', 'Get details') }}</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% if customer_orders %} |
||||
{% for order in customer_orders %} |
||||
{% set meta_data = order.meta_data.order_data %} |
||||
{% set shipping_address = order.get_address('shipping') %} |
||||
<div class="cabinet-card cabinet-card--grey"> |
||||
<div class="cabinet-card__content"> |
||||
<div class="cabinet-card__order"> |
||||
<div class="cabinet-card-order__header"> |
||||
<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__number">{{ order.id }}</p> |
||||
</div> |
||||
<div class="cabinet-card-order__payment"> |
||||
<p class="cabinet-card-order-payment__title">{{ function('pll_e', 'Summary') }}:</p> |
||||
<p class="cabinet-card-order-payment__price">{{ order.get_total() }}</p> |
||||
</div> |
||||
</div> |
||||
<div class="cabinet-card-order__bottom"> |
||||
<div class="cabinet-card-order__content"> |
||||
{% set order_track = meta_data.order_number|default('') %} |
||||
<div class="cabinet-card-order__block-detail"> |
||||
<div class="cabinet-card-order__detail"> |
||||
<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__text"> |
||||
{% if meta_data.office_code %} |
||||
{{ function('pll_e', 'CDEK shipping point') }}<br> |
||||
{{ office_name }} |
||||
{% else %} |
||||
{{ shipping_address.city }} {{ shipping_address.address_1 }} |
||||
{% endif %} |
||||
</p> |
||||
</div> |
||||
<div class="cabinet-card-order-detail__main"> |
||||
<div class="cabinet-card-order-detail-main__products"> |
||||
{% for item in order.get_items %} |
||||
{% 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') %} |
||||
<div class="cabinet-card-order-detail-main__product"> |
||||
<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__description"> |
||||
<p class="cabinet-card-order-detail-main-product-description__what">{{ item.name }}</p> |
||||
</div> |
||||
<p class="cabinet-card-order-detail-main-product__count">{{ item.quantity }}</p> |
||||
<p class="cabinet-card-order-detail-main-product__price">{{ item.total }} {{ function('get_woocommerce_currency_symbol', code) }}</p> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<div class="cabinet-card-order-detail-main__links"> |
||||
{% 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"> |
||||
{{ function('pll_e', 'Track order') }} |
||||
</a> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<button class="cabinet-card-order__open-detail">{{ function('pll_e', 'Order details') }}</button> |
||||
</div> |
||||
<div class="cabinet-card-order__detail-short"> |
||||
{% for item in order.get_items %} |
||||
{% 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') %} |
||||
{% if thumbnail %} |
||||
<a href="{{ product.permalink }}"><img src="{{ thumbnail }}" alt="" class="cabinet-card-order-detail-short__item"></a> |
||||
{% endif %} |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
{% else %} |
||||
<div class="cabinet-card__no-orders"> |
||||
<div class="cabinet-card-no-orders__element"> |
||||
<p class="cabinet-card-no-orders__title">{{ function('pll_e', 'No orders yet') }}</p> |
||||
</div> |
||||
<div class="cabinet-card-no-orders__element"> |
||||
<a href="/shop/" class="to-know button--100-perc to-know--background-none"> |
||||
<p>{{ function('pll_e', 'Catalog') }}</p> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
|
||||
{% endblock %} |
||||
|
||||
</main> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="modalProfile" id="pet_add_form"> |
||||
<div class="popup-wrap"> |
||||
<div class="modal-form form__full-mobile modal-form--white modal-form--height-100-phone form-pet active"> |
||||
<button class="modal-form__close"></button> |
||||
<p class="modal-form__title">{{ fn('pll_e', 'Добавить питомца') }}</p> |
||||
|
||||
<form class="modal-form__content" id="add-pet-form" method="post" action=""> |
||||
<input type="hidden" name="action" value="add_pet"> |
||||
<div class="modal-form-content__line"> |
||||
<label for="" class="label-name">{{ fn('pll_e', 'Вид животного') }}</label> |
||||
<div class="form-input__tabs"> |
||||
<label for="cat" class="form-input-tabs__button active"> |
||||
{{ fn('pll_e', 'Кошка') }} |
||||
<input type="radio" value="cat" checked name="pet" id="cat" class="form-input-tabs__input"> |
||||
</label> |
||||
|
||||
<label for="dog" class="form-input-tabs__button"> |
||||
{{ fn('pll_e', 'Собака') }} |
||||
<input type="radio" value="dog" name="pet" id="dog" class="form-input-tabs__input"> |
||||
</label> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content__line sterilized"> |
||||
<label for="" class="label-name">{{ fn('pll_e', 'Стерелизован') }}</label> |
||||
|
||||
<div class="form-input__tabs"> |
||||
<label class="form-input-tabs__button active"> |
||||
{{ fn('pll_e', 'Да') }} |
||||
<input type="radio" value="1" checked name="sterilized" class="form-input-tabs__input"> |
||||
</label> |
||||
|
||||
<label class="form-input-tabs__button"> |
||||
{{ fn('pll_e', 'Нет') }} |
||||
<input type="radio" value="0" name="sterilized" class="form-input-tabs__input"> |
||||
</label> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content__line"> |
||||
<div class="modal-form-content-line__element"> |
||||
<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> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content__line"> |
||||
<div class="modal-form-content-line__element"> |
||||
<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> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content__line"> |
||||
<label for="" class="label-name">{{ fn('pll_e', 'Пол вашего питомца') }}</label> |
||||
|
||||
<div class="form-input__tabs"> |
||||
<label for="boy" class="form-input-tabs__button active"> |
||||
{{ fn('pll_e', 'Мальчик') }} |
||||
<input type="radio" value="male" checked name="sex" id="boy" class="form-input-tabs__input"> |
||||
</label> |
||||
|
||||
<label for="girl" class="form-input-tabs__button"> |
||||
{{ fn('pll_e', 'Девочка') }} |
||||
<input type="radio" value="female" name="sex" id="girl" class="form-input-tabs__input"> |
||||
</label> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content__line modal-form-content__line--two"> |
||||
<div class="modal-form-content-line__element"> |
||||
<label class="label-name">{{ fn('pll_e', 'Вид активности') }}</label> |
||||
<div class="form-input__list"> |
||||
<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__content"> |
||||
<label class="form-input-list__item"> |
||||
<p class="form-input-list-item__text">{{ fn('pll_e', 'Низкая') }}</p> |
||||
<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__content"> |
||||
<img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt=""> |
||||
</div> |
||||
</div> |
||||
</label> |
||||
<label class="form-input-list__item"> |
||||
<p class="form-input-list-item__text">{{ fn('pll_e', 'Средняя') }}</p> |
||||
<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__content"> |
||||
<img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt=""> |
||||
</div> |
||||
</div> |
||||
</label> |
||||
<label class="form-input-list__item"> |
||||
<p class="form-input-list-item__text">{{ fn('pll_e', 'Высокая') }}</p> |
||||
<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__content"> |
||||
<img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt=""> |
||||
</div> |
||||
</div> |
||||
</label> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content-line__element"> |
||||
<label for="firstname" class="label-name">{{ fn('pll_e', 'Вес') }}</label> |
||||
<div class="form-input__list"> |
||||
<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__content"> |
||||
{% for weight in [ |
||||
{value: 'below_1_5', text: fn('pll_e', '1-1.5 кг')}, |
||||
{value: '1_5-3', text: fn('pll_e', '1.5-3 кг')}, |
||||
{value: '3-5', text: fn('pll_e', '3-5 кг')}, |
||||
{value: '5-8', text: fn('pll_e', '5-8 кг')}, |
||||
{value: '8-11', text: fn('pll_e', '8-11 кг')}, |
||||
{value: '11-15', text: fn('pll_e', '11-15 кг')}, |
||||
{value: '15-20', text: fn('pll_e', '10-20кг')}, |
||||
{value: '20-25', text: fn('pll_e', '20-25кг')}, |
||||
{value: '25-35', text: fn('pll_e', '25-35 кг')}, |
||||
{value: 'more_35', text: fn('pll_e', 'Более 35 кг')} |
||||
] %} |
||||
<label class="form-input-list__item"> |
||||
<p class="form-input-list-item__text">{{ weight.text }}</p> |
||||
<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__content"> |
||||
<img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt=""> |
||||
</div> |
||||
</div> |
||||
</label> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="rm"> |
||||
<div class="modal-form-content__line"> |
||||
<label class="label-name">{{ fn('pll_e', 'Возраст питомца') }}</label> |
||||
<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"> |
||||
{{ fn('pll_e', 'Примерный') }} |
||||
<input type="radio" checked value="ex" name="old_type" required id="exemplary" class="form-input-tabs__input"> |
||||
</label> |
||||
|
||||
<label class="form-input-tabs__button" data-rm="1"> |
||||
{{ fn('pll_e', 'Точный') }} |
||||
<input type="radio" value="acc" name="old_type" required id="accurate" class="form-input-tabs__input"> |
||||
</label> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal__age"> |
||||
<div class="form-input__radio remote-control__item active" data-rmcont="0"> |
||||
{% for age in [ |
||||
{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: 'old', title: fn('pll_e', 'Пожилой'), desc: fn('pll_e', '(от 7 до 12 лет)')}, |
||||
{value: 'very_old', title: fn('pll_e', 'Стареющий'), desc: fn('pll_e', '(от 12 лет и старше)')} |
||||
] %} |
||||
<label class="form-input-radio__item {{ loop.first ? 'active' : '' }}"> |
||||
<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__content"></div> |
||||
</div> |
||||
<p class="form-input-radio__title">{{ age.title }} <span>{{ age.desc }}</span></p> |
||||
</label> |
||||
{% endfor %} |
||||
</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 class="modal-form-content-line__element"> |
||||
<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', 'ДД') }}"> |
||||
</div> |
||||
|
||||
<div class="modal-form-content-line__element"> |
||||
<label for="firstname" class="label-name">{{ fn('pll_e', 'Месяц') }}</label> |
||||
<div class="form-input__list"> |
||||
<div class="form-input-list__input">{{ fn('pll_e', 'Месяц') }}</div> |
||||
<div class="form-input-list__block-content"> |
||||
<div class="form-input-list__content"> |
||||
{% for month in [ |
||||
{value: 1, text: fn('pll_e', 'Январь')}, |
||||
{value: 2, text: fn('pll_e', 'Февраль')}, |
||||
{value: 3, text: fn('pll_e', 'Март')}, |
||||
{value: 4, text: fn('pll_e', 'Апрель')}, |
||||
{value: 5, text: fn('pll_e', 'Май')}, |
||||
{value: 6, text: fn('pll_e', 'Июнь')}, |
||||
{value: 7, text: fn('pll_e', 'Июль')}, |
||||
{value: 8, text: fn('pll_e', 'Август')}, |
||||
{value: 9, text: fn('pll_e', 'Сентябрь')}, |
||||
{value: 10, text: fn('pll_e', 'Октябрь')}, |
||||
{value: 11, text: fn('pll_e', 'Ноябрь')}, |
||||
{value: 12, text: fn('pll_e', 'Декабрь')} |
||||
] %} |
||||
<label class="form-input-list__item"> |
||||
<p class="form-input-list-item__text">{{ month.text }}</p> |
||||
<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__content"> |
||||
<img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt=""> |
||||
</div> |
||||
</div> |
||||
</label> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content-line__element"> |
||||
<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', 'ГГГГ') }}"> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form__buttons"> |
||||
<button class="button button--gradient button--high button--100-perc" type="submit">{{ fn('pll_e', 'Добавить') }}</button> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modalProfile" id="subForm"> |
||||
<div class="popup-wrap"> |
||||
<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> |
||||
<p class="modal-form__title modal-form__title--white">Подписка на корм</p> |
||||
|
||||
<div class="modal-form__element modal-form__element--top-40"> |
||||
<p class="modal-form__text modal-form__text--white"> |
||||
Спасибо за интерес к нашему новому виду услуг, данная функция находится в разработке, если вы хотите узнать первыми о запуске подпишитесь на рассылку. |
||||
</p> |
||||
</div> |
||||
|
||||
<form class="modal-form__element modal-form__element--top-40 foodSub"> |
||||
<input type="hidden" name="email" value="{{ user.user_email }}"> |
||||
<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> |
||||
<button class="button form__button-mobile button--white button--100-perc open-overlay button--high"> |
||||
Хочу быть первым! |
||||
</button> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modalProfile" id="user_edit"> |
||||
<div class="popup-wrap"> |
||||
<div class="modal-form form__full-mobile modal-form--white modal-form--height-100-phone form-data active"> |
||||
<button class="modal-form__close"></button> |
||||
<p class="modal-form__title">Изменить мои данные</p> |
||||
|
||||
<form class="modal-form__content user-edit-form" method="post"> |
||||
<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__element"> |
||||
<label for="firstname" class="label-name">Имя</label> |
||||
<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> |
||||
</div> |
||||
|
||||
<div class="modal-form-content-line__element"> |
||||
<label for="lastname" class="label-name">Фамилия</label> |
||||
<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> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content__line"> |
||||
<label class="label-name">Телефон</label> |
||||
<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> |
||||
<div class="form-input__error form-input__error--absolute">Номер введён неверно</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form__buttons modal-form__buttons--two"> |
||||
<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="Отмена"> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
{% endblock %} |
||||
{% set profile_pg = 1 %} |
||||
|
||||
{% extends 'profile/profile-base.twig' %} |
||||
|
||||
{% block profile_content%} |
||||
<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__content"> |
||||
<p class="cabinet-card__title">{{ function('pll_e', 'Feed subscription') }}</p> |
||||
<div class="cabinet-card__element"> |
||||
<p class="cabinet-card__text">{{ function('pll_e', 'Weekly food delivery for your pet') }}</p> |
||||
</div> |
||||
<div class="cabinet-card__element"> |
||||
<button class="button button--gradient button--high-46 form-sub__btn">{{ function('pll_e', 'Get details') }}</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% if customer_orders %} |
||||
{% for order in customer_orders %} |
||||
{% set meta_data = order.meta_data.order_data %} |
||||
{% set shipping_address = order.get_address('shipping') %} |
||||
<div class="cabinet-card cabinet-card--grey"> |
||||
<div class="cabinet-card__content"> |
||||
<div class="cabinet-card__order"> |
||||
<div class="cabinet-card-order__header"> |
||||
<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__number">{{ order.id }}</p> |
||||
</div> |
||||
<div class="cabinet-card-order__payment"> |
||||
<p class="cabinet-card-order-payment__title">{{ function('pll_e', 'Summary') }}:</p> |
||||
<p class="cabinet-card-order-payment__price">{{ order.get_total() }}</p> |
||||
</div> |
||||
</div> |
||||
<div class="cabinet-card-order__bottom"> |
||||
<div class="cabinet-card-order__content"> |
||||
{% set order_track = meta_data.order_number|default('') %} |
||||
<div class="cabinet-card-order__block-detail"> |
||||
<div class="cabinet-card-order__detail"> |
||||
<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__text"> |
||||
{% if meta_data.office_code %} |
||||
{{ function('pll_e', 'CDEK shipping point') }}<br> |
||||
{{ office_name }} |
||||
{% else %} |
||||
{{ shipping_address.city }} {{ shipping_address.address_1 }} |
||||
{% endif %} |
||||
</p> |
||||
</div> |
||||
<div class="cabinet-card-order-detail__main"> |
||||
<div class="cabinet-card-order-detail-main__products"> |
||||
{% for item in order.get_items %} |
||||
{% 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') %} |
||||
<div class="cabinet-card-order-detail-main__product"> |
||||
<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__description"> |
||||
<p class="cabinet-card-order-detail-main-product-description__what">{{ item.name }}</p> |
||||
</div> |
||||
<p class="cabinet-card-order-detail-main-product__count">{{ item.quantity }}</p> |
||||
<p class="cabinet-card-order-detail-main-product__price">{{ item.total }} {{ function('get_woocommerce_currency_symbol', code) }}</p> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<div class="cabinet-card-order-detail-main__links"> |
||||
{% 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"> |
||||
{{ function('pll_e', 'Track order') }} |
||||
</a> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<button class="cabinet-card-order__open-detail">{{ function('pll_e', 'Order details') }}</button> |
||||
</div> |
||||
<div class="cabinet-card-order__detail-short"> |
||||
{% for item in order.get_items %} |
||||
{% 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') %} |
||||
{% if thumbnail %} |
||||
<a href="{{ product.permalink }}"><img src="{{ thumbnail }}" alt="" class="cabinet-card-order-detail-short__item"></a> |
||||
{% endif %} |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
{% else %} |
||||
<div class="cabinet-card__no-orders"> |
||||
<div class="cabinet-card-no-orders__element"> |
||||
<p class="cabinet-card-no-orders__title">{{ function('pll_e', 'No orders yet') }}</p> |
||||
</div> |
||||
<div class="cabinet-card-no-orders__element"> |
||||
<a href="/shop/" class="to-know button--100-perc to-know--background-none"> |
||||
<p>{{ function('pll_e', 'Catalog') }}</p> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
|
||||
{% endblock %} |
||||
|
||||
</main> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="modalProfile" id="pet_add_form"> |
||||
<div class="popup-wrap"> |
||||
<div class="modal-form form__full-mobile modal-form--white modal-form--height-100-phone form-pet active"> |
||||
<button class="modal-form__close"></button> |
||||
<p class="modal-form__title">{{ fn('pll_e', 'Добавить питомца') }}</p> |
||||
|
||||
<form class="modal-form__content" id="add-pet-form" method="post" action=""> |
||||
<input type="hidden" name="action" value="add_pet"> |
||||
<div class="modal-form-content__line"> |
||||
<label for="" class="label-name">{{ fn('pll_e', 'Вид животного') }}</label> |
||||
<div class="form-input__tabs"> |
||||
<label for="cat" class="form-input-tabs__button active"> |
||||
{{ fn('pll_e', 'Кошка') }} |
||||
<input type="radio" value="cat" checked name="pet" id="cat" class="form-input-tabs__input"> |
||||
</label> |
||||
|
||||
<label for="dog" class="form-input-tabs__button"> |
||||
{{ fn('pll_e', 'Собака') }} |
||||
<input type="radio" value="dog" name="pet" id="dog" class="form-input-tabs__input"> |
||||
</label> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content__line sterilized"> |
||||
<label for="" class="label-name">{{ fn('pll_e', 'Стерелизован') }}</label> |
||||
|
||||
<div class="form-input__tabs"> |
||||
<label class="form-input-tabs__button active"> |
||||
{{ fn('pll_e', 'Да') }} |
||||
<input type="radio" value="1" checked name="sterilized" class="form-input-tabs__input"> |
||||
</label> |
||||
|
||||
<label class="form-input-tabs__button"> |
||||
{{ fn('pll_e', 'Нет') }} |
||||
<input type="radio" value="0" name="sterilized" class="form-input-tabs__input"> |
||||
</label> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content__line"> |
||||
<div class="modal-form-content-line__element"> |
||||
<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> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content__line"> |
||||
<div class="modal-form-content-line__element"> |
||||
<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> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content__line"> |
||||
<label for="" class="label-name">{{ fn('pll_e', 'Пол вашего питомца') }}</label> |
||||
|
||||
<div class="form-input__tabs"> |
||||
<label for="boy" class="form-input-tabs__button active"> |
||||
{{ fn('pll_e', 'Мальчик') }} |
||||
<input type="radio" value="male" checked name="sex" id="boy" class="form-input-tabs__input"> |
||||
</label> |
||||
|
||||
<label for="girl" class="form-input-tabs__button"> |
||||
{{ fn('pll_e', 'Девочка') }} |
||||
<input type="radio" value="female" name="sex" id="girl" class="form-input-tabs__input"> |
||||
</label> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content__line modal-form-content__line--two"> |
||||
<div class="modal-form-content-line__element"> |
||||
<label class="label-name">{{ fn('pll_e', 'Вид активности') }}</label> |
||||
<div class="form-input__list"> |
||||
<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__content"> |
||||
<label class="form-input-list__item"> |
||||
<p class="form-input-list-item__text">{{ fn('pll_e', 'Низкая') }}</p> |
||||
<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__content"> |
||||
<img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt=""> |
||||
</div> |
||||
</div> |
||||
</label> |
||||
<label class="form-input-list__item"> |
||||
<p class="form-input-list-item__text">{{ fn('pll_e', 'Средняя') }}</p> |
||||
<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__content"> |
||||
<img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt=""> |
||||
</div> |
||||
</div> |
||||
</label> |
||||
<label class="form-input-list__item"> |
||||
<p class="form-input-list-item__text">{{ fn('pll_e', 'Высокая') }}</p> |
||||
<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__content"> |
||||
<img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt=""> |
||||
</div> |
||||
</div> |
||||
</label> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content-line__element"> |
||||
<label for="firstname" class="label-name">{{ fn('pll_e', 'Вес') }}</label> |
||||
<div class="form-input__list"> |
||||
<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__content"> |
||||
{% for weight in [ |
||||
{value: 'below_1_5', text: fn('pll_e', '1-1.5 кг')}, |
||||
{value: '1_5-3', text: fn('pll_e', '1.5-3 кг')}, |
||||
{value: '3-5', text: fn('pll_e', '3-5 кг')}, |
||||
{value: '5-8', text: fn('pll_e', '5-8 кг')}, |
||||
{value: '8-11', text: fn('pll_e', '8-11 кг')}, |
||||
{value: '11-15', text: fn('pll_e', '11-15 кг')}, |
||||
{value: '15-20', text: fn('pll_e', '10-20кг')}, |
||||
{value: '20-25', text: fn('pll_e', '20-25кг')}, |
||||
{value: '25-35', text: fn('pll_e', '25-35 кг')}, |
||||
{value: 'more_35', text: fn('pll_e', 'Более 35 кг')} |
||||
] %} |
||||
<label class="form-input-list__item"> |
||||
<p class="form-input-list-item__text">{{ weight.text }}</p> |
||||
<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__content"> |
||||
<img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt=""> |
||||
</div> |
||||
</div> |
||||
</label> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="rm"> |
||||
<div class="modal-form-content__line"> |
||||
<label class="label-name">{{ fn('pll_e', 'Возраст питомца') }}</label> |
||||
<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"> |
||||
{{ fn('pll_e', 'Примерный') }} |
||||
<input type="radio" checked value="ex" name="old_type" required id="exemplary" class="form-input-tabs__input"> |
||||
</label> |
||||
|
||||
<label class="form-input-tabs__button" data-rm="1"> |
||||
{{ fn('pll_e', 'Точный') }} |
||||
<input type="radio" value="acc" name="old_type" required id="accurate" class="form-input-tabs__input"> |
||||
</label> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal__age"> |
||||
<div class="form-input__radio remote-control__item active" data-rmcont="0"> |
||||
{% for age in [ |
||||
{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: 'old', title: fn('pll_e', 'Пожилой'), desc: fn('pll_e', '(от 7 до 12 лет)')}, |
||||
{value: 'very_old', title: fn('pll_e', 'Стареющий'), desc: fn('pll_e', '(от 12 лет и старше)')} |
||||
] %} |
||||
<label class="form-input-radio__item {{ loop.first ? 'active' : '' }}"> |
||||
<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__content"></div> |
||||
</div> |
||||
<p class="form-input-radio__title">{{ age.title }} <span>{{ age.desc }}</span></p> |
||||
</label> |
||||
{% endfor %} |
||||
</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 class="modal-form-content-line__element"> |
||||
<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', 'ДД') }}"> |
||||
</div> |
||||
|
||||
<div class="modal-form-content-line__element"> |
||||
<label for="firstname" class="label-name">{{ fn('pll_e', 'Месяц') }}</label> |
||||
<div class="form-input__list"> |
||||
<div class="form-input-list__input">{{ fn('pll_e', 'Месяц') }}</div> |
||||
<div class="form-input-list__block-content"> |
||||
<div class="form-input-list__content"> |
||||
{% for month in [ |
||||
{value: 1, text: fn('pll_e', 'Январь')}, |
||||
{value: 2, text: fn('pll_e', 'Февраль')}, |
||||
{value: 3, text: fn('pll_e', 'Март')}, |
||||
{value: 4, text: fn('pll_e', 'Апрель')}, |
||||
{value: 5, text: fn('pll_e', 'Май')}, |
||||
{value: 6, text: fn('pll_e', 'Июнь')}, |
||||
{value: 7, text: fn('pll_e', 'Июль')}, |
||||
{value: 8, text: fn('pll_e', 'Август')}, |
||||
{value: 9, text: fn('pll_e', 'Сентябрь')}, |
||||
{value: 10, text: fn('pll_e', 'Октябрь')}, |
||||
{value: 11, text: fn('pll_e', 'Ноябрь')}, |
||||
{value: 12, text: fn('pll_e', 'Декабрь')} |
||||
] %} |
||||
<label class="form-input-list__item"> |
||||
<p class="form-input-list-item__text">{{ month.text }}</p> |
||||
<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__content"> |
||||
<img src="{{ theme.link }}/gp-include/assets/lk/img/svg/main/arrow-selected-white.svg" alt=""> |
||||
</div> |
||||
</div> |
||||
</label> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content-line__element"> |
||||
<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', 'ГГГГ') }}"> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form__buttons"> |
||||
<button class="button button--gradient button--high button--100-perc" type="submit">{{ fn('pll_e', 'Добавить') }}</button> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modalProfile" id="subForm"> |
||||
<div class="popup-wrap"> |
||||
<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> |
||||
<p class="modal-form__title modal-form__title--white">Подписка на корм</p> |
||||
|
||||
<div class="modal-form__element modal-form__element--top-40"> |
||||
<p class="modal-form__text modal-form__text--white"> |
||||
Спасибо за интерес к нашему новому виду услуг, данная функция находится в разработке, если вы хотите узнать первыми о запуске подпишитесь на рассылку. |
||||
</p> |
||||
</div> |
||||
|
||||
<form class="modal-form__element modal-form__element--top-40 foodSub"> |
||||
<input type="hidden" name="email" value="{{ user.user_email }}"> |
||||
<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> |
||||
<button class="button form__button-mobile button--white button--100-perc open-overlay button--high"> |
||||
Хочу быть первым! |
||||
</button> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modalProfile" id="user_edit"> |
||||
<div class="popup-wrap"> |
||||
<div class="modal-form form__full-mobile modal-form--white modal-form--height-100-phone form-data active"> |
||||
<button class="modal-form__close"></button> |
||||
<p class="modal-form__title">Изменить мои данные</p> |
||||
|
||||
<form class="modal-form__content user-edit-form" method="post"> |
||||
<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__element"> |
||||
<label for="firstname" class="label-name">Имя</label> |
||||
<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> |
||||
</div> |
||||
|
||||
<div class="modal-form-content-line__element"> |
||||
<label for="lastname" class="label-name">Фамилия</label> |
||||
<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> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content__line"> |
||||
<label class="label-name">Телефон</label> |
||||
<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> |
||||
<div class="form-input__error form-input__error--absolute">Номер введён неверно</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form__buttons modal-form__buttons--two"> |
||||
<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="Отмена"> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
{% endblock %} |
||||
|
@ -1,81 +1,81 @@ |
||||
{# Bestsellers Slider Template with Polylang support #} |
||||
|
||||
{% set best = function('get_field', 'best', 'options') %} |
||||
{% set currency = function('get_woocommerce_currency_symbol') %} |
||||
|
||||
<div class="section_wrap"> |
||||
<section class="sellers"> |
||||
<div class="container"> |
||||
<div class="seller_block"> |
||||
<div class="sellers_top"> |
||||
<h2 class="sellers_title">{{ function('pll_e', 'BESTSELLERS') }}</h2> |
||||
<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-next sellerSlider-next" aria-label="{{ function('pll_e', 'Next products') }}"></button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="container-fluid"> |
||||
<div class="sellers_slider"> |
||||
<div class="swiper sellerSlider"> |
||||
<div class="swiper-wrapper"> |
||||
{% if best %} |
||||
{% for product_id in best %} |
||||
{% set product = function('wc_get_product', product_id) %} |
||||
{% 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 price = product.get_price() ~ ' ' ~ fn('get_woocommerce_currency_symbol') %} |
||||
{% set has_sale = product.is_on_sale() %} |
||||
{% set regular_price = product.get_regular_price() %} |
||||
{% set sale_price = product.get_sale_price() %} |
||||
|
||||
<div class="swiper-slide"> |
||||
<div class="sellers_card"> |
||||
<a href="{{ product.get_permalink() }}" aria-label="{{ function('pll_e', 'View product') }}: {{ product.get_name() }}"> |
||||
<img src="{{ thumbnail }}" |
||||
alt="{{ function('pll_e', 'Product image') }}: {{ product.get_name() }}" |
||||
class="sellers_card-img" |
||||
loading="lazy"> |
||||
</a> |
||||
|
||||
<div class="tags_block"> |
||||
<a href="{{ product.get_permalink() }}" class="seller_name"> |
||||
{{ product.get_name() }} |
||||
</a> |
||||
|
||||
<div class="seller_bt"> |
||||
<div class="seller_price"> |
||||
{{ price|raw }} |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<a href="{{ product.get_permalink() }}" class="seller_link"> |
||||
<button class="seller_buy" aria-label="{{ function('pll_e', 'Buy') }} {{ product.get_name() }}"> |
||||
{{ function('pll_e', 'Buy') }} |
||||
</button> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
{% endfor %} |
||||
{% else %} |
||||
<p class="no-products">{{ function('pll_e', 'No bestsellers found') }}</p> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="seller_full"> |
||||
<div class="container"> |
||||
<a href="{{ function('wc_get_page_permalink', 'shop') }}" class="seller_full-link"> |
||||
{{ function('pll_e', 'All products') }} |
||||
</a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</section> |
||||
{# Bestsellers Slider Template with Polylang support #} |
||||
|
||||
{% set best = function('get_field', 'best', 'options') %} |
||||
{% set currency = function('get_woocommerce_currency_symbol') %} |
||||
|
||||
<div class="section_wrap"> |
||||
<section class="sellers"> |
||||
<div class="container"> |
||||
<div class="seller_block"> |
||||
<div class="sellers_top"> |
||||
<h2 class="sellers_title">{{ function('pll_e', 'BESTSELLERS') }}</h2> |
||||
<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-next sellerSlider-next" aria-label="{{ function('pll_e', 'Next products') }}"></button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="container-fluid"> |
||||
<div class="sellers_slider"> |
||||
<div class="swiper sellerSlider"> |
||||
<div class="swiper-wrapper"> |
||||
{% if best %} |
||||
{% for product_id in best %} |
||||
{% set product = function('wc_get_product', product_id) %} |
||||
{% 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 price = product.get_price() ~ ' ' ~ fn('get_woocommerce_currency_symbol') %} |
||||
{% set has_sale = product.is_on_sale() %} |
||||
{% set regular_price = product.get_regular_price() %} |
||||
{% set sale_price = product.get_sale_price() %} |
||||
|
||||
<div class="swiper-slide"> |
||||
<div class="sellers_card"> |
||||
<a href="{{ product.get_permalink() }}" aria-label="{{ function('pll_e', 'View product') }}: {{ product.get_name() }}"> |
||||
<img src="{{ thumbnail }}" |
||||
alt="{{ function('pll_e', 'Product image') }}: {{ product.get_name() }}" |
||||
class="sellers_card-img" |
||||
loading="lazy"> |
||||
</a> |
||||
|
||||
<div class="tags_block"> |
||||
<a href="{{ product.get_permalink() }}" class="seller_name"> |
||||
{{ product.get_name() }} |
||||
</a> |
||||
|
||||
<div class="seller_bt"> |
||||
<div class="seller_price"> |
||||
{{ price|raw }} |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<a href="{{ product.get_permalink() }}" class="seller_link"> |
||||
<button class="seller_buy" aria-label="{{ function('pll_e', 'Buy') }} {{ product.get_name() }}"> |
||||
{{ function('pll_e', 'Buy') }} |
||||
</button> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
{% endfor %} |
||||
{% else %} |
||||
<p class="no-products">{{ function('pll_e', 'No bestsellers found') }}</p> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="seller_full"> |
||||
<div class="container"> |
||||
<a href="{{ function('wc_get_page_permalink', 'shop') }}" class="seller_full-link"> |
||||
{{ function('pll_e', 'All products') }} |
||||
</a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</section> |
||||
</div> |
@ -1,45 +1,45 @@ |
||||
{% if cart.is_empty %} |
||||
<p class="cart-empty">{{ function('pll_e', 'Your cart is empty') }}</p> |
||||
{% else %} |
||||
{% for item_key, item in cart.get_cart %} |
||||
{% 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__block-image"> |
||||
{{ product.get_image }} |
||||
</div> |
||||
|
||||
<div class="modal-basket-item__content"> |
||||
<p class="modal-basket-item__title">{{ product.get_name }}</p> |
||||
|
||||
<p class="modal-basket-item__sub-title"> |
||||
{{ fn('wc_get_formatted_cart_item_data', item) }} |
||||
</p> |
||||
|
||||
<div class="modal-basket-item__control"> |
||||
<div class="counter counter--small"> |
||||
<button class="counter__button minus" data-key="{{ item_key }}"> |
||||
<img src="{{ theme.link }}/static/img/svg/main/minus.svg" alt="{{ __('Decrease quantity', 'your-theme') }}"> |
||||
</button> |
||||
|
||||
<input type="text" class="counter__input" |
||||
value="{{ item.quantity }}" |
||||
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') }}"> |
||||
</button> |
||||
</div> |
||||
|
||||
<p class="modal-basket-item__price"> |
||||
{{ fn('wc_price', item.line_total + item.line_tax) }} |
||||
</p> |
||||
|
||||
<button class="remove-item" data-key="{{ item_key }}"> |
||||
<img src="{{ theme.link }}/static/img/svg/main/basket.svg" alt="{{ __('Remove item', 'your-theme') }}"> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
{% endif %} |
||||
|
||||
{% if cart.is_empty %} |
||||
<p class="cart-empty">{{ function('pll_e', 'Your cart is empty') }}</p> |
||||
{% else %} |
||||
{% for item_key, item in cart.get_cart %} |
||||
{% 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__block-image"> |
||||
{{ product.get_image }} |
||||
</div> |
||||
|
||||
<div class="modal-basket-item__content"> |
||||
<p class="modal-basket-item__title">{{ product.get_name }}</p> |
||||
|
||||
<p class="modal-basket-item__sub-title"> |
||||
{{ fn('wc_get_formatted_cart_item_data', item) }} |
||||
</p> |
||||
|
||||
<div class="modal-basket-item__control"> |
||||
<div class="counter counter--small"> |
||||
<button class="counter__button minus" data-key="{{ item_key }}"> |
||||
<img src="{{ theme.link }}/static/img/svg/main/minus.svg" alt="{{ __('Decrease quantity', 'your-theme') }}"> |
||||
</button> |
||||
|
||||
<input type="text" class="counter__input" |
||||
value="{{ item.quantity }}" |
||||
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') }}"> |
||||
</button> |
||||
</div> |
||||
|
||||
<p class="modal-basket-item__price"> |
||||
{{ fn('wc_price', item.line_total + item.line_tax) }} |
||||
</p> |
||||
|
||||
<button class="remove-item" data-key="{{ item_key }}"> |
||||
<img src="{{ theme.link }}/static/img/svg/main/basket.svg" alt="{{ __('Remove item', 'your-theme') }}"> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
{% endif %} |
||||
|
||||
|
@ -1,151 +1,151 @@ |
||||
{# templates/woocommerce/checkout/form-checkout.twig #} |
||||
|
||||
<form action="" class="checkout woocommerce-checkout"> |
||||
<div class="order checkout woocommerce-checkout"> |
||||
<div id="recipient" class="order__contacts"> |
||||
<div class="order-contacts__header"> |
||||
<p class="order__title"> |
||||
{{ fn('pll_e', 'Контакты получателя') }} |
||||
</p> |
||||
{% if fn('is_user_logged_in') %} |
||||
<a href="{{ fn('wp_logout_url', fn('wc_get_checkout_url')) }}" class="cabinet-card__button"> |
||||
{{ fn('pll_e', 'Выйти') }} |
||||
</a> |
||||
{% else %} |
||||
<button type="button" class="cabinet-card__button login-open"> |
||||
{{ fn('pll_e', 'Войти') }} |
||||
</button> |
||||
{% endif %} |
||||
</div> |
||||
<div id="acc-error" class="form-input__error"><span class="error-message"></span></div> |
||||
<div class="order-contacts__form"> |
||||
{{ fn('do_action', 'woocommerce_checkout_billing') }} |
||||
</div> |
||||
|
||||
{% set chosen_methods = WC().session.get('chosen_shipping_methods') %} |
||||
{% set shipping_method = chosen_methods[0] ? chosen_methods[0] : fn('pll_e', 'Не выбран') %} |
||||
|
||||
<div class="order-contacts__delivery"> |
||||
<p class="order__title">{{ fn('pll_e', 'Доставка') }}</p> |
||||
|
||||
<div id="custom-shipping-methods" class="modal-map__control modal-map__control--delivery"></div> |
||||
|
||||
<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 class="order-contacts-deliver__item"> |
||||
<div class="modal-form-content-line__element modal-form-content-line__element--arrow"> |
||||
<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"> |
||||
</div> |
||||
<div id="pvz-error" class="form-input__error"><span class="error-message"></span></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 class="order-contacts-deliver__item"> |
||||
<div class="modal-form-content-line__element modal-form-content-line__element--arrow"> |
||||
<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"> |
||||
</div> |
||||
</div> |
||||
|
||||
<div id="adr-error" class="form-input__error"><span class="error-message"></span></div> |
||||
<div class="order-contacts-deliver__item"> |
||||
<div class="modal-form-content-line__element"> |
||||
<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> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="order__your"> |
||||
<p class="order__title">{{ fn('pll_e', 'Ваш заказ') }}</p> |
||||
<div class="order-your__products"> |
||||
{% for cart_item_key, cart_item in WC().cart.get_cart() %} |
||||
{% set product = cart_item.data %} |
||||
{% 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) %} |
||||
<div class="order-your-products__item"> |
||||
<div class="order-your-products__left"> |
||||
<img src="{{ fn('wp_get_attachment_url', thumbnail_id) }}" alt="" class="order-your-products__img"> |
||||
<div class="order-your-products__content"> |
||||
<a href="{{ product.get_permalink() }}" class="order-your-products__name">{{ product.get_name() }}</a> |
||||
</div> |
||||
</div> |
||||
<div class="order-your-products__right"> |
||||
<p class="order-your-products__count"> |
||||
{{ cart_item.quantity }} |
||||
</p> |
||||
<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) }} |
||||
</p> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
{% endfor %} |
||||
</div> |
||||
|
||||
<div class="order-your__calculation"> |
||||
{{ fn('woocommerce_checkout_coupon_form') }} |
||||
|
||||
<div id="order_review" class="woocommerce-checkout-review-order"> |
||||
{{ fn('do_action', 'woocommerce_checkout_order_review') }} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<div class="modalProfile" id="address_input"> |
||||
<div class="popup-wrap"> |
||||
<div class="modal-form form__full-mobile modal-form--white modal-form--height-100-phone form-data active"> |
||||
<button class="modal-form__close"></button> |
||||
<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-line__element"> |
||||
<label for="address" class="label-name">{{ fn('pll_e', 'Адрес') }}</label> |
||||
<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> |
||||
</div> |
||||
|
||||
<div class="modal-form-content__line modal-form-content__line--two-mobile"> |
||||
<div class="modal-form-content-line__element"> |
||||
<label for="apartment" class="label-name">{{ fn('pll_e', 'Квартира') }}</label> |
||||
<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> |
||||
</div> |
||||
|
||||
<div class="modal-form-content-line__element"> |
||||
<label for="floor" class="label-name">{{ fn('pll_e', 'Этаж') }}</label> |
||||
<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> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content__line modal-form-content__line--two-mobile"> |
||||
<div class="modal-form-content-line__element"> |
||||
<label for="entrance" class="label-name">{{ fn('pll_e', 'Подъезд') }}</label> |
||||
<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> |
||||
</div> |
||||
|
||||
<div class="modal-form-content-line__element"> |
||||
<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=""> |
||||
<span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Код домофона введен неверно') }}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form__buttons"> |
||||
<button class="button button--gradient button--high button--100-perc close-btn"> |
||||
<span>{{ fn('pll_e', 'Доставить сюда') }}</span> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{# templates/woocommerce/checkout/form-checkout.twig #} |
||||
|
||||
<form action="" class="checkout woocommerce-checkout"> |
||||
<div class="order checkout woocommerce-checkout"> |
||||
<div id="recipient" class="order__contacts"> |
||||
<div class="order-contacts__header"> |
||||
<p class="order__title"> |
||||
{{ fn('pll_e', 'Контакты получателя') }} |
||||
</p> |
||||
{% if fn('is_user_logged_in') %} |
||||
<a href="{{ fn('wp_logout_url', fn('wc_get_checkout_url')) }}" class="cabinet-card__button"> |
||||
{{ fn('pll_e', 'Выйти') }} |
||||
</a> |
||||
{% else %} |
||||
<button type="button" class="cabinet-card__button login-open"> |
||||
{{ fn('pll_e', 'Войти') }} |
||||
</button> |
||||
{% endif %} |
||||
</div> |
||||
<div id="acc-error" class="form-input__error"><span class="error-message"></span></div> |
||||
<div class="order-contacts__form"> |
||||
{{ fn('do_action', 'woocommerce_checkout_billing') }} |
||||
</div> |
||||
|
||||
{% set chosen_methods = WC().session.get('chosen_shipping_methods') %} |
||||
{% set shipping_method = chosen_methods[0] ? chosen_methods[0] : fn('pll_e', 'Не выбран') %} |
||||
|
||||
<div class="order-contacts__delivery"> |
||||
<p class="order__title">{{ fn('pll_e', 'Доставка') }}</p> |
||||
|
||||
<div id="custom-shipping-methods" class="modal-map__control modal-map__control--delivery"></div> |
||||
|
||||
<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 class="order-contacts-deliver__item"> |
||||
<div class="modal-form-content-line__element modal-form-content-line__element--arrow"> |
||||
<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"> |
||||
</div> |
||||
<div id="pvz-error" class="form-input__error"><span class="error-message"></span></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 class="order-contacts-deliver__item"> |
||||
<div class="modal-form-content-line__element modal-form-content-line__element--arrow"> |
||||
<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"> |
||||
</div> |
||||
</div> |
||||
|
||||
<div id="adr-error" class="form-input__error"><span class="error-message"></span></div> |
||||
<div class="order-contacts-deliver__item"> |
||||
<div class="modal-form-content-line__element"> |
||||
<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> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="order__your"> |
||||
<p class="order__title">{{ fn('pll_e', 'Ваш заказ') }}</p> |
||||
<div class="order-your__products"> |
||||
{% for cart_item_key, cart_item in WC().cart.get_cart() %} |
||||
{% set product = cart_item.data %} |
||||
{% 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) %} |
||||
<div class="order-your-products__item"> |
||||
<div class="order-your-products__left"> |
||||
<img src="{{ fn('wp_get_attachment_url', thumbnail_id) }}" alt="" class="order-your-products__img"> |
||||
<div class="order-your-products__content"> |
||||
<a href="{{ product.get_permalink() }}" class="order-your-products__name">{{ product.get_name() }}</a> |
||||
</div> |
||||
</div> |
||||
<div class="order-your-products__right"> |
||||
<p class="order-your-products__count"> |
||||
{{ cart_item.quantity }} |
||||
</p> |
||||
<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) }} |
||||
</p> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
{% endfor %} |
||||
</div> |
||||
|
||||
<div class="order-your__calculation"> |
||||
{{ fn('woocommerce_checkout_coupon_form') }} |
||||
|
||||
<div id="order_review" class="woocommerce-checkout-review-order"> |
||||
{{ fn('do_action', 'woocommerce_checkout_order_review') }} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<div class="modalProfile" id="address_input"> |
||||
<div class="popup-wrap"> |
||||
<div class="modal-form form__full-mobile modal-form--white modal-form--height-100-phone form-data active"> |
||||
<button class="modal-form__close"></button> |
||||
<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-line__element"> |
||||
<label for="address" class="label-name">{{ fn('pll_e', 'Адрес') }}</label> |
||||
<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> |
||||
</div> |
||||
|
||||
<div class="modal-form-content__line modal-form-content__line--two-mobile"> |
||||
<div class="modal-form-content-line__element"> |
||||
<label for="apartment" class="label-name">{{ fn('pll_e', 'Квартира') }}</label> |
||||
<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> |
||||
</div> |
||||
|
||||
<div class="modal-form-content-line__element"> |
||||
<label for="floor" class="label-name">{{ fn('pll_e', 'Этаж') }}</label> |
||||
<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> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form-content__line modal-form-content__line--two-mobile"> |
||||
<div class="modal-form-content-line__element"> |
||||
<label for="entrance" class="label-name">{{ fn('pll_e', 'Подъезд') }}</label> |
||||
<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> |
||||
</div> |
||||
|
||||
<div class="modal-form-content-line__element"> |
||||
<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=""> |
||||
<span class="form-input__error form-input__error--absolute">{{ fn('pll_e', 'Код домофона введен неверно') }}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal-form__buttons"> |
||||
<button class="button button--gradient button--high button--100-perc close-btn"> |
||||
<span>{{ fn('pll_e', 'Доставить сюда') }}</span> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
@ -1,66 +1,66 @@ |
||||
<table class="shop_table woocommerce-checkout-review-order-table"> |
||||
<tfoot> |
||||
<tr class="order-your-calculation__item"> |
||||
<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> |
||||
</tr> |
||||
|
||||
{% for code, coupon in fn('WC').cart.get_coupons() %} |
||||
<tr class="order-your-calculation__item cart-discount coupon-{{ code }}"> |
||||
<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> |
||||
</tr> |
||||
{% endfor %} |
||||
|
||||
{% if fn('WC').cart.needs_shipping() and fn('WC').cart.show_shipping() %} |
||||
{{ action('woocommerce_review_order_before_shipping') }} |
||||
|
||||
{{ fn('wc_cart_totals_shipping_html') }} |
||||
|
||||
{{ action('woocommerce_review_order_after_shipping') }} |
||||
{% endif %} |
||||
|
||||
<tr class="order-your-calculation__item"> |
||||
<th class="order-your-calculation__title">{{ fn('pll_e', 'Доставка') }}</th> |
||||
{% set chosen_shipping_methods = fn('WC').session.get('chosen_shipping_methods') %} |
||||
{% if not chosen_shipping_methods[0] is defined %} |
||||
<td class="order-your-calculation__description">{{ fn('pll_e', 'Введите адрес доставки') }}</td> |
||||
{% else %} |
||||
<td class="order-your-calculation__value order-your-calculation__value--price">{{ fn('WC').cart.get_shipping_total() }} ₽</td> |
||||
{% endif %} |
||||
</tr> |
||||
|
||||
{% for fee in fn('WC').cart.get_fees() %} |
||||
<tr class="fee"> |
||||
<th>{{ fee.name|e }}</th> |
||||
<td>{{ fn('wc_cart_totals_fee_html', fee) }}</td> |
||||
</tr> |
||||
{% endfor %} |
||||
|
||||
{% if fn('wc_tax_enabled') and not fn('WC').cart.display_prices_including_tax() %} |
||||
{% if 'itemized' == fn('get_option', 'woocommerce_tax_total_display') %} |
||||
{% for code, tax in fn('WC').cart.get_tax_totals() %} |
||||
<tr class="tax-rate tax-rate-{{ code }}"> |
||||
<th>{{ tax.label|e }}</th> |
||||
<td>{{ tax.formatted_amount|raw }}</td> |
||||
</tr> |
||||
{% endfor %} |
||||
{% else %} |
||||
<tr class="tax-total"> |
||||
<th>{{ fn('WC').countries.tax_or_vat()|e }}</th> |
||||
<td>{{ fn('wc_cart_totals_taxes_total_html') }}</td> |
||||
</tr> |
||||
{% endif %} |
||||
{% endif %} |
||||
|
||||
{{ action('woocommerce_review_order_before_order_total') }} |
||||
|
||||
<tr class="order-your-calculation__line"></tr> |
||||
<tr class="order-your-calculation__item"> |
||||
<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> |
||||
</tr> |
||||
|
||||
{{ action('woocommerce_review_order_after_order_total') }} |
||||
</tfoot> |
||||
<table class="shop_table woocommerce-checkout-review-order-table"> |
||||
<tfoot> |
||||
<tr class="order-your-calculation__item"> |
||||
<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> |
||||
</tr> |
||||
|
||||
{% for code, coupon in fn('WC').cart.get_coupons() %} |
||||
<tr class="order-your-calculation__item cart-discount coupon-{{ code }}"> |
||||
<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> |
||||
</tr> |
||||
{% endfor %} |
||||
|
||||
{% if fn('WC').cart.needs_shipping() and fn('WC').cart.show_shipping() %} |
||||
{{ action('woocommerce_review_order_before_shipping') }} |
||||
|
||||
{{ fn('wc_cart_totals_shipping_html') }} |
||||
|
||||
{{ action('woocommerce_review_order_after_shipping') }} |
||||
{% endif %} |
||||
|
||||
<tr class="order-your-calculation__item"> |
||||
<th class="order-your-calculation__title">{{ fn('pll_e', 'Доставка') }}</th> |
||||
{% set chosen_shipping_methods = fn('WC').session.get('chosen_shipping_methods') %} |
||||
{% if not chosen_shipping_methods[0] is defined %} |
||||
<td class="order-your-calculation__description">{{ fn('pll_e', 'Введите адрес доставки') }}</td> |
||||
{% else %} |
||||
<td class="order-your-calculation__value order-your-calculation__value--price">{{ fn('WC').cart.get_shipping_total() }} ₽</td> |
||||
{% endif %} |
||||
</tr> |
||||
|
||||
{% for fee in fn('WC').cart.get_fees() %} |
||||
<tr class="fee"> |
||||
<th>{{ fee.name|e }}</th> |
||||
<td>{{ fn('wc_cart_totals_fee_html', fee) }}</td> |
||||
</tr> |
||||
{% endfor %} |
||||
|
||||
{% if fn('wc_tax_enabled') and not fn('WC').cart.display_prices_including_tax() %} |
||||
{% if 'itemized' == fn('get_option', 'woocommerce_tax_total_display') %} |
||||
{% for code, tax in fn('WC').cart.get_tax_totals() %} |
||||
<tr class="tax-rate tax-rate-{{ code }}"> |
||||
<th>{{ tax.label|e }}</th> |
||||
<td>{{ tax.formatted_amount|raw }}</td> |
||||
</tr> |
||||
{% endfor %} |
||||
{% else %} |
||||
<tr class="tax-total"> |
||||
<th>{{ fn('WC').countries.tax_or_vat()|e }}</th> |
||||
<td>{{ fn('wc_cart_totals_taxes_total_html') }}</td> |
||||
</tr> |
||||
{% endif %} |
||||
{% endif %} |
||||
|
||||
{{ action('woocommerce_review_order_before_order_total') }} |
||||
|
||||
<tr class="order-your-calculation__line"></tr> |
||||
<tr class="order-your-calculation__item"> |
||||
<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> |
||||
</tr> |
||||
|
||||
{{ action('woocommerce_review_order_after_order_total') }} |
||||
</tfoot> |
||||
</table> |
@ -1,63 +1,63 @@ |
||||
<?php |
||||
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) { |
||||
exit; |
||||
} |
||||
|
||||
if (is_product()) { |
||||
|
||||
include_module('shop'); |
||||
include_component('shop', 'single-product'); |
||||
|
||||
$context = Timber::get_context(); |
||||
$post = Timber::get_post(); |
||||
$context['post'] = $post; |
||||
|
||||
|
||||
$context['wc_breadcrumbs'] = array(); |
||||
|
||||
if (function_exists('woocommerce_breadcrumb')) { |
||||
$args = array( |
||||
'delimiter' => '', |
||||
'wrap_before' => '', |
||||
'wrap_after' => '', |
||||
'before' => '', |
||||
'after' => '', |
||||
'home' => _x('Home', 'breadcrumb', 'woocommerce'), |
||||
); |
||||
|
||||
$breadcrumbs = new WC_Breadcrumb(); |
||||
$breadcrumbs->generate(); |
||||
|
||||
$formatted_breadcrumbs = array(); |
||||
foreach ($breadcrumbs->get_breadcrumb() as $crumb) { |
||||
$formatted_breadcrumbs[] = array( |
||||
'text' => $crumb[0], |
||||
'url' => $crumb[1] |
||||
); |
||||
} |
||||
|
||||
$context['wc_breadcrumbs'] = $formatted_breadcrumbs; |
||||
} |
||||
|
||||
|
||||
$product_id = get_the_ID(); |
||||
$product = wc_get_product($product_id); |
||||
|
||||
$context['product'] = $product; |
||||
|
||||
$context['related_products'] = array(); |
||||
$related_products_ids = wc_get_related_products($product_id, 5); |
||||
|
||||
if ($related_products_ids) { |
||||
foreach ($related_products_ids as $related_id) { |
||||
$related_product = wc_get_product($related_id); |
||||
if ($related_product) { |
||||
$context['related_products'][] = $related_product; |
||||
} |
||||
} |
||||
} |
||||
|
||||
Timber::render('modules/shop/components/single-product/component-template.twig', $context); |
||||
<?php |
||||
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) { |
||||
exit; |
||||
} |
||||
|
||||
if (is_product()) { |
||||
|
||||
include_module('shop'); |
||||
include_component('shop', 'single-product'); |
||||
|
||||
$context = Timber::get_context(); |
||||
$post = Timber::get_post(); |
||||
$context['post'] = $post; |
||||
|
||||
|
||||
$context['wc_breadcrumbs'] = array(); |
||||
|
||||
if (function_exists('woocommerce_breadcrumb')) { |
||||
$args = array( |
||||
'delimiter' => '', |
||||
'wrap_before' => '', |
||||
'wrap_after' => '', |
||||
'before' => '', |
||||
'after' => '', |
||||
'home' => _x('Home', 'breadcrumb', 'woocommerce'), |
||||
); |
||||
|
||||
$breadcrumbs = new WC_Breadcrumb(); |
||||
$breadcrumbs->generate(); |
||||
|
||||
$formatted_breadcrumbs = array(); |
||||
foreach ($breadcrumbs->get_breadcrumb() as $crumb) { |
||||
$formatted_breadcrumbs[] = array( |
||||
'text' => $crumb[0], |
||||
'url' => $crumb[1] |
||||
); |
||||
} |
||||
|
||||
$context['wc_breadcrumbs'] = $formatted_breadcrumbs; |
||||
} |
||||
|
||||
|
||||
$product_id = get_the_ID(); |
||||
$product = wc_get_product($product_id); |
||||
|
||||
$context['product'] = $product; |
||||
|
||||
$context['related_products'] = array(); |
||||
$related_products_ids = wc_get_related_products($product_id, 5); |
||||
|
||||
if ($related_products_ids) { |
||||
foreach ($related_products_ids as $related_id) { |
||||
$related_product = wc_get_product($related_id); |
||||
if ($related_product) { |
||||
$context['related_products'][] = $related_product; |
||||
} |
||||
} |
||||
} |
||||
|
||||
Timber::render('modules/shop/components/single-product/component-template.twig', $context); |
||||
} |
@ -1,136 +1,136 @@ |
||||
<?php |
||||
/* |
||||
Template Name: Where to Buy |
||||
Template Post Type: page |
||||
*/ |
||||
|
||||
// Инициализация Timber |
||||
$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-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-mb', get_template_directory_uri() . '/gp-include/assets/where-to-buy/css/gp-style-mobile.css?v=1.122'); |
||||
|
||||
// Получение данных маркеров из ACF |
||||
$locations = get_field('location_markers') ?: []; |
||||
$acf_locations = array_map(function($location) { |
||||
return [ |
||||
'title' => $location['title'], |
||||
'address' => $location['address'], |
||||
'url' => $location['website'], |
||||
'latitude' => isset($location['latitude']) ? (float)$location['latitude'] : null, |
||||
'longitude' => isset($location['longitude']) ? (float)$location['longitude'] : null |
||||
]; |
||||
}, $locations); |
||||
|
||||
// Предопределенные данные локаций |
||||
$predefined_locations = [ |
||||
[ |
||||
'title' => 'Roots Supermarket', |
||||
'address' => 'Waves Grande, Retail unit 1-2 Shobha Hartland, Dubai DU United Arab Emirates', |
||||
'position' => ['lat' => 25.1896, 'lng' => 55.3662], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Pawdy Neighbors', |
||||
'address' => 'Souk Al Manzil - Old Town Downtown, Dubai, United Arab Emirates', |
||||
'position' => ['lat' => 25.1915, 'lng' => 55.2758], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'The Pet Co', |
||||
'address' => 'Tower A, Shop 01, Prime Business Centre, JVC, Dubai, UAE', |
||||
'position' => ['lat' => 25.0580, 'lng' => 55.2282], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Ivy Secret Garden', |
||||
'address' => 'Al Wasl Warehouse Complex, Unit 14 - 26th St - Al Quoz Industrial Area 4 - Dubai', |
||||
'position' => ['lat' => 25.1416, 'lng' => 55.2358], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Petzone', |
||||
'address' => 'Petzone Sheikh Zayed Road - Petzone Umm Suqeim', |
||||
'position' => ['lat' => 25.1530, 'lng' => 55.2145], |
||||
'url' => 'https://petzone.com/uae/en/' |
||||
], |
||||
[ |
||||
'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', |
||||
'position' => ['lat' => 25.1868, 'lng' => 55.2527], |
||||
'url' => 'https://petcornerdubai.com/' |
||||
], |
||||
[ |
||||
'title' => 'Pet Corner Motor City - Dubai', |
||||
'address' => 'Unit R7, Fox Hill 8, Motor City, Opposite Arabian Ranches', |
||||
'position' => ['lat' => 25.0499, 'lng' => 55.2350], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Pet Corner Jumeirah Golf Estates - Dubai', |
||||
'address' => 'Shop No. 7, The Fairway Mall Jumeirah Golf Estates Dubai', |
||||
'position' => ['lat' => 25.0394, 'lng' => 55.2269], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Pet Corner Khalifa City - Abu Dhabi', |
||||
'address' => 'Shop No 5, Al Raha Gardens, Khalifa City Abu Dhabi', |
||||
'position' => ['lat' => 24.4243, 'lng' => 54.5754], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Pet Corner- Sharjah Al Mamsha', |
||||
'address' => 'Al Sharjah, University Road', |
||||
'position' => ['lat' => 25.3126, 'lng' => 55.4783], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Pet Corner Fujairah- Lulu Mall', |
||||
'address' => 'Al - Korthabah Road - Fujairah City Center - Fujairah', |
||||
'position' => ['lat' => 25.1221, 'lng' => 56.3244], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Tail Waggin Al Quoz', |
||||
'address' => 'Warehouse 7, Street 8, Al Khail Road, Al Quoz 1, Dubai, United Arab Emirates', |
||||
'position' => ['lat' => 25.1368, 'lng' => 55.2364], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => "Tail Waggin' Pet Spa Dubai Hills", |
||||
'address' => 'SWAY Residences, Retail 2 - near Kings College Hospital Dubai Hills Estate - Dubai - United Arab Emirates', |
||||
'position' => ['lat' => 25.1276, 'lng' => 55.2714], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Goofy Groom', |
||||
'address' => 'Dubai, UAE Midtown Central Majan, Shop G-17', |
||||
'position' => ['lat' => 25.0834, 'lng' => 55.1743], |
||||
'url' => '' |
||||
] |
||||
]; |
||||
|
||||
// Получение изображений из галереи ACF |
||||
$partners_logos = get_field('partners_logos') ?: []; |
||||
$partners_logos_formatted = array_map(function($image) { |
||||
return [ |
||||
'url' => esc_url($image['title']), |
||||
'src' => esc_url($image['sizes']['medium']), |
||||
'alt' => esc_attr($image['alt']) |
||||
]; |
||||
}, $partners_logos); |
||||
|
||||
// Добавление данных в контекст |
||||
$context['acf_locations'] = $acf_locations; |
||||
$context['predefined_locations'] = $predefined_locations; |
||||
$context['partners_logos'] = $partners_logos_formatted; |
||||
|
||||
// Отключение автопараграфов для Contact Form 7 |
||||
add_filter('wpcf7_autop_or_not', '__return_false'); |
||||
|
||||
// Рендеринг шаблона |
||||
Timber::render('templates/where_to_buy/wtb.twig', $context); |
||||
?> |
||||
<?php |
||||
/* |
||||
Template Name: Where to Buy |
||||
Template Post Type: page |
||||
*/ |
||||
|
||||
// Инициализация Timber |
||||
$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-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-mb', get_template_directory_uri() . '/gp-include/assets/where-to-buy/css/gp-style-mobile.css?v=1.122'); |
||||
|
||||
// Получение данных маркеров из ACF |
||||
$locations = get_field('location_markers') ?: []; |
||||
$acf_locations = array_map(function($location) { |
||||
return [ |
||||
'title' => $location['title'], |
||||
'address' => $location['address'], |
||||
'url' => $location['website'], |
||||
'latitude' => isset($location['latitude']) ? (float)$location['latitude'] : null, |
||||
'longitude' => isset($location['longitude']) ? (float)$location['longitude'] : null |
||||
]; |
||||
}, $locations); |
||||
|
||||
// Предопределенные данные локаций |
||||
$predefined_locations = [ |
||||
[ |
||||
'title' => 'Roots Supermarket', |
||||
'address' => 'Waves Grande, Retail unit 1-2 Shobha Hartland, Dubai DU United Arab Emirates', |
||||
'position' => ['lat' => 25.1896, 'lng' => 55.3662], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Pawdy Neighbors', |
||||
'address' => 'Souk Al Manzil - Old Town Downtown, Dubai, United Arab Emirates', |
||||
'position' => ['lat' => 25.1915, 'lng' => 55.2758], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'The Pet Co', |
||||
'address' => 'Tower A, Shop 01, Prime Business Centre, JVC, Dubai, UAE', |
||||
'position' => ['lat' => 25.0580, 'lng' => 55.2282], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Ivy Secret Garden', |
||||
'address' => 'Al Wasl Warehouse Complex, Unit 14 - 26th St - Al Quoz Industrial Area 4 - Dubai', |
||||
'position' => ['lat' => 25.1416, 'lng' => 55.2358], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Petzone', |
||||
'address' => 'Petzone Sheikh Zayed Road - Petzone Umm Suqeim', |
||||
'position' => ['lat' => 25.1530, 'lng' => 55.2145], |
||||
'url' => 'https://petzone.com/uae/en/' |
||||
], |
||||
[ |
||||
'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', |
||||
'position' => ['lat' => 25.1868, 'lng' => 55.2527], |
||||
'url' => 'https://petcornerdubai.com/' |
||||
], |
||||
[ |
||||
'title' => 'Pet Corner Motor City - Dubai', |
||||
'address' => 'Unit R7, Fox Hill 8, Motor City, Opposite Arabian Ranches', |
||||
'position' => ['lat' => 25.0499, 'lng' => 55.2350], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Pet Corner Jumeirah Golf Estates - Dubai', |
||||
'address' => 'Shop No. 7, The Fairway Mall Jumeirah Golf Estates Dubai', |
||||
'position' => ['lat' => 25.0394, 'lng' => 55.2269], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Pet Corner Khalifa City - Abu Dhabi', |
||||
'address' => 'Shop No 5, Al Raha Gardens, Khalifa City Abu Dhabi', |
||||
'position' => ['lat' => 24.4243, 'lng' => 54.5754], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Pet Corner- Sharjah Al Mamsha', |
||||
'address' => 'Al Sharjah, University Road', |
||||
'position' => ['lat' => 25.3126, 'lng' => 55.4783], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Pet Corner Fujairah- Lulu Mall', |
||||
'address' => 'Al - Korthabah Road - Fujairah City Center - Fujairah', |
||||
'position' => ['lat' => 25.1221, 'lng' => 56.3244], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Tail Waggin Al Quoz', |
||||
'address' => 'Warehouse 7, Street 8, Al Khail Road, Al Quoz 1, Dubai, United Arab Emirates', |
||||
'position' => ['lat' => 25.1368, 'lng' => 55.2364], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => "Tail Waggin' Pet Spa Dubai Hills", |
||||
'address' => 'SWAY Residences, Retail 2 - near Kings College Hospital Dubai Hills Estate - Dubai - United Arab Emirates', |
||||
'position' => ['lat' => 25.1276, 'lng' => 55.2714], |
||||
'url' => '' |
||||
], |
||||
[ |
||||
'title' => 'Goofy Groom', |
||||
'address' => 'Dubai, UAE Midtown Central Majan, Shop G-17', |
||||
'position' => ['lat' => 25.0834, 'lng' => 55.1743], |
||||
'url' => '' |
||||
] |
||||
]; |
||||
|
||||
// Получение изображений из галереи ACF |
||||
$partners_logos = get_field('partners_logos') ?: []; |
||||
$partners_logos_formatted = array_map(function($image) { |
||||
return [ |
||||
'url' => esc_url($image['title']), |
||||
'src' => esc_url($image['sizes']['medium']), |
||||
'alt' => esc_attr($image['alt']) |
||||
]; |
||||
}, $partners_logos); |
||||
|
||||
// Добавление данных в контекст |
||||
$context['acf_locations'] = $acf_locations; |
||||
$context['predefined_locations'] = $predefined_locations; |
||||
$context['partners_logos'] = $partners_logos_formatted; |
||||
|
||||
// Отключение автопараграфов для Contact Form 7 |
||||
add_filter('wpcf7_autop_or_not', '__return_false'); |
||||
|
||||
// Рендеринг шаблона |
||||
Timber::render('templates/where_to_buy/wtb.twig', $context); |
||||
?> |
||||
|
@ -1,9 +1,9 @@ |
||||
{% for post in posts %} |
||||
{% include '/woocommerce/archive-product/archive-product-tease.twig' with {post: post} %} |
||||
{% endfor %} |
||||
|
||||
{% if not ended %} |
||||
<button class="button button--white" id="load-more-products" data-category_id="{{ get_category }}" data-category_type="{{ get_category_type }}"> |
||||
{{ function('pll_e', 'Загрузить еще') }} |
||||
</button> |
||||
{% for post in posts %} |
||||
{% include '/woocommerce/archive-product/archive-product-tease.twig' with {post: post} %} |
||||
{% endfor %} |
||||
|
||||
{% if not ended %} |
||||
<button class="button button--white" id="load-more-products" data-category_id="{{ get_category }}" data-category_type="{{ get_category_type }}"> |
||||
{{ function('pll_e', 'Загрузить еще') }} |
||||
</button> |
||||
{% endif %} |
@ -1,221 +1,221 @@ |
||||
{# <div class="modal"> |
||||
<aside class="modal__aside"> |
||||
<div class="modal__item modal__filter"> |
||||
<button class="modal__close"> |
||||
<img src="assets/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
|
||||
<div class="modal__header"> |
||||
<p class="modal__title">Фильтры</p> |
||||
{{sidebar_filters}} |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal__item modal__basket"> |
||||
<button class="modal__close"> |
||||
<img src="assets/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
<div class="modal__header"> |
||||
<p class="modal__title">Корзина</p> |
||||
<div class="modal__content"> |
||||
<div class="modal-basket__item modal-basket__item--return"> |
||||
<p class="modal-basket-item__title"> |
||||
Удаление товра из корзины: 5с |
||||
</p> |
||||
|
||||
<button class="modal-basket-item__return"> |
||||
Восстановить |
||||
</button> |
||||
</div> |
||||
<div class="modal-basket__item"> |
||||
<div class="modal-basket-item__block-image"> |
||||
<img src="assets/img/product/image.png" alt="" class="modal-basket-item__image"> |
||||
</div> |
||||
|
||||
<div class="modal-basket-item__content"> |
||||
<p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p> |
||||
<p class="modal-basket-item__sub-title">Индейка, 2 кг</p> |
||||
<div class="modal-basket-item__control"> |
||||
<div class="counter counter--small"> |
||||
<button class="counter__button minus"> |
||||
<img src="assets/img/svg/main/minus.svg" alt=""> |
||||
</button> |
||||
<input type="text" class="counter__input" value="1"> |
||||
<button class="counter__button plus"> |
||||
<img src="assets/img/svg/main/plus.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
|
||||
<p class="modal-basket-item__price">1280</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="modal-basket__item"> |
||||
<div class="modal-basket-item__block-image"> |
||||
<img src="assets/img/product/image.png" alt="" class="modal-basket-item__image"> |
||||
</div> |
||||
|
||||
<div class="modal-basket-item__content"> |
||||
<p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p> |
||||
<p class="modal-basket-item__sub-title">Индейка, 2 кг</p> |
||||
<div class="modal-basket-item__control"> |
||||
<div class="counter counter--small"> |
||||
<button class="counter__button minus"> |
||||
<img src="assets/img/svg/main/minus.svg" alt=""> |
||||
</button> |
||||
<input type="text" class="counter__input" value="1"> |
||||
<button class="counter__button plus"> |
||||
<img src="assets/img/svg/main/plus.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
|
||||
<p class="modal-basket-item__price">1280</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="modal-basket__item"> |
||||
<div class="modal-basket-item__block-image"> |
||||
<img src="assets/img/product/image.png" alt="" class="modal-basket-item__image"> |
||||
</div> |
||||
|
||||
<div class="modal-basket-item__content"> |
||||
<p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p> |
||||
<p class="modal-basket-item__sub-title">Индейка, 2 кг</p> |
||||
<div class="modal-basket-item__control"> |
||||
<div class="counter counter--small"> |
||||
<button class="counter__button minus"> |
||||
<img src="assets/img/svg/main/minus.svg" alt=""> |
||||
</button> |
||||
<input type="text" class="counter__input" value="1"> |
||||
<button class="counter__button plus"> |
||||
<img src="assets/img/svg/main/plus.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
|
||||
<p class="modal-basket-item__price">1280</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="modal-basket__item"> |
||||
<div class="modal-basket-item__block-image"> |
||||
<img src="assets/img/product/image.png" alt="" class="modal-basket-item__image"> |
||||
</div> |
||||
|
||||
<div class="modal-basket-item__content"> |
||||
<p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p> |
||||
<p class="modal-basket-item__sub-title">Индейка, 2 кг</p> |
||||
<div class="modal-basket-item__control"> |
||||
<div class="counter counter--small"> |
||||
<button class="counter__button minus"> |
||||
<img src="assets/img/svg/main/minus.svg" alt=""> |
||||
</button> |
||||
<input type="text" class="counter__input" value="1"> |
||||
<button class="counter__button plus"> |
||||
<img src="assets/img/svg/main/plus.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
|
||||
<p class="modal-basket-item__price">1280</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="modal-basket__item"> |
||||
<div class="modal-basket-item__block-image"> |
||||
<img src="assets/img/product/image.png" alt="" class="modal-basket-item__image"> |
||||
</div> |
||||
|
||||
<div class="modal-basket-item__content"> |
||||
<p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p> |
||||
<p class="modal-basket-item__sub-title">Индейка, 2 кг</p> |
||||
<div class="modal-basket-item__control"> |
||||
<div class="counter counter--small"> |
||||
<button class="counter__button minus"> |
||||
<img src="assets/img/svg/main/minus.svg" alt=""> |
||||
</button> |
||||
<input type="text" class="counter__input" value="1"> |
||||
<button class="counter__button plus"> |
||||
<img src="assets/img/svg/main/plus.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
|
||||
<p class="modal-basket-item__price">1280</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="modal__footer"> |
||||
<div class="modal__block-price"> |
||||
<p class="modal-block-price__title">Общая стоимость</p> |
||||
<p class="modal-block-price__price"> |
||||
8960 |
||||
</p> |
||||
</div> |
||||
<div class="modal__block-button"> |
||||
<div class="modal__button"> |
||||
<button class="button button--gradient button--high button--100-perc"> |
||||
Перейти к оформлению |
||||
</button> |
||||
</div> |
||||
<div class="modal__button"> |
||||
<button class="to-know button--100-perc to-know--background-none"> |
||||
<p>Продолжить покупку</p> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal__item modal__to-know modal__item--no-title"> |
||||
<button class="modal__close"> |
||||
<img src="assets/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
<div class="modal__header"> |
||||
<p class="modal__small-title">Узнать о поступлении</p> |
||||
<p class="modal__text"> |
||||
Оставьте свой e-mail, и мы оповестим вас, когда продукт появится |
||||
</p> |
||||
|
||||
<form action="" class="modal__form-sub"> |
||||
<div class="label"> |
||||
<label for="mail" class="label__title"> |
||||
mail |
||||
</label> |
||||
|
||||
<div class="label__question"> |
||||
text <br> |
||||
re |
||||
</div> |
||||
</div> |
||||
<input type="text" class="form__input" id="mail" placeholder="Email"> |
||||
<div class="checkbox checkbox--small"> |
||||
<div class="checkbox__state"></div> |
||||
<input type="checkbox" name="" id="" class="checkbox__input"> |
||||
<label for="" class="checkbox__label"> |
||||
Я ознакомился с <a href="#">политикой обработки персональных данных</a> и <a href="#">пользовательским соглашением</a> |
||||
</label> |
||||
</div> |
||||
|
||||
<input type="submit" value="Оставить почту" class="button button--white button--red-48-px button--100-perc active modal-form-sub__submit"> |
||||
</form> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div class="modal__item modal__to-know-submit modal__item--no-title"> |
||||
<button class="modal__close"> |
||||
<img src="assets/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
<div class="modal__header"> |
||||
<p class="modal__small-title">Подписка на товар оформлена</p> |
||||
<p class="modal__text"> |
||||
На ваш e-mail ivan.ivanov@gmail.com придет письмо, как только продукт появится в наличии. |
||||
</p> |
||||
<button class="button button--white button--red-48-px button--100-perc active modal-form-sub__submit"> |
||||
Продолжить покупки |
||||
</button> |
||||
</div> |
||||
|
||||
</div> |
||||
</aside> |
||||
{# <div class="modal"> |
||||
<aside class="modal__aside"> |
||||
<div class="modal__item modal__filter"> |
||||
<button class="modal__close"> |
||||
<img src="assets/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
|
||||
<div class="modal__header"> |
||||
<p class="modal__title">Фильтры</p> |
||||
{{sidebar_filters}} |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal__item modal__basket"> |
||||
<button class="modal__close"> |
||||
<img src="assets/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
<div class="modal__header"> |
||||
<p class="modal__title">Корзина</p> |
||||
<div class="modal__content"> |
||||
<div class="modal-basket__item modal-basket__item--return"> |
||||
<p class="modal-basket-item__title"> |
||||
Удаление товра из корзины: 5с |
||||
</p> |
||||
|
||||
<button class="modal-basket-item__return"> |
||||
Восстановить |
||||
</button> |
||||
</div> |
||||
<div class="modal-basket__item"> |
||||
<div class="modal-basket-item__block-image"> |
||||
<img src="assets/img/product/image.png" alt="" class="modal-basket-item__image"> |
||||
</div> |
||||
|
||||
<div class="modal-basket-item__content"> |
||||
<p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p> |
||||
<p class="modal-basket-item__sub-title">Индейка, 2 кг</p> |
||||
<div class="modal-basket-item__control"> |
||||
<div class="counter counter--small"> |
||||
<button class="counter__button minus"> |
||||
<img src="assets/img/svg/main/minus.svg" alt=""> |
||||
</button> |
||||
<input type="text" class="counter__input" value="1"> |
||||
<button class="counter__button plus"> |
||||
<img src="assets/img/svg/main/plus.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
|
||||
<p class="modal-basket-item__price">1280</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="modal-basket__item"> |
||||
<div class="modal-basket-item__block-image"> |
||||
<img src="assets/img/product/image.png" alt="" class="modal-basket-item__image"> |
||||
</div> |
||||
|
||||
<div class="modal-basket-item__content"> |
||||
<p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p> |
||||
<p class="modal-basket-item__sub-title">Индейка, 2 кг</p> |
||||
<div class="modal-basket-item__control"> |
||||
<div class="counter counter--small"> |
||||
<button class="counter__button minus"> |
||||
<img src="assets/img/svg/main/minus.svg" alt=""> |
||||
</button> |
||||
<input type="text" class="counter__input" value="1"> |
||||
<button class="counter__button plus"> |
||||
<img src="assets/img/svg/main/plus.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
|
||||
<p class="modal-basket-item__price">1280</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="modal-basket__item"> |
||||
<div class="modal-basket-item__block-image"> |
||||
<img src="assets/img/product/image.png" alt="" class="modal-basket-item__image"> |
||||
</div> |
||||
|
||||
<div class="modal-basket-item__content"> |
||||
<p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p> |
||||
<p class="modal-basket-item__sub-title">Индейка, 2 кг</p> |
||||
<div class="modal-basket-item__control"> |
||||
<div class="counter counter--small"> |
||||
<button class="counter__button minus"> |
||||
<img src="assets/img/svg/main/minus.svg" alt=""> |
||||
</button> |
||||
<input type="text" class="counter__input" value="1"> |
||||
<button class="counter__button plus"> |
||||
<img src="assets/img/svg/main/plus.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
|
||||
<p class="modal-basket-item__price">1280</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="modal-basket__item"> |
||||
<div class="modal-basket-item__block-image"> |
||||
<img src="assets/img/product/image.png" alt="" class="modal-basket-item__image"> |
||||
</div> |
||||
|
||||
<div class="modal-basket-item__content"> |
||||
<p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p> |
||||
<p class="modal-basket-item__sub-title">Индейка, 2 кг</p> |
||||
<div class="modal-basket-item__control"> |
||||
<div class="counter counter--small"> |
||||
<button class="counter__button minus"> |
||||
<img src="assets/img/svg/main/minus.svg" alt=""> |
||||
</button> |
||||
<input type="text" class="counter__input" value="1"> |
||||
<button class="counter__button plus"> |
||||
<img src="assets/img/svg/main/plus.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
|
||||
<p class="modal-basket-item__price">1280</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="modal-basket__item"> |
||||
<div class="modal-basket-item__block-image"> |
||||
<img src="assets/img/product/image.png" alt="" class="modal-basket-item__image"> |
||||
</div> |
||||
|
||||
<div class="modal-basket-item__content"> |
||||
<p class="modal-basket-item__title">Сухой корм, для крупны и средних пород</p> |
||||
<p class="modal-basket-item__sub-title">Индейка, 2 кг</p> |
||||
<div class="modal-basket-item__control"> |
||||
<div class="counter counter--small"> |
||||
<button class="counter__button minus"> |
||||
<img src="assets/img/svg/main/minus.svg" alt=""> |
||||
</button> |
||||
<input type="text" class="counter__input" value="1"> |
||||
<button class="counter__button plus"> |
||||
<img src="assets/img/svg/main/plus.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
|
||||
<p class="modal-basket-item__price">1280</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="modal__footer"> |
||||
<div class="modal__block-price"> |
||||
<p class="modal-block-price__title">Общая стоимость</p> |
||||
<p class="modal-block-price__price"> |
||||
8960 |
||||
</p> |
||||
</div> |
||||
<div class="modal__block-button"> |
||||
<div class="modal__button"> |
||||
<button class="button button--gradient button--high button--100-perc"> |
||||
Перейти к оформлению |
||||
</button> |
||||
</div> |
||||
<div class="modal__button"> |
||||
<button class="to-know button--100-perc to-know--background-none"> |
||||
<p>Продолжить покупку</p> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="modal__item modal__to-know modal__item--no-title"> |
||||
<button class="modal__close"> |
||||
<img src="assets/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
<div class="modal__header"> |
||||
<p class="modal__small-title">Узнать о поступлении</p> |
||||
<p class="modal__text"> |
||||
Оставьте свой e-mail, и мы оповестим вас, когда продукт появится |
||||
</p> |
||||
|
||||
<form action="" class="modal__form-sub"> |
||||
<div class="label"> |
||||
<label for="mail" class="label__title"> |
||||
mail |
||||
</label> |
||||
|
||||
<div class="label__question"> |
||||
text <br> |
||||
re |
||||
</div> |
||||
</div> |
||||
<input type="text" class="form__input" id="mail" placeholder="Email"> |
||||
<div class="checkbox checkbox--small"> |
||||
<div class="checkbox__state"></div> |
||||
<input type="checkbox" name="" id="" class="checkbox__input"> |
||||
<label for="" class="checkbox__label"> |
||||
Я ознакомился с <a href="#">политикой обработки персональных данных</a> и <a href="#">пользовательским соглашением</a> |
||||
</label> |
||||
</div> |
||||
|
||||
<input type="submit" value="Оставить почту" class="button button--white button--red-48-px button--100-perc active modal-form-sub__submit"> |
||||
</form> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div class="modal__item modal__to-know-submit modal__item--no-title"> |
||||
<button class="modal__close"> |
||||
<img src="assets/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
<div class="modal__header"> |
||||
<p class="modal__small-title">Подписка на товар оформлена</p> |
||||
<p class="modal__text"> |
||||
На ваш e-mail ivan.ivanov@gmail.com придет письмо, как только продукт появится в наличии. |
||||
</p> |
||||
<button class="button button--white button--red-48-px button--100-perc active modal-form-sub__submit"> |
||||
Продолжить покупки |
||||
</button> |
||||
</div> |
||||
|
||||
</div> |
||||
</aside> |
||||
</div> #} |
@ -1,121 +1,121 @@ |
||||
{% if post.id is defined and post.id %} |
||||
{% set cur_product = fn('wc_get_product', post.id) %} |
||||
{% set attrs = post.product.get_attributes() %} |
||||
{% set cur_weight = function('get_product_info', post.id, 'weight') %} |
||||
|
||||
<div class="product__item"> |
||||
<div class="product-item__label"> |
||||
{% if post.date('Y-m-d') >= criteria_for_new_product %} |
||||
<span class="product-item-label__tag product-item-label__tag--new"> |
||||
{{ function('pll_e', 'Новинка') }} |
||||
</span> |
||||
{% endif %} |
||||
|
||||
{% if post._sale_price %} |
||||
<span class="product-item-label__tag product-item-label__tag--sale"> |
||||
{{ function('pll_e', 'Распродажа %') }} |
||||
</span> |
||||
{% endif %} |
||||
</div> |
||||
<a href="{{ post.link }}" class="product-item__product-card"> |
||||
<img src="{{ post.thumbnail.src('shop_single') }}" alt="{{ post.title }}" class="product-item__images"> |
||||
</a> |
||||
<div class="product-item__content-card"> |
||||
<div class="compound"> |
||||
{% set compound = fn('wc_get_product_terms', post.id, 'pa_compound') %} |
||||
{% for option in compound %} |
||||
|
||||
{% set term = get_term(option) %} |
||||
<a href="/compound/{{ term.slug }}" class="compound__item">{{ term.name }}</a> |
||||
{% endfor %} |
||||
</div> |
||||
<a href="{{ post.link }}" class="product-item__title">{{ post.title }}</a> |
||||
<div class="product-item__price"> |
||||
<p>{{ post._price() }} {{ fn('get_woocommerce_currency_symbol') }}</p> |
||||
</div> |
||||
<div class="product-item__bye"> |
||||
<button class="button button--white button--100-perc open-overlay"> |
||||
{{ function('pll_e', 'Купить') }} |
||||
</button> |
||||
</div> |
||||
</div> |
||||
<div class="product-item__overlay"> |
||||
<div class="product-item-overlay__header"> |
||||
<a href="{{ post.link }}" class="product-item__title">{{ post.title }}</a> |
||||
|
||||
<ul class="product-item-overlay__tags"> |
||||
{% set features = fn('wc_get_product_terms', post.id, 'pa_features') %} |
||||
{% for option in features %} |
||||
{% set term = get_term(option) %} |
||||
<li>{{ term.name }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
</div> |
||||
|
||||
<form class="product-item__form" method="post" action="/send-telegram.php"> |
||||
<div class="product-item-overlay__input-block"> |
||||
{% set collection = fn('wc_get_product_terms', post.id, 'pa_collection') %} |
||||
{% if collection %} |
||||
<div class="product-item-overlay__field"> |
||||
<p class="product-item-overlay-field__title">{{ fn('pll_e', 'Объем') }}</p> |
||||
|
||||
<div class="select"> |
||||
<input type="text" class="select__state" value="{{ cur_weight }}" readonly data-product_id="{{post.id}}" data-product_price="{{ post._price() }}"> |
||||
<div class="state__block"> |
||||
<ul class="state__content"> |
||||
|
||||
{% for option in collection %} |
||||
{% set term = get_term(option) %} |
||||
{% set siblings = function('get_collection_siblings' , term.id) %} |
||||
|
||||
{% for sibling in siblings %} |
||||
|
||||
{% set weight = function('get_product_info', sibling.ID, 'weight') %} |
||||
|
||||
{% set class = '' %} |
||||
{% if weight == cur_weight %} |
||||
{% set class = 'active' %} |
||||
{% endif %} |
||||
<li> |
||||
<button class="state__button {{ class }}" data-product_id="{{sibling.ID}}" data-product_price="{{ function('get_product_info', sibling.ID, 'price') }}"> |
||||
{{ weight }} |
||||
</button> |
||||
</li> |
||||
{% endfor %} |
||||
{% endfor %} |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
<div class="product-item-overlay__field"> |
||||
<p class="product-item-overlay-field__title">{{ fn('pll_e', 'Количество') }}</p> |
||||
|
||||
<div class="counter"> |
||||
<button class="counter__button minus"> |
||||
<img src="{{ theme.link }}/woocommerce/assets/img/svg/main/minus.svg" alt=""> |
||||
</button> |
||||
<input type="text" class="counter__input" value="1"> |
||||
<button class="counter__button plus"> |
||||
<img src="{{ theme.link }}/woocommerce/assets/img/svg/main/plus.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<p class="product-item-overlay__price"> |
||||
{{ post._price() }} |
||||
</p> |
||||
<div class="product-item-overlay__block-button"> |
||||
<div class="product-item-overlay__button"> |
||||
{{ function('get_add_to_cart_button', post.id) }} |
||||
</div> |
||||
<div class="product-item-overlay__more_button"> |
||||
<a class="to-know button--100-perc" href="{{ post.link }}"> |
||||
<p>{{ function('pll_e', 'Подробнее') }}</p> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
{% if post.id is defined and post.id %} |
||||
{% set cur_product = fn('wc_get_product', post.id) %} |
||||
{% set attrs = post.product.get_attributes() %} |
||||
{% set cur_weight = function('get_product_info', post.id, 'weight') %} |
||||
|
||||
<div class="product__item"> |
||||
<div class="product-item__label"> |
||||
{% if post.date('Y-m-d') >= criteria_for_new_product %} |
||||
<span class="product-item-label__tag product-item-label__tag--new"> |
||||
{{ function('pll_e', 'Новинка') }} |
||||
</span> |
||||
{% endif %} |
||||
|
||||
{% if post._sale_price %} |
||||
<span class="product-item-label__tag product-item-label__tag--sale"> |
||||
{{ function('pll_e', 'Распродажа %') }} |
||||
</span> |
||||
{% endif %} |
||||
</div> |
||||
<a href="{{ post.link }}" class="product-item__product-card"> |
||||
<img src="{{ post.thumbnail.src('shop_single') }}" alt="{{ post.title }}" class="product-item__images"> |
||||
</a> |
||||
<div class="product-item__content-card"> |
||||
<div class="compound"> |
||||
{% set compound = fn('wc_get_product_terms', post.id, 'pa_compound') %} |
||||
{% for option in compound %} |
||||
|
||||
{% set term = get_term(option) %} |
||||
<a href="/compound/{{ term.slug }}" class="compound__item">{{ term.name }}</a> |
||||
{% endfor %} |
||||
</div> |
||||
<a href="{{ post.link }}" class="product-item__title">{{ post.title }}</a> |
||||
<div class="product-item__price"> |
||||
<p>{{ post._price() }} {{ fn('get_woocommerce_currency_symbol') }}</p> |
||||
</div> |
||||
<div class="product-item__bye"> |
||||
<button class="button button--white button--100-perc open-overlay"> |
||||
{{ function('pll_e', 'Купить') }} |
||||
</button> |
||||
</div> |
||||
</div> |
||||
<div class="product-item__overlay"> |
||||
<div class="product-item-overlay__header"> |
||||
<a href="{{ post.link }}" class="product-item__title">{{ post.title }}</a> |
||||
|
||||
<ul class="product-item-overlay__tags"> |
||||
{% set features = fn('wc_get_product_terms', post.id, 'pa_features') %} |
||||
{% for option in features %} |
||||
{% set term = get_term(option) %} |
||||
<li>{{ term.name }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
</div> |
||||
|
||||
<form class="product-item__form" method="post" action="/send-telegram.php"> |
||||
<div class="product-item-overlay__input-block"> |
||||
{% set collection = fn('wc_get_product_terms', post.id, 'pa_collection') %} |
||||
{% if collection %} |
||||
<div class="product-item-overlay__field"> |
||||
<p class="product-item-overlay-field__title">{{ fn('pll_e', 'Объем') }}</p> |
||||
|
||||
<div class="select"> |
||||
<input type="text" class="select__state" value="{{ cur_weight }}" readonly data-product_id="{{post.id}}" data-product_price="{{ post._price() }}"> |
||||
<div class="state__block"> |
||||
<ul class="state__content"> |
||||
|
||||
{% for option in collection %} |
||||
{% set term = get_term(option) %} |
||||
{% set siblings = function('get_collection_siblings' , term.id) %} |
||||
|
||||
{% for sibling in siblings %} |
||||
|
||||
{% set weight = function('get_product_info', sibling.ID, 'weight') %} |
||||
|
||||
{% set class = '' %} |
||||
{% if weight == cur_weight %} |
||||
{% set class = 'active' %} |
||||
{% endif %} |
||||
<li> |
||||
<button class="state__button {{ class }}" data-product_id="{{sibling.ID}}" data-product_price="{{ function('get_product_info', sibling.ID, 'price') }}"> |
||||
{{ weight }} |
||||
</button> |
||||
</li> |
||||
{% endfor %} |
||||
{% endfor %} |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
<div class="product-item-overlay__field"> |
||||
<p class="product-item-overlay-field__title">{{ fn('pll_e', 'Количество') }}</p> |
||||
|
||||
<div class="counter"> |
||||
<button class="counter__button minus"> |
||||
<img src="{{ theme.link }}/woocommerce/assets/img/svg/main/minus.svg" alt=""> |
||||
</button> |
||||
<input type="text" class="counter__input" value="1"> |
||||
<button class="counter__button plus"> |
||||
<img src="{{ theme.link }}/woocommerce/assets/img/svg/main/plus.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<p class="product-item-overlay__price"> |
||||
{{ post._price() }} |
||||
</p> |
||||
<div class="product-item-overlay__block-button"> |
||||
<div class="product-item-overlay__button"> |
||||
{{ function('get_add_to_cart_button', post.id) }} |
||||
</div> |
||||
<div class="product-item-overlay__more_button"> |
||||
<a class="to-know button--100-perc" href="{{ post.link }}"> |
||||
<p>{{ function('pll_e', 'Подробнее') }}</p> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
@ -1,110 +1,110 @@ |
||||
'use strict'; |
||||
|
||||
// slider gallery modal
|
||||
const gallery = new Swiper('.gallery__slider', { |
||||
spaceBetween: 100, |
||||
|
||||
pagination: { |
||||
el: '.swiper-pagination', |
||||
}, |
||||
|
||||
navigation: { |
||||
nextEl: '.swiper-button-next', |
||||
prevEl: '.swiper-button-prev', |
||||
}, |
||||
|
||||
scrollbar: { |
||||
el: '.swiper-scrollbar', |
||||
}, |
||||
}); |
||||
|
||||
let paginationButtons = document.querySelectorAll('.gallery-pagination__item'); |
||||
|
||||
paginationButtons.forEach(button => { |
||||
let index = button.dataset.countImg; |
||||
|
||||
button.onclick = function () { |
||||
gallery.slideTo(index); |
||||
} |
||||
}) |
||||
|
||||
// open gallery
|
||||
let detailImage= document.querySelectorAll('.detail__image'); |
||||
detailImage.forEach(button => { |
||||
let index = button.dataset.countImg; |
||||
|
||||
button.onclick = function () { |
||||
gallery.slideTo(index); |
||||
|
||||
document.querySelector('.gallery').classList.add('active'); |
||||
} |
||||
}) |
||||
|
||||
// close gallery
|
||||
|
||||
document.querySelector('.gallery__close').onclick = function () { |
||||
document.querySelector('.gallery').classList.remove('active'); |
||||
} |
||||
// slider gallery modal
|
||||
|
||||
// slider gallery main phone
|
||||
|
||||
// createGalleryPhone('.detail__images', '.detail-images__wrapper', '.detail__image', 980);
|
||||
|
||||
const detailPhone = new Swiper('.detail__images-phone', { |
||||
spaceBetween: 100, |
||||
|
||||
pagination: { |
||||
el: '.swiper-pagination', |
||||
}, |
||||
|
||||
navigation: { |
||||
nextEl: '.swiper-button-next', |
||||
prevEl: '.swiper-button-prev', |
||||
}, |
||||
|
||||
scrollbar: { |
||||
el: '.swiper-scrollbar', |
||||
}, |
||||
}); |
||||
|
||||
let detailImagesPhones = document.querySelectorAll('.detail-images-phone__image-block'); |
||||
|
||||
detailImagesPhones.forEach(button => { |
||||
button.onclick = function (e) { |
||||
let index = button.dataset.countImg; |
||||
|
||||
gallery.slideTo(index); |
||||
|
||||
document.querySelector('.gallery').classList.add('active'); |
||||
} |
||||
}) |
||||
|
||||
// slider gallery main phone
|
||||
|
||||
// detail catalog
|
||||
const detailCatalot = new Swiper('.detail__catalot', { |
||||
// Navigation arrows
|
||||
navigation: { |
||||
nextEl: '.detail-catalot-control__button.next', |
||||
prevEl: '.detail-catalot-control__button.prev', |
||||
}, |
||||
breakpoints: { |
||||
1600: { |
||||
slidesPerView: 4, |
||||
}, |
||||
1200: { |
||||
slidesPerView: 3, |
||||
}, |
||||
780: { |
||||
slidesPerView: 2, |
||||
}, |
||||
100: { |
||||
slidesPerView: 1.1, |
||||
spaceBetween: 20 |
||||
}, |
||||
} |
||||
|
||||
|
||||
}); |
||||
'use strict'; |
||||
|
||||
// slider gallery modal
|
||||
const gallery = new Swiper('.gallery__slider', { |
||||
spaceBetween: 100, |
||||
|
||||
pagination: { |
||||
el: '.swiper-pagination', |
||||
}, |
||||
|
||||
navigation: { |
||||
nextEl: '.swiper-button-next', |
||||
prevEl: '.swiper-button-prev', |
||||
}, |
||||
|
||||
scrollbar: { |
||||
el: '.swiper-scrollbar', |
||||
}, |
||||
}); |
||||
|
||||
let paginationButtons = document.querySelectorAll('.gallery-pagination__item'); |
||||
|
||||
paginationButtons.forEach(button => { |
||||
let index = button.dataset.countImg; |
||||
|
||||
button.onclick = function () { |
||||
gallery.slideTo(index); |
||||
} |
||||
}) |
||||
|
||||
// open gallery
|
||||
let detailImage= document.querySelectorAll('.detail__image'); |
||||
detailImage.forEach(button => { |
||||
let index = button.dataset.countImg; |
||||
|
||||
button.onclick = function () { |
||||
gallery.slideTo(index); |
||||
|
||||
document.querySelector('.gallery').classList.add('active'); |
||||
} |
||||
}) |
||||
|
||||
// close gallery
|
||||
|
||||
document.querySelector('.gallery__close').onclick = function () { |
||||
document.querySelector('.gallery').classList.remove('active'); |
||||
} |
||||
// slider gallery modal
|
||||
|
||||
// slider gallery main phone
|
||||
|
||||
// createGalleryPhone('.detail__images', '.detail-images__wrapper', '.detail__image', 980);
|
||||
|
||||
const detailPhone = new Swiper('.detail__images-phone', { |
||||
spaceBetween: 100, |
||||
|
||||
pagination: { |
||||
el: '.swiper-pagination', |
||||
}, |
||||
|
||||
navigation: { |
||||
nextEl: '.swiper-button-next', |
||||
prevEl: '.swiper-button-prev', |
||||
}, |
||||
|
||||
scrollbar: { |
||||
el: '.swiper-scrollbar', |
||||
}, |
||||
}); |
||||
|
||||
let detailImagesPhones = document.querySelectorAll('.detail-images-phone__image-block'); |
||||
|
||||
detailImagesPhones.forEach(button => { |
||||
button.onclick = function (e) { |
||||
let index = button.dataset.countImg; |
||||
|
||||
gallery.slideTo(index); |
||||
|
||||
document.querySelector('.gallery').classList.add('active'); |
||||
} |
||||
}) |
||||
|
||||
// slider gallery main phone
|
||||
|
||||
// detail catalog
|
||||
const detailCatalot = new Swiper('.detail__catalot', { |
||||
// Navigation arrows
|
||||
navigation: { |
||||
nextEl: '.detail-catalot-control__button.next', |
||||
prevEl: '.detail-catalot-control__button.prev', |
||||
}, |
||||
breakpoints: { |
||||
1600: { |
||||
slidesPerView: 4, |
||||
}, |
||||
1200: { |
||||
slidesPerView: 3, |
||||
}, |
||||
780: { |
||||
slidesPerView: 2, |
||||
}, |
||||
100: { |
||||
slidesPerView: 1.1, |
||||
spaceBetween: 20 |
||||
}, |
||||
} |
||||
|
||||
|
||||
}); |
||||
// detail catalog
|
@ -1,121 +1,121 @@ |
||||
<?php |
||||
/** |
||||
* Shipping Methods Display |
||||
* |
||||
* 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. |
||||
* |
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you |
||||
* (the theme developer) will need to copy the new files to your theme to |
||||
* maintain compatibility. We try to do this as little as possible, but it does |
||||
* happen. When this occurs the version of the template file will be bumped and |
||||
* the readme will list any important changes. |
||||
* |
||||
* @see https://woocommerce.com/document/template-structure/ |
||||
* @package WooCommerce\Templates |
||||
* @version 8.8.0 |
||||
*/ |
||||
|
||||
defined( 'ABSPATH' ) || exit; |
||||
|
||||
|
||||
|
||||
$formatted_destination = isset( $formatted_destination ) ? $formatted_destination : WC()->countries->get_formatted_address( $package['destination'], ', ' ); |
||||
$has_calculated_shipping = ! empty( $has_calculated_shipping ); |
||||
$show_shipping_calculator = ! empty( $show_shipping_calculator ); |
||||
$calculator_text = ''; |
||||
|
||||
?> |
||||
|
||||
|
||||
<tr class="woocommerce-shipping-totals shipping"> |
||||
<?php |
||||
|
||||
?> |
||||
<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 ) ) : ?> |
||||
<ul id="shipping_method" class="woocommerce-shipping-methods"> |
||||
<?php foreach ( $available_methods as $method ) : |
||||
|
||||
$pattern = '/^(.*?),\s*\((.*?)\)$/'; |
||||
if (preg_match($pattern, $method->label, $matches)) { |
||||
$text_before_comma = trim($matches[1]); // Текст до запятой |
||||
$text_in_parentheses = trim($matches[2]); // Текст в скобках |
||||
} else { |
||||
$text_before_comma = ''; |
||||
$text_in_parentheses = ''; |
||||
} |
||||
if ($text_before_comma == 'CDEK: Посылка склад-дверь'){ |
||||
$title = 'Курьером'; |
||||
} |
||||
else if ($text_before_comma == 'CDEK: Посылка склад-склад'){ |
||||
$title = 'Пункт выдачи'; |
||||
} |
||||
?> |
||||
|
||||
<li data-remote="<?php echo $method->id ?>" class="modal-map-control__item <?php if ($method->id == $chosen_method): ?>active <?php endif; ?>">
|
||||
|
||||
<label> |
||||
<div class="modal-map-control-item__content"> |
||||
<div class="modal-map-control-item__header"> |
||||
<div class="modal-map-control-item__circle"><div class="modal-map-control-item-circle__content"></div></div> |
||||
<p class="modal-map-control-item__title"> |
||||
<?php |
||||
echo $title; |
||||
?> |
||||
</p> |
||||
</div> |
||||
<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__price"> <?php |
||||
echo $method->cost; |
||||
?>₽</p> |
||||
</div> |
||||
<?php do_action( 'woocommerce_after_shipping_rate', $method, $index ); ?> |
||||
</div> |
||||
<?php |
||||
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. |
||||
} 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. |
||||
} |
||||
?> |
||||
</label> |
||||
</li> |
||||
<?php endforeach; ?> |
||||
<?php
|
||||
?> |
||||
</ul> |
||||
<?php if ( is_cart() ) : ?> |
||||
<p class="woocommerce-shipping-destination"> |
||||
<?php |
||||
if ( $formatted_destination ) { |
||||
// Translators: $s shipping destination. |
||||
printf( esc_html__( 'Shipping to %s.', 'woocommerce' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' ); |
||||
$calculator_text = esc_html__( 'Change address', 'woocommerce' ); |
||||
} else { |
||||
echo wp_kses_post( apply_filters( 'woocommerce_shipping_estimate_html', __( 'Shipping options will be updated during checkout.', 'woocommerce' ) ) ); |
||||
} |
||||
?> |
||||
</p> |
||||
<?php endif; ?> |
||||
<?php |
||||
else: |
||||
?> |
||||
<p> Нет доступных способов доставки. Для отображение доступных методов укажите ваш город.</p> |
||||
|
||||
<?php |
||||
|
||||
endif; |
||||
?> |
||||
|
||||
|
||||
|
||||
</td> |
||||
</tr> |
||||
|
||||
|
||||
<style> |
||||
|
||||
<?php |
||||
/** |
||||
* Shipping Methods Display |
||||
* |
||||
* 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. |
||||
* |
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you |
||||
* (the theme developer) will need to copy the new files to your theme to |
||||
* maintain compatibility. We try to do this as little as possible, but it does |
||||
* happen. When this occurs the version of the template file will be bumped and |
||||
* the readme will list any important changes. |
||||
* |
||||
* @see https://woocommerce.com/document/template-structure/ |
||||
* @package WooCommerce\Templates |
||||
* @version 8.8.0 |
||||
*/ |
||||
|
||||
defined( 'ABSPATH' ) || exit; |
||||
|
||||
|
||||
|
||||
$formatted_destination = isset( $formatted_destination ) ? $formatted_destination : WC()->countries->get_formatted_address( $package['destination'], ', ' ); |
||||
$has_calculated_shipping = ! empty( $has_calculated_shipping ); |
||||
$show_shipping_calculator = ! empty( $show_shipping_calculator ); |
||||
$calculator_text = ''; |
||||
|
||||
?> |
||||
|
||||
|
||||
<tr class="woocommerce-shipping-totals shipping"> |
||||
<?php |
||||
|
||||
?> |
||||
<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 ) ) : ?> |
||||
<ul id="shipping_method" class="woocommerce-shipping-methods"> |
||||
<?php foreach ( $available_methods as $method ) : |
||||
|
||||
$pattern = '/^(.*?),\s*\((.*?)\)$/'; |
||||
if (preg_match($pattern, $method->label, $matches)) { |
||||
$text_before_comma = trim($matches[1]); // Текст до запятой |
||||
$text_in_parentheses = trim($matches[2]); // Текст в скобках |
||||
} else { |
||||
$text_before_comma = ''; |
||||
$text_in_parentheses = ''; |
||||
} |
||||
if ($text_before_comma == 'CDEK: Посылка склад-дверь'){ |
||||
$title = 'Курьером'; |
||||
} |
||||
else if ($text_before_comma == 'CDEK: Посылка склад-склад'){ |
||||
$title = 'Пункт выдачи'; |
||||
} |
||||
?> |
||||
|
||||
<li data-remote="<?php echo $method->id ?>" class="modal-map-control__item <?php if ($method->id == $chosen_method): ?>active <?php endif; ?>">
|
||||
|
||||
<label> |
||||
<div class="modal-map-control-item__content"> |
||||
<div class="modal-map-control-item__header"> |
||||
<div class="modal-map-control-item__circle"><div class="modal-map-control-item-circle__content"></div></div> |
||||
<p class="modal-map-control-item__title"> |
||||
<?php |
||||
echo $title; |
||||
?> |
||||
</p> |
||||
</div> |
||||
<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__price"> <?php |
||||
echo $method->cost; |
||||
?>₽</p> |
||||
</div> |
||||
<?php do_action( 'woocommerce_after_shipping_rate', $method, $index ); ?> |
||||
</div> |
||||
<?php |
||||
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. |
||||
} 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. |
||||
} |
||||
?> |
||||
</label> |
||||
</li> |
||||
<?php endforeach; ?> |
||||
<?php
|
||||
?> |
||||
</ul> |
||||
<?php if ( is_cart() ) : ?> |
||||
<p class="woocommerce-shipping-destination"> |
||||
<?php |
||||
if ( $formatted_destination ) { |
||||
// Translators: $s shipping destination. |
||||
printf( esc_html__( 'Shipping to %s.', 'woocommerce' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' ); |
||||
$calculator_text = esc_html__( 'Change address', 'woocommerce' ); |
||||
} else { |
||||
echo wp_kses_post( apply_filters( 'woocommerce_shipping_estimate_html', __( 'Shipping options will be updated during checkout.', 'woocommerce' ) ) ); |
||||
} |
||||
?> |
||||
</p> |
||||
<?php endif; ?> |
||||
<?php |
||||
else: |
||||
?> |
||||
<p> Нет доступных способов доставки. Для отображение доступных методов укажите ваш город.</p> |
||||
|
||||
<?php |
||||
|
||||
endif; |
||||
?> |
||||
|
||||
|
||||
|
||||
</td> |
||||
</tr> |
||||
|
||||
|
||||
<style> |
||||
|
||||
</style> |
@ -1,29 +1,29 @@ |
||||
<?php |
||||
/** |
||||
* Checkout Form |
||||
* |
||||
* @see https://docs.woocommerce.com/document/template-structure/ |
||||
* @package WooCommerce/Templates |
||||
* @version 3.5.0 |
||||
*/ |
||||
|
||||
if (!defined('ABSPATH')) { |
||||
exit; |
||||
} |
||||
|
||||
// Get Timber context |
||||
$context = Timber::context(); |
||||
|
||||
// Add WooCommerce-specific data to context |
||||
$context['checkout'] = WC()->checkout(); |
||||
|
||||
// In your theme's functions.php |
||||
add_filter('timber/twig', function($twig) { |
||||
$twig->addFunction(new \Twig\TwigFunction('WC', function() { |
||||
return WC(); |
||||
})); |
||||
return $twig; |
||||
}); |
||||
|
||||
// Render the Twig template |
||||
<?php |
||||
/** |
||||
* Checkout Form |
||||
* |
||||
* @see https://docs.woocommerce.com/document/template-structure/ |
||||
* @package WooCommerce/Templates |
||||
* @version 3.5.0 |
||||
*/ |
||||
|
||||
if (!defined('ABSPATH')) { |
||||
exit; |
||||
} |
||||
|
||||
// Get Timber context |
||||
$context = Timber::context(); |
||||
|
||||
// Add WooCommerce-specific data to context |
||||
$context['checkout'] = WC()->checkout(); |
||||
|
||||
// In your theme's functions.php |
||||
add_filter('timber/twig', function($twig) { |
||||
$twig->addFunction(new \Twig\TwigFunction('WC', function() { |
||||
return WC(); |
||||
})); |
||||
return $twig; |
||||
}); |
||||
|
||||
// Render the Twig template |
||||
Timber::render('shop/checkout.twig', $context); |
@ -1,19 +1,19 @@ |
||||
<?php |
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) { |
||||
exit; |
||||
} |
||||
|
||||
get_header(); |
||||
|
||||
$template_path = 'templates/shop/single-product.php'; |
||||
if (file_exists(get_template_directory() . '/' . $template_path)) { |
||||
include_once get_template_directory() . '/' . $template_path; |
||||
} else { |
||||
|
||||
while (have_posts()) : the_post(); |
||||
wc_get_template_part('content', 'single-product'); |
||||
endwhile; |
||||
} |
||||
|
||||
<?php |
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) { |
||||
exit; |
||||
} |
||||
|
||||
get_header(); |
||||
|
||||
$template_path = 'templates/shop/single-product.php'; |
||||
if (file_exists(get_template_directory() . '/' . $template_path)) { |
||||
include_once get_template_directory() . '/' . $template_path; |
||||
} else { |
||||
|
||||
while (have_posts()) : the_post(); |
||||
wc_get_template_part('content', 'single-product'); |
||||
endwhile; |
||||
} |
||||
|
||||
get_footer(); |
Loading…
Reference in new issue