From 0a5a29521de4def726bb8938fa89fce5906cc561 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 9 Jun 2025 09:39:30 +0300 Subject: [PATCH] =?UTF-8?q?Fix=20|=20task=206635=20=D0=9F=D0=BE=D1=84?= =?UTF-8?q?=D0=B8=D0=BA=D1=81=D0=B8=D0=BB=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=B8=D0=B6=D0=BD=D0=B5?= =?UTF-8?q?=D0=B9=20=D1=87=D0=B0=D1=81=D1=82=D0=B8=20=D0=B1=D0=BB=D0=BE?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B2=20=D0=BA=D0=BE=D1=80=D0=B7=D0=B8=D0=BD?= =?UTF-8?q?=D0=B5=20=D0=BF=D1=80=D0=B8=20ajax=20=D0=B8=D0=B7=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=B8=D0=B8=20=D1=81=D0=BE=D1=81=D1=82=D0=BE?= =?UTF-8?q?=D1=8F=D0=BD=D0=B8=D1=8F=20=D0=BA=D0=BE=D1=80=D0=B7=D0=B8=D0=BD?= =?UTF-8?q?=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/assets/css/gp-style-core.css | 6 +++++ .../shop/components/cart/assets/js/cart.js | 3 +-- .../modules/shop/module-ajax-controller.php | 5 +++- .../cosmopet/templates/modal/basket.twig | 25 +------------------ .../cosmopet/templates/shop/cart-bottom.twig | 24 ++++++++++++++++++ 5 files changed, 36 insertions(+), 27 deletions(-) create mode 100644 wp-content/themes/cosmopet/templates/shop/cart-bottom.twig 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 dad8e2b..4ab6a74 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 @@ -2178,3 +2178,9 @@ textarea{ } +.modal__button--center{ + margin-right: auto; + margin-left: auto; + display: block; + width: max-content; +} \ No newline at end of file diff --git a/wp-content/themes/cosmopet/modules/shop/components/cart/assets/js/cart.js b/wp-content/themes/cosmopet/modules/shop/components/cart/assets/js/cart.js index 0bd386d..53162d7 100644 --- a/wp-content/themes/cosmopet/modules/shop/components/cart/assets/js/cart.js +++ b/wp-content/themes/cosmopet/modules/shop/components/cart/assets/js/cart.js @@ -341,13 +341,12 @@ jQuery(document).ready(function($) { if (response.success) { $('#modal-basket-content').html(response.data.contents); $('.modal-block-price__price').html(response.data.total); + $('#modal-basket-footer').html(response.data.cart_bottom) $('.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'); // Скрываем кнопку, если корзина пуста } } }, diff --git a/wp-content/themes/cosmopet/modules/shop/module-ajax-controller.php b/wp-content/themes/cosmopet/modules/shop/module-ajax-controller.php index 7f36e87..89f74ec 100644 --- a/wp-content/themes/cosmopet/modules/shop/module-ajax-controller.php +++ b/wp-content/themes/cosmopet/modules/shop/module-ajax-controller.php @@ -99,9 +99,12 @@ function get_cart_fragment_handler() { ob_start(); Timber::render('shop/cart-contents.twig', Timber::context()); $contents = ob_get_clean(); - + ob_start(); + Timber::render('shop/cart-bottom.twig', Timber::context()); + $cartBottom= ob_get_clean(); $response = array( 'contents' => $contents, + 'cart_bottom' => $cartBottom, 'total' => WC()->cart->get_cart_total(), 'count' => WC()->cart->get_cart_contents_count() ); diff --git a/wp-content/themes/cosmopet/templates/modal/basket.twig b/wp-content/themes/cosmopet/templates/modal/basket.twig index b19d3c4..886371f 100644 --- a/wp-content/themes/cosmopet/templates/modal/basket.twig +++ b/wp-content/themes/cosmopet/templates/modal/basket.twig @@ -16,29 +16,6 @@ \ No newline at end of file diff --git a/wp-content/themes/cosmopet/templates/shop/cart-bottom.twig b/wp-content/themes/cosmopet/templates/shop/cart-bottom.twig new file mode 100644 index 0000000..9d70685 --- /dev/null +++ b/wp-content/themes/cosmopet/templates/shop/cart-bottom.twig @@ -0,0 +1,24 @@ + {% if not fn('WC').cart.is_empty and fn('WC').cart.get_total('raw') > 0 %} + + + + {% else %} + + + + + + {% endif %} \ No newline at end of file -- 2.36.3