diff --git a/wp-content/themes/cosmopet/functions.php b/wp-content/themes/cosmopet/functions.php index a5ca5c2..71ff31b 100644 --- a/wp-content/themes/cosmopet/functions.php +++ b/wp-content/themes/cosmopet/functions.php @@ -439,16 +439,6 @@ require_once('modules/author/module-ajax-controller.php'); include_module('forms'); include_module('layout'); -add_action('wp_enqueue_scripts', 'disable_woocommerce_css', 999); -function disable_woocommerce_css() { - wp_dequeue_style('woocommerce-general'); - wp_dequeue_style('woocommerce-layout'); - wp_dequeue_style('woocommerce-smallscreen'); - wp_dequeue_style('woocommerce_frontend_styles'); - wp_dequeue_style('woocommerce_fancybox_styles'); - wp_dequeue_style('woocommerce_chosen_styles'); - wp_dequeue_style('woocommerce_prettyPhoto_css'); -} class WooProduct extends Timber\Post { @@ -1190,4 +1180,18 @@ function custom_redirect_cart_page() { wp_redirect(home_url('/')); exit; } +} + +add_action('wp_enqueue_scripts', 'remove_woocommerce_styles_on_checkout', 9999); +function remove_woocommerce_styles_on_checkout() { + // Проверяем, что мы на странице чекаута + if (function_exists('is_checkout') && is_checkout() && !is_order_received_page()) { + wp_deregister_style('woocommerce-layout'); + wp_deregister_style('woocommerce-smallscreen'); + wp_deregister_style('woocommerce-general'); + + // Дополнительно: отключить другие стили WooCommerce + wp_dequeue_style('select2'); + wp_deregister_style('select2'); + } } \ No newline at end of file diff --git a/wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css b/wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css index 78f1e7f..d1a5d6b 100644 --- a/wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css +++ b/wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css @@ -175,11 +175,11 @@ body { height: 96px; width: 100%; resize: none; - background: var(--main_white); - border: 1px solid var(--placeholder); + background: var(--main_white) !important; + border: 1px solid var(--placeholder) !important;; padding: 12px 16px; border-radius: 20px; - color: var(--main_black); + color: var(--main_black) !important; font-size: 20px; font-weight: 400; line-height: 24px; @@ -1878,16 +1878,16 @@ textarea{ border-radius: 20px; padding: 12px 16px; - border: 1px solid var(--text-black); + border: 1px solid var(--text-black) !important; - background: var(--background-white); + background: var(--background-white) !important; - font-family: var(--font-family); + font-family: var(--font-family) !important; font-weight: 400; font-size: 20px; line-height: 120%; - color: var(--text-black); + color: var(--text-black) !important; } .form__input::placeholder{ color: var(--text-grey); diff --git a/wp-content/themes/cosmopet/modules/layout/assets/js/gp-form.js b/wp-content/themes/cosmopet/modules/layout/assets/js/gp-form.js index 9bfcdd9..bf515fa 100644 --- a/wp-content/themes/cosmopet/modules/layout/assets/js/gp-form.js +++ b/wp-content/themes/cosmopet/modules/layout/assets/js/gp-form.js @@ -171,38 +171,50 @@ function remoteControl(main, button) { let mains = document.querySelectorAll(main); mains.forEach(main => { - let subjectClass = main.dataset.content, - subject = document.querySelector(`.${subjectClass}`), - buttons = Array.from(main.querySelectorAll(button)); + let subjectClass = main.dataset.content; + if (!subjectClass) return; // Skip if no data-content attribute + + let subject = document.querySelector(`.${subjectClass}`); + if (!subject) { + console.warn(`Element with class "${subjectClass}" not found`); + return; // Skip if subject element doesn't exist + } - main.addEventListener('click', function (eventMain) { + let buttons = Array.from(main.querySelectorAll(button)); + if (!buttons.length) return; // Skip if no buttons found + + main.addEventListener('click', function(eventMain) { setTimeout(() => { - let indexActive = buttons.findIndex((button, index) => { - if (button.classList.contains('active')) { - return true; - } + let indexActive = buttons.findIndex(button => { + return button.classList.contains('active'); }); - if(subject.children[indexActive].classList.contains('active')){ - return ; + + // Check if subject has children and index is valid + if (!subject.children.length || indexActive === -1 || indexActive >= subject.children.length) { + return; + } + + let activeItem = subject.querySelector('.remote-control__item.active'); + if (activeItem) { + activeItem.classList.remove('active'); + } + + if (subject.children[indexActive].classList.contains('active')) { + return; } - subject.querySelector('.remote-control__item.active').classList.remove('active'); subject.children[indexActive].classList.add('active'); let mandatorys = subject.querySelectorAll('.mandatory'); - - mandatorys.forEach(mandatory => { - if (mandatory.required) { - mandatory.required = false; - }else{ - mandatory.required = true; - } - }) + if (mandatorys.length) { + mandatorys.forEach(mandatory => { + mandatory.required = !mandatory.required; + }); + } }, 0); - }) - }) + }); + }); } - formCheck('.modal-form__content', 'input[type=submit]'); formCheck('.modal-map__form', 'input[type=submit]'); diff --git a/wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js b/wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js index a77fde9..13d0dd1 100644 --- a/wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js +++ b/wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js @@ -415,3 +415,15 @@ if (document.querySelector('.header').classList.contains('white')) { // scroll + + +jQuery(document).ready(function($) { + jQuery('.popup-wrap').on('click', function(e) { + if (e.target === this) { + $(this).closest('.modalProfile').removeClass('active'); + } + }); + $('.close-btn').on('click', function(e) { + $('.modalProfile').removeClass('active'); + }); +}); \ No newline at end of file diff --git a/wp-content/themes/cosmopet/static/assets/css/thankyou.css b/wp-content/themes/cosmopet/static/assets/css/thankyou.css new file mode 100644 index 0000000..6055e3b --- /dev/null +++ b/wp-content/themes/cosmopet/static/assets/css/thankyou.css @@ -0,0 +1,65 @@ +/* Основные стили страницы */ +.woocommerce-order { + max-width: 800px; + margin: 2rem auto; + padding: 2rem; + background: #fff; + box-shadow: 0 0 10px rgba(0,0,0,0.1); + border-radius: 8px; +} + +/* Заголовок */ +.woocommerce-order h2.woocommerce-order-details__title, +.woocommerce-order h2.woocommerce-column__title { + color: #333; + border-bottom: 2px solid #eee; + padding-bottom: 10px; +} + +/* Детали заказа */ +.woocommerce-order-overview { + display: flex; + flex-wrap: wrap; + gap: 1rem; + margin-bottom: 2rem; +} + +.woocommerce-order-overview li { + flex: 1; + min-width: 200px; + background: #f9f9f9; + padding: 1rem; + border-radius: 4px; +} + +/* Кнопка "Вернуться в магазин" */ +.woocommerce-button.button.wc-backward { + background: #4CAF50; + color: white; + padding: 10px 20px; + border-radius: 4px; + text-decoration: none; + display: inline-block; + margin-top: 20px; +} + +.woocommerce-button.button.wc-backward:hover { + background: #3e8e41; +} + + +@media (max-width: 768px) { + .woocommerce-order { + padding: 1rem; + margin: 1rem; + } + + .woocommerce-order-overview li { + min-width: 100%; + } + + .woocommerce-order-details, + .woocommerce-customer-details { + margin-top: 1rem; + } +} \ No newline at end of file diff --git a/wp-content/themes/cosmopet/templates/shop/review-order.twig b/wp-content/themes/cosmopet/templates/shop/review-order.twig index 9f76ddb..1917942 100644 --- a/wp-content/themes/cosmopet/templates/shop/review-order.twig +++ b/wp-content/themes/cosmopet/templates/shop/review-order.twig @@ -1,23 +1,23 @@ - + {% for code, coupon in fn('WC').cart.get_coupons() %} - + {% endfor %} {% if fn('WC').cart.needs_shipping() and fn('WC').cart.show_shipping() %} - {{ do_action('woocommerce_review_order_before_shipping') }} + {{ action('woocommerce_review_order_before_shipping') }} {{ fn('wc_cart_totals_shipping_html') }} - {{ do_action('woocommerce_review_order_after_shipping') }} + {{ action('woocommerce_review_order_after_shipping') }} {% endif %} @@ -40,7 +40,7 @@ {% 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() %} - + @@ -53,7 +53,7 @@ {% endif %} {% endif %} - {{ do_action('woocommerce_review_order_before_order_total') }} + {{ action('woocommerce_review_order_before_order_total') }} @@ -61,6 +61,6 @@ - {{ do_action('woocommerce_review_order_after_order_total') }} + {{ action('woocommerce_review_order_after_order_total') }}
{{ pll_e('Товары') }}{{ fn('pll_e', 'Товары') }} {{ fn('wc_cart_totals_subtotal_html') }}
{{ fn('wc_cart_totals_coupon_label', coupon) }} {{ fn('wc_cart_totals_coupon_html', coupon) }}
{{ tax.label|e }} {{ tax.formatted_amount|raw }}
{{ fn('wc_cart_totals_order_total_html') }}
\ No newline at end of file diff --git a/wp-content/themes/cosmopet/woocommerce/cart/cart-shipping.php b/wp-content/themes/cosmopet/woocommerce/cart/cart-shipping.php index b341ab6..9eb87d3 100644 --- a/wp-content/themes/cosmopet/woocommerce/cart/cart-shipping.php +++ b/wp-content/themes/cosmopet/woocommerce/cart/cart-shipping.php @@ -70,7 +70,7 @@ $calculator_text = ''; + ?>₽

diff --git a/wp-content/themes/cosmopet/woocommerce/checkout/order-receipt.php b/wp-content/themes/cosmopet/woocommerce/checkout/order-receipt.php index 74b628f..9a93632 100644 --- a/wp-content/themes/cosmopet/woocommerce/checkout/order-receipt.php +++ b/wp-content/themes/cosmopet/woocommerce/checkout/order-receipt.php @@ -1,19 +1,46 @@ -// Get Timber context -$context = Timber::context(); + +get_payment_method(), $order->get_id() ); ?> -// Render the Twig template -Timber::render('shop/review-order.twig', $context); \ No newline at end of file +
diff --git a/wp-content/themes/cosmopet/woocommerce/checkout/thankyou copy.php b/wp-content/themes/cosmopet/woocommerce/checkout/thankyou copy.php deleted file mode 100644 index 53d5191..0000000 --- a/wp-content/themes/cosmopet/woocommerce/checkout/thankyou copy.php +++ /dev/null @@ -1,90 +0,0 @@ - - -
- - get_id() ); - ?> - - has_status( 'failed' ) ) : ?> - -

- -

- - - - -

- - - - $order ) ); ?> - - - - - - get_payment_method(), $order->get_id() ); ?> - get_id() ); ?> - - - - false ) ); ?> - - - -
diff --git a/wp-content/themes/cosmopet/woocommerce/checkout/thankyou.php b/wp-content/themes/cosmopet/woocommerce/checkout/thankyou.php deleted file mode 100644 index 6019893..0000000 --- a/wp-content/themes/cosmopet/woocommerce/checkout/thankyou.php +++ /dev/null @@ -1,108 +0,0 @@ - - -
- - - - get_id() ); ?> - - has_status( 'failed' ) ) : ?> - -

- -

- - - - -

- - - -
- - - - - -
- - - - -

- - - - - - - - - get_payment_method(), $order->get_id() ); ?> - get_id() ); ?> - - - - -

- - - -