Compare commits

...

2 Commits

  1. 6
      wp-content/themes/cosmopet/global-functions/multisite-functions.php
  2. 137
      wp-content/themes/cosmopet/modules/profile/module-ajax-controller.php
  3. 2
      wp-content/themes/cosmopet/modules/shop/components/checkout/assets/js/script.js
  4. 6
      wp-content/themes/cosmopet/static/front-page/css/style.css
  5. 1
      wp-content/themes/cosmopet/templates/header.twig

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

@ -1,3 +1,4 @@
<<<<<<< HEAD
<?php <?php
// include_module('profile'); // include_module('profile');
@ -132,3 +133,139 @@ function ajax_edit_pet() {
add_action('wp_ajax_edit_pet', 'ajax_edit_pet'); add_action('wp_ajax_edit_pet', 'ajax_edit_pet');
add_action('wp_ajax_nopriv_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

@ -211,7 +211,7 @@ jQuery(document).ready(function($) {
$filterList.append($filterTag); $filterList.append($filterTag);
}); });
}); });
W2 else { } else {
$filterContainer.hide(); $filterContainer.hide();
$clearButton.hide(); $clearButton.hide();
} }

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

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

Loading…
Cancel
Save