Andrei | исправления после натяжки single страницы

web_10
parent ad2f1f4268
commit f88fd2b39f
  1. 26
      wp-content/themes/cosmopet/functions.php
  2. 4
      wp-content/themes/cosmopet/global-functions/multisite-functions.php
  3. 463
      wp-content/themes/cosmopet/modules/shop/CosmopetProduct.php
  4. 23
      wp-content/themes/cosmopet/modules/shop/components/product-card/assets/css/product-card.css
  5. 9
      wp-content/themes/cosmopet/modules/shop/components/product-single--new/assets/css/product-style.css
  6. 5
      wp-content/themes/cosmopet/modules/shop/module-controller.php
  7. 22
      wp-content/themes/cosmopet/single-product.php
  8. 14
      wp-content/themes/cosmopet/views/woocommerce/product-card.twig

@ -24,44 +24,22 @@ require_once __DIR__ . '/temp-functions/login-logic.php';
// include_module('author'); // include_module('author');
// include_module('layout'); // include_module('layout');
<<<<<<< HEAD
=======
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
include_once('modules/shop/CosmopetProduct.php'); include_once('modules/shop/CosmopetProduct.php');
add_filter('timber/post/classmap', function ($classmap) { add_filter('timber/post/classmap', function ($classmap) {
$classmap['product'] = CosmopetProduct::class; $classmap['product'] = CosmopetProduct::class;
return $classmap; return $classmap;
}, 100); }, 100);
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
add_filter('timber/post/classmap', function ($classmap) { add_filter('timber/post/classmap', function ($classmap) {
$classmap['product'] = CosmopetProduct::class; $classmap['product'] = CosmopetProduct::class;
return $classmap; return $classmap;
}, 100); }, 100);
=======
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
function allow_svg_upload($mimes) { function allow_svg_upload($mimes) {
$mimes['svg'] = 'image/svg+xml'; $mimes['svg'] = 'image/svg+xml';
return $mimes; return $mimes;
} }
<<<<<<< HEAD
<<<<<<< HEAD
add_filter('upload_mimes', 'allow_svg_upload');
=======
add_filter('upload_mimes', 'allow_svg_upload');
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
add_filter('upload_mimes', 'allow_svg_upload'); add_filter('upload_mimes', 'allow_svg_upload');
=======
>>>>>>> 7da02c80 (Task 7719 | натяжка верстки single страницы товара)
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)

@ -35,8 +35,4 @@ add_filter('timber/twig', function (\Twig\Environment $twig) {
add_filter('woocommerce_currency_symbol', function($currency_symbol, $currency) { add_filter('woocommerce_currency_symbol', function($currency_symbol, $currency) {
return $currency === 'AED' ? 'AED' : $currency_symbol; return $currency === 'AED' ? 'AED' : $currency_symbol;
<<<<<<< HEAD
})
=======
}, 10, 2); }, 10, 2);
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)

