diff --git a/wp-content/themes/cosmopet/modules/shop/CosmopetProduct.php b/wp-content/themes/cosmopet/modules/shop/CosmopetProduct.php index 5fc5665..8ea7938 100644 --- a/wp-content/themes/cosmopet/modules/shop/CosmopetProduct.php +++ b/wp-content/themes/cosmopet/modules/shop/CosmopetProduct.php @@ -10,6 +10,7 @@ class CosmopetProduct extends TimberProduct { 'pa_compound', 'pa_dog-size', 'pa_reproductive-status', + 'pa_treats_type', 'pa_age-of-the-cat', 'pa_age-of-the-dog', 'pa_series', @@ -189,6 +190,7 @@ class CosmopetProduct extends TimberProduct { return []; } + $args = array( 'posts_per_page' => -1, 'post_type' => 'product', @@ -209,12 +211,16 @@ class CosmopetProduct extends TimberProduct { $siblings_with_weights = []; foreach ($siblings as $sibling) { $weight = $sibling->get_weight(); - $siblings_with_weights[] = [ - 'post' => $sibling, - 'weight' => floatval($weight) // Ensure weight is treated as a number - ]; + $sibling_terms = get_the_terms($sibling->id, 'pa_collection'); + if ($sibling_terms) { + if ($sibling_terms[0]->term_id == $term) + $siblings_with_weights[] = [ + 'post' => $sibling, + 'weight' => floatval($weight) // Ensure weight is treated as a number + ]; + } } - + // Sort by weight usort($siblings_with_weights, function($a, $b) { return $a['weight'] <=> $b['weight']; @@ -440,6 +446,7 @@ class CosmopetProduct extends TimberProduct { 'pa_compound' => pll__('ВКУС КОРМА'), 'pa_reproductive-status' => pll__('ВИД КОШКИ'), 'pa_series' => pll__('СЕРИЯ'), + 'pa_treats_type' => pll__('ТИП ЛАКОМСТВА'), ]; return $labels[$taxonomy] ?? wc_attribute_label($taxonomy); diff --git a/wp-content/themes/cosmopet/modules/shop/components/product-card/assets/css/product-card.css b/wp-content/themes/cosmopet/modules/shop/components/product-card/assets/css/product-card.css index 288f0b9..d532ff7 100644 --- a/wp-content/themes/cosmopet/modules/shop/components/product-card/assets/css/product-card.css +++ b/wp-content/themes/cosmopet/modules/shop/components/product-card/assets/css/product-card.css @@ -111,7 +111,9 @@ background: radial-gradient(278.91% 196.13% at 128.36% -48.29%, #ee6868 0%, #569 } .--treats-salmon.main-food_products-card{ --accent-color: #7c007a; - +} +.--treats-fish.main-food_products-card{ + --accent-color: #7c007a; } .--treats-duck.main-food_products-card{ --accent-color: #326e70; @@ -348,14 +350,20 @@ background: radial-gradient(278.91% 196.13% at 128.36% -48.29%, #ee6868 0%, #569 } .main-food_products-card-bottom-nv{ - padding: 10px 30px; - font-size: 18px; + padding: 10px 20px; + font-size: 11px; text-transform: uppercase; background-color: #fff; border-radius: 100px; color: var(--accent-color); + align-self: stretch; + display: flex; + align-items: center; } +.main-food_products-card-bottom-price{ + flex-shrink: 0; +} @media (max-width: 1200px) { .main-food_products-card-bottom-nv{ font-size: 10px; @@ -365,7 +373,4 @@ background: radial-gradient(278.91% 196.13% at 128.36% -48.29%, #ee6868 0%, #569 display: flex; align-items: center; } -.main-food_products-card-bottom-price{ - flex-shrink: 0; -} } \ No newline at end of file diff --git a/wp-content/themes/cosmopet/modules/shop/components/product-card/assets/js/product-card.js b/wp-content/themes/cosmopet/modules/shop/components/product-card/assets/js/product-card.js index 6e7b14e..283cb4c 100644 --- a/wp-content/themes/cosmopet/modules/shop/components/product-card/assets/js/product-card.js +++ b/wp-content/themes/cosmopet/modules/shop/components/product-card/assets/js/product-card.js @@ -30,7 +30,7 @@ jQuery(document).ready(function() { slider.append( '
' ); diff --git a/wp-content/themes/cosmopet/modules/shop/components/product-single--new/assets/css/product-style.css b/wp-content/themes/cosmopet/modules/shop/components/product-single--new/assets/css/product-style.css index 84e18d7..5bc67c6 100644 --- a/wp-content/themes/cosmopet/modules/shop/components/product-single--new/assets/css/product-style.css +++ b/wp-content/themes/cosmopet/modules/shop/components/product-single--new/assets/css/product-style.css @@ -112,8 +112,8 @@ } .product_main.--treats-fish{ - --bg-color: #D7E6F3; - --accent-color: #0066cc; + --bg-color: #F3D7F3; + --accent-color: #7c007a; } .product_main.--treats-turkey{ @@ -511,6 +511,7 @@ margin-top: 8px; border-radius: 24px; padding: 10px 20px; position: relative; + overflow: hidden; } .product-gallery__thumbsSlider .swiper-slide-thumb-active { diff --git a/wp-content/themes/cosmopet/temp-functions/custom-admin-panel-logic.php b/wp-content/themes/cosmopet/temp-functions/custom-admin-panel-logic.php index b09a06f..5e02918 100644 --- a/wp-content/themes/cosmopet/temp-functions/custom-admin-panel-logic.php +++ b/wp-content/themes/cosmopet/temp-functions/custom-admin-panel-logic.php @@ -50,6 +50,7 @@ add_action('woocommerce_product_options_dimensions', function () { 'desc_tip' => true, 'options' => array( 'кг' => 'кг (по умолчанию)', + 'г' => 'г', 'мл' => 'мл', 'л' => 'л', ) diff --git a/wp-content/themes/cosmopet/views/woocommerce/product-card.twig b/wp-content/themes/cosmopet/views/woocommerce/product-card.twig index 39ef48c..a04100d 100644 --- a/wp-content/themes/cosmopet/views/woocommerce/product-card.twig +++ b/wp-content/themes/cosmopet/views/woocommerce/product-card.twig @@ -22,7 +22,7 @@ {{item.title}} - {% set size_siblings = post.getSizeSiblings %} + {% set size_siblings = item.getSizeSiblings %} {% if size_siblings %}