@ -7,40 +7,12 @@ use Timber\Integrations\WooCommerce\Product as TimberProduct;
class CosmopetProduct extends TimberProduct { class CosmopetProduct extends TimberProduct {
protected $sibling_categories = [ protected $sibling_categories = [
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
'pa_compound', 'pa_compound',
'pa_dog-size', 'pa_dog-size',
'pa_reproductive-status', 'pa_reproductive-status',
'pa_age-of-the-cat', 'pa_age-of-the-cat',
'pa_age-of-the-dog', 'pa_age-of-the-dog',
<<<<<<< HEAD
=======
'pa_age-of-the-cat',
'pa_age-of-the-dog',
'pa_compound',
'pa_reproductive-status',
<<<<<<< HEAD
>>>>>>> 909cd3ca (Task 7719 | натяжка верстки single страницы товара)
=======
'pa_compound',
'pa_dog-size',
'pa_reproductive-status',
'pa_age-of-the-cat',
'pa_age-of-the-dog',
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
>>>>>>> 7da02c80 (Task 7719 | натяжка верстки single страницы товара)
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
'pa_series', 'pa_series',
=======
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
]; ];
public function __construct ($pid = null) { public function __construct ($pid = null) {
@ -74,27 +46,7 @@ class CosmopetProduct extends TimberProduct {
// Получаем галерею изображений // Получаем галерею изображений
if ($this->product && method_exists($this->product, 'get_gallery_image_ids')) { if ($this->product && method_exists($this->product, 'get_gallery_image_ids')) {
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
$gallery_image_ids = $this->product->get_gallery_image_ids();
=======
$gallery_image_ids = $this->product->get_gallery_image_ids(); $gallery_image_ids = $this->product->get_gallery_image_ids();
>>>>>>> 909cd3ca (Task 7719 | натяжка верстки single страницы товара)
=======
$gallery_image_ids = $this->product->get_gallery_image_ids();
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
$gallery_image_ids = $this->product->get_gallery_image_ids();
=======
$gallery_image_ids = $this->product->get_gallery_image_ids();
>>>>>>> 7da02c80 (Task 7719 | натяжка верстки single страницы товара)
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
$gallery_image_ids = $this->product->get_gallery_image_ids();
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
} else { } else {
$gallery_image_ids = []; $gallery_image_ids = [];
} }
@ -125,28 +77,8 @@ class CosmopetProduct extends TimberProduct {
} }
else{ else{
if ($this->product && method_exists($this->product, 'get_weight')) { if ($this->product && method_exists($this->product, 'get_weight')) {
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
return $this->product->get_weight() ? $this->product->get_weight() . ' ' . $custom_measurement : ''; return $this->product->get_weight() ? $this->product->get_weight() . ' ' . $custom_measurement : '';
=======
return $this->product->get_weight() ? $this->product->get_weight() . ' ' . $custom_measurement : '';
>>>>>>> 909cd3ca (Task 7719 | натяжка верстки single страницы товара)
=======
return $this->product->get_weight() ? $this->product->get_weight() . ' ' . $custom_measurement : '';
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
return $this->product->get_weight() ? $this->product->get_weight() . ' ' . $custom_measurement : '';
=======
return $this->product->get_weight() ? $this->product->get_weight() . ' ' . $custom_measurement : '';
>>>>>>> 7da02c80 (Task 7719 | натяжка верстки single страницы товара)
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
} }
=======
return $this->product->get_weight() ? $this->product->get_weight() . ' ' . $custom_measurement : '';
}
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
return ''; return '';
} }
return ''; return '';
@ -183,24 +115,6 @@ class CosmopetProduct extends TimberProduct {
if ( $cat->slug === 'korm' ) { if ( $cat->slug === 'korm' ) {
$is_food = true; $is_food = true;
} elseif ( $cat->slug === 'lakomstva' ) { } elseif ( $cat->slug === 'lakomstva' ) {
<<<<<<< HEAD
=======
$product_categories = $this->product->get_category_ids();
$is_food = false;
$is_treats = false;
// Определяем тип товара (корм или лакомство)
foreach ($product_categories as $cat) {
if ($cat == 365) {
$is_food = true;
} elseif ($cat == 367) {
<<<<<<< HEAD
>>>>>>> 909cd3ca (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 7da02c80 (Task 7719 | натяжка верстки single страницы товара)
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
$is_treats = true; $is_treats = true;
} }
} }
@ -309,26 +223,7 @@ class CosmopetProduct extends TimberProduct {
// Extract just the posts in sorted order // Extract just the posts in sorted order
$sorted_siblings = array_map(function($item) { $sorted_siblings = array_map(function($item) {
return $item['post']; return $item['post'];
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
}, $siblings_with_weights);
=======
}, $siblings_with_weights);
>>>>>>> 909cd3ca (Task 7719 | натяжка верстки single страницы товара)
=======
}, $siblings_with_weights);
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
}, $siblings_with_weights);
=======
}, $siblings_with_weights); }, $siblings_with_weights);
>>>>>>> 7da02c80 (Task 7719 | натяжка верстки single страницы товара)
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
}, $siblings_with_weights);
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
return $sorted_siblings; return $sorted_siblings;
} }
@ -376,62 +271,7 @@ class CosmopetProduct extends TimberProduct {
} }
} }
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
// Получаем упорядоченные таксономии
$ordered_taxonomies = $this->getOrderedTaxonomies();
// Инициализируем конструктор для всех таксономий
foreach ($this->sibling_categories as $taxonomy) {
if (isset($current_product_attributes[$taxonomy])) {
$constructor[$taxonomy] = [
'taxonomy' => $taxonomy,
'label' => $this->getAttributeLabel($taxonomy),
'current_value' => $this->getCurrentAttributeValue($taxonomy),
'options' => []
];
}
}
// ОБХОДИМ МАССИВ ТОВАРОВ ТОЛЬКО ОДИН РАЗ
foreach ($all_products as $product) {
// Получаем все атрибуты сравниваемого товара за один раз
$compare_attributes = [];
$compare_weight = $product->getNumericWeight();
foreach ($this->sibling_categories as $taxonomy) {
$terms = get_the_terms($product->id, $taxonomy);
if ($terms && !is_wp_error($terms)) {
$compare_attributes[$taxonomy] = array_map(function($term) {
return $term->term_id;
}, $terms);
}
}
// Проверяем, подходит ли товар для каждой таксономии
foreach ($this->sibling_categories as $taxonomy) {
// Пропускаем, если у текущего товара нет значения для этой категории
if (!isset($current_product_attributes[$taxonomy])) {
continue;
<<<<<<< HEAD
=======
// Отладочная информация
error_log("=== Конструктор товара ===");
error_log("Текущий товар ID: " . $this->id);
error_log("Текущий вес (числовой): " . $current_weight);
error_log("Всего товаров в коллекции: " . count($all_products));
error_log("Атрибуты текущего товара: " . print_r($current_product_attributes, true));
<<<<<<< HEAD
=======
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
// Получаем упорядоченные таксономии // Получаем упорядоченные таксономии
$ordered_taxonomies = $this->getOrderedTaxonomies(); $ordered_taxonomies = $this->getOrderedTaxonomies();
@ -463,81 +303,17 @@ class CosmopetProduct extends TimberProduct {
} }
} }
<<<<<<< HEAD
=======
// Группируем товары по атрибутам
foreach ($this->sibling_categories as $taxonomy) {
// Проверяем, есть ли у текущего товара значение для этой категории
if (!isset($current_product_attributes[$taxonomy])) {
error_log("Пропускаем $taxonomy - нет значения у текущего товара");
continue; // Пропускаем, если у товара нет значения для этой категории
}
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
$constructor[$taxonomy] = [
'taxonomy' => $taxonomy,
'label' => $this->getAttributeLabel($taxonomy),
'current_value' => $this->getCurrentAttributeValue($taxonomy),
'options' => []
];
error_log("Обрабатываем атрибут: $taxonomy");
error_log("Атрибуты текущего товара для проверки: " . print_r($current_product_attributes, true));
foreach ($all_products as $product) {
// Получаем атрибуты сравниваемого товара
$compare_attributes = [];
foreach ($this->sibling_categories as $compare_taxonomy) {
$terms = get_the_terms($product->id, $compare_taxonomy);
if ($terms && !is_wp_error($terms)) {
$compare_attributes[$compare_taxonomy] = array_map(function($term) {
return $term->term_id;
}, $terms);
}
<<<<<<< HEAD
>>>>>>> 909cd3ca (Task 7719 | натяжка верстки single страницы товара)
=======
// Проверяем, подходит ли товар для каждой таксономии // Проверяем, подходит ли товар для каждой таксономии
foreach ($this->sibling_categories as $taxonomy) { foreach ($this->sibling_categories as $taxonomy) {
// Пропускаем, если у текущего товара нет значения для этой категории // Пропускаем, если у текущего товара нет значения для этой категории
if (!isset($current_product_attributes[$taxonomy])) { if (!isset($current_product_attributes[$taxonomy])) {
continue; continue;
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
>>>>>>> 7da02c80 (Task 7719 | натяжка верстки single страницы товара)
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
} }
// Проверяем, совпадают ли все остальные атрибуты и вес // Проверяем, совпадают ли все остальные атрибуты и вес
$attributes_match = true; $attributes_match = true;
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
// Проверяем все атрибуты кроме текущей таксономии
=======
$differences = [];
// Проверяем только атрибуты из sibling_categories
<<<<<<< HEAD
>>>>>>> 909cd3ca (Task 7719 | натяжка верстки single страницы товара)
=======
// Проверяем все атрибуты кроме текущей таксономии // Проверяем все атрибуты кроме текущей таксономии
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
>>>>>>> 7da02c80 (Task 7719 | натяжка верстки single страницы товара)
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
$differences = [];
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
foreach ($this->sibling_categories as $compare_taxonomy) { foreach ($this->sibling_categories as $compare_taxonomy) {
if ($compare_taxonomy === $taxonomy) { if ($compare_taxonomy === $taxonomy) {
continue; // Пропускаем проверяемую категорию continue; // Пропускаем проверяемую категорию
@ -548,23 +324,6 @@ class CosmopetProduct extends TimberProduct {
// Проверяем, есть ли у сравниваемого товара значение для этой категории // Проверяем, есть ли у сравниваемого товара значение для этой категории
if (!isset($compare_attributes[$compare_taxonomy])) { if (!isset($compare_attributes[$compare_taxonomy])) {
$attributes_match = false; $attributes_match = false;
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
$differences[] = "Нет атрибута $compare_taxonomy у сравниваемого товара";
>>>>>>> 909cd3ca (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
=======
$differences[] = "Нет атрибута $compare_taxonomy у сравниваемого товара";
>>>>>>> 7da02c80 (Task 7719 | натяжка верстки single страницы товара)
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
$differences[] = "Нет атрибута $compare_taxonomy у сравниваемого товара";
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
break; break;
} }
@ -575,23 +334,6 @@ class CosmopetProduct extends TimberProduct {
if (array_diff($current_values, $compare_values) !== [] || if (array_diff($current_values, $compare_values) !== [] ||
array_diff($compare_values, $current_values) !== []) { array_diff($compare_values, $current_values) !== []) {
$attributes_match = false; $attributes_match = false;
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
$differences[] = "Не совпадают значения для $compare_taxonomy";
>>>>>>> 909cd3ca (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
=======
$differences[] = "Не совпадают значения для $compare_taxonomy";
>>>>>>> 7da02c80 (Task 7719 | натяжка верстки single страницы товара)
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
$differences[] = "Не совпадают значения для $compare_taxonomy";
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
break; break;
} }
} }
@ -600,81 +342,18 @@ class CosmopetProduct extends TimberProduct {
else { else {
if (isset($compare_attributes[$compare_taxonomy])) { if (isset($compare_attributes[$compare_taxonomy])) {
$attributes_match = false; $attributes_match = false;
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
$differences[] = "У сравниваемого товара есть атрибут $compare_taxonomy, а у текущего нет";
>>>>>>> 909cd3ca (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
=======
$differences[] = "У сравниваемого товара есть атрибут $compare_taxonomy, а у текущего нет";
>>>>>>> 7da02c80 (Task 7719 | натяжка верстки single страницы товара)
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
$differences[] = "У сравниваемого товара есть атрибут $compare_taxonomy, а у текущего нет";
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
break; break;
} }
} }
} }
// Проверяем вес (числовое сравнение) // Проверяем вес (числовое сравнение)
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
if (abs($current_weight - $compare_weight) > 0.01) {
$attributes_match = false;
=======
=======
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
$compare_weight = $product->getNumericWeight();
if (abs($current_weight - $compare_weight) > 0.01) { // Используем небольшой допуск для float
$attributes_match = false;
$differences[] = "Не совпадает вес: текущий '$current_weight' vs сравниваемый '$compare_weight'";
<<<<<<< HEAD
<<<<<<< HEAD
>>>>>>> 909cd3ca (Task 7719 | натяжка верстки single страницы товара)
=======
if (abs($current_weight - $compare_weight) > 0.01) { if (abs($current_weight - $compare_weight) > 0.01) {
$attributes_match = false; $attributes_match = false;
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
>>>>>>> 7da02c80 (Task 7719 | натяжка верстки single страницы товара)
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
} }
// Если все атрибуты и вес совпадают, добавляем товар в группу // Если все атрибуты и вес совпадают, добавляем товар в группу
if ($attributes_match) { if ($attributes_match) {
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
error_log("Товар {$product->id} подходит для атрибута $taxonomy");
>>>>>>> 909cd3ca (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
=======
error_log("Товар {$product->id} подходит для атрибута $taxonomy");
>>>>>>> 7da02c80 (Task 7719 | натяжка верстки single страницы товара)
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
error_log("Товар {$product->id} подходит для атрибута $taxonomy");
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
$product_terms = get_the_terms($product->id, $taxonomy); $product_terms = get_the_terms($product->id, $taxonomy);
if ($product_terms && !is_wp_error($product_terms)) { if ($product_terms && !is_wp_error($product_terms)) {
foreach ($product_terms as $term) { foreach ($product_terms as $term) {
@ -682,48 +361,15 @@ class CosmopetProduct extends TimberProduct {
if (!isset($constructor[$taxonomy]['options'][$option_key])) { if (!isset($constructor[$taxonomy]['options'][$option_key])) {
$constructor[$taxonomy]['options'][$option_key] = [ $constructor[$taxonomy]['options'][$option_key] = [
'term_id' => $term->term_id, 'term_id' => $term->term_id,
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
'name' => $this->getTermName($term->term_id, $taxonomy), 'name' => $this->getTermName($term->term_id, $taxonomy),
'slug' => $term->slug, 'slug' => $term->slug,
'icon' => $this->getTermIcon($term->term_id, $taxonomy), 'icon' => $this->getTermIcon($term->term_id, $taxonomy),
=======
'name' => $term->name,
'slug' => $term->slug,
<<<<<<< HEAD
>>>>>>> 909cd3ca (Task 7719 | натяжка верстки single страницы товара)
=======
'name' => $this->getTermName($term->term_id, $taxonomy),
'slug' => $term->slug,
'icon' => $this->getTermIcon($term->term_id, $taxonomy),
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
>>>>>>> 7da02c80 (Task 7719 | натяжка верстки single страницы товара)
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
'name' => $this->getTermName($term->term_id, $taxonomy),
'slug' => $term->slug,
'icon' => $this->getTermIcon($term->term_id, $taxonomy),
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
'products' => [] 'products' => []
]; ];
} }
$constructor[$taxonomy]['options'][$option_key]['products'][] = $product; $constructor[$taxonomy]['options'][$option_key]['products'][] = $product;
} }
} }
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
} }
} }
} }
@ -762,88 +408,6 @@ class CosmopetProduct extends TimberProduct {
'pa_compound' => pll__('ВКУС КОРМА'), 'pa_compound' => pll__('ВКУС КОРМА'),
'pa_reproductive-status' => pll__('ВИД КОШКИ'), 'pa_reproductive-status' => pll__('ВИД КОШКИ'),
'pa_series' => pll__('СЕРИЯ'), 'pa_series' => pll__('СЕРИЯ'),
<<<<<<< HEAD
=======
} else {
error_log("Товар {$product->id} НЕ подходит для атрибута $taxonomy. Причины: " . implode(', ', $differences));
}
}
error_log("Найдено опций для $taxonomy: " . count($constructor[$taxonomy]['options']));
// Показываем детали найденных опций
foreach ($constructor[$taxonomy]['options'] as $option_id => $option) {
error_log("Опция $option_id ({$option['name']}): " . count($option['products']) . " товаров");
foreach ($option['products'] as $product) {
error_log(" - Товар {$product->id}: {$product->title}");
<<<<<<< HEAD
=======
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
}
}
}
<<<<<<< HEAD
// Сортируем опции по порядку терминов для каждой таксономии
foreach ($constructor as $taxonomy => $taxonomy_data) {
if (isset($ordered_taxonomies[$taxonomy])) {
$ordered_options = [];
foreach ($ordered_taxonomies[$taxonomy] as $term) {
if (isset($constructor[$taxonomy]['options'][$term->term_id])) {
$ordered_options[$term->term_id] = $constructor[$taxonomy]['options'][$term->term_id];
}
}
$constructor[$taxonomy]['options'] = $ordered_options;
}
}
// Сортируем итоговый конструктор по порядку таксономий
$ordered_constructor = [];
foreach ($this->sibling_categories as $taxonomy) {
if (isset($constructor[$taxonomy])) {
$ordered_constructor[$taxonomy] = $constructor[$taxonomy];
}
}
return $ordered_constructor;
}
protected function getAttributeLabel($taxonomy) {
// Fallback на старые метки
$labels = [
<<<<<<< HEAD
=======
error_log("Итоговый конструктор: " . print_r($constructor, true));
return $constructor;
}
protected function getAttributeLabel($taxonomy) {
$labels = [
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
'pa_age-of-the-cat' => 'ВОЗРАСТ КОШКИ',
'pa_age-of-the-dog' => 'ВОЗРАСТ СОБАКИ',
'pa_compound' => 'ВКУС КОРМА',
'pa_reproductive-status' => 'РЕПРОДУКТИВНЫЙ СТАТУС',
'pa_series' => 'СЕРИЯ',
<<<<<<< HEAD
>>>>>>> 909cd3ca (Task 7719 | натяжка верстки single страницы товара)
=======
'pa_age-of-the-cat' => pll__('ВОЗРАСТ КОШКИ'),
'pa_age-of-the-dog' => pll__('ВОЗРАСТ СОБАКИ'),
'pa_dog-size' => pll__('РАЗМЕР СОБАКИ'),
'pa_compound' => pll__('ВКУС КОРМА'),
'pa_reproductive-status' => pll__('ВИД КОШКИ'),
'pa_series' => pll__('СЕРИЯ'),
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
>>>>>>> 7da02c80 (Task 7719 | натяжка верстки single страницы товара)
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
]; ];
return $labels[$taxonomy] ?? wc_attribute_label($taxonomy); return $labels[$taxonomy] ?? wc_attribute_label($taxonomy);
@ -857,16 +421,6 @@ class CosmopetProduct extends TimberProduct {
return null; return null;
} }
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
/** /**
* Получает таксономии в правильном порядке с учетом сортировки * Получает таксономии в правильном порядке с учетом сортировки
* @return array Массив таксономий с их порядком * @return array Массив таксономий с их порядком
@ -1032,19 +586,6 @@ class CosmopetProduct extends TimberProduct {
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> 909cd3ca (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 51869ae1 (Task 7719 | натяжка верстки single товара.)
=======
=======
>>>>>>> 7da02c80 (Task 7719 | натяжка верстки single страницы товара)
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
public function getAllAttributes() { public function getAllAttributes() {
$attributes = []; $attributes = [];
foreach ($this->sibling_categories as $taxonomy) { foreach ($this->sibling_categories as $taxonomy) {
@ -1062,6 +603,7 @@ class CosmopetProduct extends TimberProduct {
} }
return $attributes; return $attributes;
} }
public function getPriceWithCurrency(){ public function getPriceWithCurrency(){
$price = $this->product->get_price() . ' ' . get_woocommerce_currency_symbol(); $price = $this->product->get_price() . ' ' . get_woocommerce_currency_symbol();
return $price; return $price;
@ -1115,6 +657,5 @@ class CosmopetProduct extends TimberProduct {
} }
return $related_products; return $related_products;
} }
};
};

@ -346,3 +346,26 @@ background: radial-gradient(278.91% 196.13% at 128.36% -48.29%, #ee6868 0%, #569
.product-incart__wrap.loading .product-incart__count { .product-incart__wrap.loading .product-incart__count {
opacity: 0.5; opacity: 0.5;
} }
.main-food_products-card-bottom-nv{
padding: 10px 30px;
font-size: 18px;
text-transform: uppercase;
background-color: #fff;
border-radius: 100px;
color: var(--accent-color);
}
@media (max-width: 1200px) {
.main-food_products-card-bottom-nv{
font-size: 10px;
height: 44px;
padding-left: 6px;
padding-right: 6px;
display: flex;
align-items: center;
}
.main-food_products-card-bottom-price{
flex-shrink: 0;
}
}

@ -765,14 +765,6 @@ line-height: 143%;
.stock, .quantity{ .stock, .quantity{
display: none; display: none;
<<<<<<< HEAD
<<<<<<< HEAD
=======
<<<<<<< HEAD:wp-content/themes/cosmopet/modules/shop/components/product-single--new/assets/css/product-style.css
>>>>>>> 4db62697 (Task 7719 | натяжка верстки single страницы товара)
=======
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
} }
@ -964,3 +956,4 @@ line-height: 143%;
max-height: 100vh; max-height: 100vh;
overflow: auto; overflow: auto;
} }

@ -403,12 +403,7 @@ function map_attr_slugs_to_class($slug) {
return $slug_map[$slug] ?? $slug; // Fallback to original slug if not found return $slug_map[$slug] ?? $slug; // Fallback to original slug if not found
} }
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
// Изменение цены доставки на разбиение НДС + основная стоимость // Изменение цены доставки на разбиение НДС + основная стоимость
add_filter( 'woocommerce_package_rates', function( $rates, $package ) { add_filter( 'woocommerce_package_rates', function( $rates, $package ) {

@ -1,22 +0,0 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if (is_product()) {
include_module('shop');
global $product;
// Get the product ID
$product_id = get_the_ID();
if ($product_id == 1105){
include_component('shop', 'single-product_new');
}
else{
// include_component('shop', 'single-product');
include_component('shop', 'single-product_new');
}
}

@ -1,11 +1,3 @@
{# TO_DO:
1) в контроллер вынести получение всех переменных, а не тут выхывать функции fn()
2) переименовать в файл /shop/product-card.twig
3) _product, wc_product, s_product -- не понятно почему множество переменных с одинаковым смыслом =>
надо сделать единый контенкст для всех контроллеров и там создать все нужные переменные
#}
<div class="main-food_products-card {{addClass}} {{ item.getTasteClass() }}"> <div class="main-food_products-card {{addClass}} {{ item.getTasteClass() }}">
<a href="{{item.link}}" class="main-food_products-card-slider"> <a href="{{item.link}}" class="main-food_products-card-slider">
@ -40,7 +32,7 @@
{% set class = 'active' %} {% set class = 'active' %}
{% endif %} {% endif %}
{% if sibling.get_weight %} {% if sibling.get_weight %}
<button class="main-food_products-card__weight-item {{ class }}" data-image-set='{{ sibling.getImageGallery('medium')|json_encode() }}' data-product_id="{{sibling.id}}" data-product_price="{{sibling.getPrice}}" data-title="{{sibling.title}}"> <button class="main-food_products-card__weight-item {{ class }}" data-image-set='{{ sibling.getImageGallery('medium')|json_encode() }}' data-product_id="{{sibling.id}}" data-product_price="{{sibling.getPriceWithCurrency}}" data-title="{{sibling.title}}">
{{ sibling.get_weight }} {{ sibling.get_weight }}
</button> </button>
{% endif %} {% endif %}
@ -49,8 +41,12 @@
</div>{% endif %} </div>{% endif %}
<div class="main-food_products-card-bottom"> <div class="main-food_products-card-bottom">
<div class="main-food_products-card-bottom-price">{{item.getPriceWithCurrency}}</div> <div class="main-food_products-card-bottom-price">{{item.getPriceWithCurrency}}</div>
{% if item.meta('_stock_status') == 'instock' %}
<a href="{{ item.product.add_to_cart_url }}" class="main-food_products-cardbottom-btn ajax_add_to_cart add_to_cart_button" data-product_id="{{ item.id }}" <a href="{{ item.product.add_to_cart_url }}" class="main-food_products-cardbottom-btn ajax_add_to_cart add_to_cart_button" data-product_id="{{ item.id }}"
data-product_sku="{{ item.sku|e('html_attr') }}">{{ fn('pll_e', 'В корзину') }}</a> data-product_sku="{{ item.sku|e('html_attr') }}">{{ fn('pll_e', 'В корзину') }}</a>
{% else %}
<p class="main-food_products-card-bottom-nv">Нет в наличии</p>
{% endif %}
</div> </div>
</div> </div>
</div> </div>
Loading…
Cancel
Save