Alexandr | change photos in ae photo slider main page

pull/36/head
Антон 3 weeks ago
parent e3f48095fb
commit f68430e841
  1. 171
      wp-content/themes/cosmopet/global-functions/multisite-functions.php
  2. 1
      wp-content/themes/cosmopet/static/css/forms.css
  3. BIN
      wp-content/themes/cosmopet/static/img/pets/pet_1.jpg
  4. BIN
      wp-content/themes/cosmopet/static/img/pets/pet_10.jpg
  5. BIN
      wp-content/themes/cosmopet/static/img/pets/pet_11.jpg
  6. BIN
      wp-content/themes/cosmopet/static/img/pets/pet_12.jpg
  7. BIN
      wp-content/themes/cosmopet/static/img/pets/pet_13.jpg
  8. BIN
      wp-content/themes/cosmopet/static/img/pets/pet_14.jpg
  9. BIN
      wp-content/themes/cosmopet/static/img/pets/pet_2.jpg
  10. BIN
      wp-content/themes/cosmopet/static/img/pets/pet_3.jpg
  11. BIN
      wp-content/themes/cosmopet/static/img/pets/pet_4.jpg
  12. BIN
      wp-content/themes/cosmopet/static/img/pets/pet_5.jpg
  13. BIN
      wp-content/themes/cosmopet/static/img/pets/pet_6.jpg
  14. BIN
      wp-content/themes/cosmopet/static/img/pets/pet_7.jpg
  15. BIN
      wp-content/themes/cosmopet/static/img/pets/pet_8.jpg
  16. BIN
      wp-content/themes/cosmopet/static/img/pets/pet_9.jpg
  17. 6
      wp-content/themes/cosmopet/templates/_pages/production.twig
  18. 2
      wp-content/themes/cosmopet/templates/forms/discount.twig

@ -75,15 +75,58 @@ function custom_canonical_url() {
} }
} }
/** /**
* Добавление событий контрибуции для FP Pixel * Добавление событий контрибуции для FP Pixel
* только на боевом сайте АЕ * только на боевом сайте АЕ
* */ */
if($site_env->site_mode == 'production' and $site_env->site_region == 'ae') { if ($site_env->site_mode == 'production' && $site_env->site_region == 'ae') {
/* Передача просто по url */
// Проверка на тестовый режим для метрик
function is_gp_test_mode() {
if (isset($_GET['gp-test']) && $_GET['gp-test'] == '1') {
return true;
}
if (is_user_logged_in() && current_user_can('administrator')) {
return true;
}
return false;
}
add_action('wp_footer', 'add_facebook_pixel_events'); add_action('wp_footer', 'add_facebook_pixel_events');
function add_facebook_pixel_events() { function add_facebook_pixel_events() {
// 1. Событие AddToCart (Добавление в корзину) if (is_gp_test_mode()) return;
global $product;
// 1. ViewContent
if (is_product() && $product && $product->get_price() > 0) {
?>
<script>
document.addEventListener('DOMContentLoaded', function() {
fbq('track', 'ViewContent', {
content_ids: ['<?php echo $product->get_id(); ?>'],
content_type: 'product',
value: <?php echo $product->get_price(); ?>,
currency: '<?php echo get_woocommerce_currency(); ?>'
});
});
</script>
<?php
}
// 2. InitiateCheckout
if (is_checkout() && !is_wc_endpoint_url('order-received') && WC()->cart && WC()->cart->get_cart_contents_count() > 0) {
?>
<script>
document.addEventListener('DOMContentLoaded', function() {
fbq('track', 'InitiateCheckout');
});
</script>
<?php
}
// 3. AddToCart
if (is_product() || is_shop() || is_cart()) { if (is_product() || is_shop() || is_cart()) {
?> ?>
<script> <script>
@ -95,9 +138,8 @@ if($site_env->site_mode == 'production' and $site_env->site_region == 'ae') {
var productName = $button.data('product_sku') || var productName = $button.data('product_sku') ||
$button.closest('.product').find('.woocommerce-loop-product__title').text().trim() || 'Unknown'; $button.closest('.product').find('.woocommerce-loop-product__title').text().trim() || 'Unknown';
var priceElement = $button.closest('.product').find('.price .amount').text().replace(/[^0-9.]/g, '') || '0.00'; var priceElement = $button.closest('.product').find('.price .amount').text().replace(/[^0-9.]/g, '') || '0.00';
var currency = '<?php echo get_woocommerce_currency(); ?>'; // Динамическая валюта var currency = '<?php echo get_woocommerce_currency(); ?>';
// Событие для Facebook Pixel
fbq('track', 'AddToCart', { fbq('track', 'AddToCart', {
content_ids: [productId], content_ids: [productId],
content_type: 'product', content_type: 'product',
@ -105,7 +147,6 @@ if($site_env->site_mode == 'production' and $site_env->site_region == 'ae') {
currency: currency currency: currency
}); });
// Событие для Google Analytics
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ window.dataLayer.push({
'event': 'add_to_cart', 'event': 'add_to_cart',
@ -124,9 +165,35 @@ if($site_env->site_mode == 'production' and $site_env->site_region == 'ae') {
}); });
}); });
</script> </script>
<? } <?php
}
// 2. Событие Purchase (Покупка) // 4. AddPaymentInfo
if (is_checkout() && !is_wc_endpoint_url('order-received') && WC()->cart && WC()->cart->get_cart_contents_count() > 0) {
$currency = get_woocommerce_currency();
$cart_total = WC()->cart->get_total('edit');
?>
<script>
document.addEventListener('DOMContentLoaded', function() {
fbq('track', 'AddPaymentInfo', {
value: <?php echo $cart_total; ?>,
currency: '<?php echo $currency; ?>'
});
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'add_payment_info',
'ecommerce': {
'currency': '<?php echo $currency; ?>',
'value': <?php echo $cart_total; ?>
}
});
});
</script>
<?php
}
// 5. Purchase
if (is_wc_endpoint_url('order-received')) { if (is_wc_endpoint_url('order-received')) {
$order_id = absint(get_query_var('order-received')); $order_id = absint(get_query_var('order-received'));
if (!$order_id) return; if (!$order_id) return;
@ -138,84 +205,57 @@ if($site_env->site_mode == 'production' and $site_env->site_region == 'ae') {
foreach ($order->get_items() as $item) { foreach ($order->get_items() as $item) {
$product = $item->get_product(); $product = $item->get_product();
$items[] = [ $items[] = [
'item_id' => $product->get_id(), 'item_id' => $product->get_id(),
'item_name' => $product->get_name(), 'item_name' => $product->get_name(),
'price' => $product->get_price(), 'price' => $product->get_price(),
'quantity' => $item->get_quantity() 'quantity' => $item->get_quantity()
]; ];
} }
?> ?>
<script> <script>
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
fbq('track', 'Purchase', { fbq('track', 'Purchase', {
value: <?php echo $order->get_total(); ?>, value: <?php echo $order->get_total(); ?>,
currency: '<?php echo $order->get_currency(); ?>', currency: '<?php echo $order->get_currency(); ?>',
content_ids: [<?php echo implode(',', array_column($items, 'item_id')); ?>], content_ids: [<?php echo implode(',', array_column($items, 'item_id')); ?>],
content_type: 'product' content_type: 'product'
}); });
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ window.dataLayer.push({
'event': 'purchase', 'event': 'purchase',
'ecommerce': { 'ecommerce': {
'currency': '<?php echo $order->get_currency(); ?>', 'currency': '<?php echo $order->get_currency(); ?>',
'value': <?php echo $order->get_total(); ?>, 'value': <?php echo $order->get_total(); ?>,
'items': <?php echo json_encode($items); ?> 'items': <?php echo json_encode($items); ?>
} }
});
}); });
});
</script> </script>
<?php <?php
} }
// 3. Событие AddPaymentInfo
if (is_checkout() && !is_wc_endpoint_url('order-received')) {
$currency = get_woocommerce_currency();
$cart_total = WC()->cart ? WC()->cart->get_total('edit') : 0;
?>
<script>
document.addEventListener('DOMContentLoaded', function() {
fbq('track', 'AddPaymentInfo', {
value: <?php echo $cart_total; ?>,
currency: '<?php echo $currency; ?>'
});
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'add_payment_info',
'ecommerce': {
'currency': '<?php echo $currency; ?>',
'value': <?php echo $cart_total; ?>
}
});
});
</script>
<? }
} }
/* Передача контрибуции со страницы "Спасибо" */
add_action('woocommerce_thankyou', 'send_purchase_to_metrika'); add_action('woocommerce_thankyou', 'send_purchase_to_metrika');
function send_purchase_to_metrika($order_id) function send_purchase_to_metrika($order_id) {
{ if (is_gp_test_mode()) return;
if (!$order_id)
return; // Проверка, что заказ существует if (!$order_id) return;
$order = wc_get_order($order_id); $order = wc_get_order($order_id);
if ($order->get_status() !== 'processing' && $order->get_status() !== 'completed') if ($order->get_status() !== 'processing' && $order->get_status() !== 'completed') return;
return; // Отправляем только для оплаченных заказов
$items = []; $items = [];
foreach ($order->get_items() as $item) { foreach ($order->get_items() as $item) {
$product = $item->get_product(); $product = $item->get_product();
$items[] = [ $items[] = [
'id' => $product->get_id(), 'id' => $product->get_id(),
'name' => $product->get_name(), 'name' => $product->get_name(),
'price' => $product->get_price(), 'price' => $product->get_price(),
'quantity' => $item->get_quantity() 'quantity' => $item->get_quantity()
]; ];
} }
// Получаем валюту заказа
$currency = $order->get_currency(); $currency = $order->get_currency();
?> ?>
<script> <script>
@ -233,7 +273,6 @@ if($site_env->site_mode == 'production' and $site_env->site_region == 'ae') {
} }
}); });
// Яндекс.Метрика
yaCounter96481053.reachGoal('purchase', { yaCounter96481053.reachGoal('purchase', {
'order_id': '<?php echo $order_id; ?>', 'order_id': '<?php echo $order_id; ?>',
'order_price': '<?php echo $order->get_total(); ?>', 'order_price': '<?php echo $order->get_total(); ?>',
@ -241,7 +280,6 @@ if($site_env->site_mode == 'production' and $site_env->site_region == 'ae') {
'items': <?php echo json_encode($items); ?> 'items': <?php echo json_encode($items); ?>
}); });
// Facebook Pixel
fbq('track', 'Purchase', { fbq('track', 'Purchase', {
value: <?php echo $order->get_total(); ?>, value: <?php echo $order->get_total(); ?>,
currency: '<?php echo $currency; ?>', currency: '<?php echo $currency; ?>',
@ -253,6 +291,7 @@ if($site_env->site_mode == 'production' and $site_env->site_region == 'ae') {
} }
} }
// TO_DO: удалить, если не нужно // TO_DO: удалить, если не нужно
// Отключаем кэширование для страниц товаров // Отключаем кэширование для страниц товаров
add_action('template_redirect', function() { add_action('template_redirect', function() {

@ -99,6 +99,7 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
margin-top: -10%;
} }
.discount_cosmodog__slider{ .discount_cosmodog__slider{

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 MiB

@ -26,10 +26,10 @@
<p class="steps_desc{% if item.small_text %}--min{% endif %}">{{ item.text }}</p> <p class="steps_desc{% if item.small_text %}--min{% endif %}">{{ item.text }}</p>
{% endfor %} {% endfor %}
{% if site_region == 'ru' %} {% if site_region == 'ru' %}
<p class="steps_desc">В ОСНОВЕ ПРОИЗВОДСТВА COSMOPET — УНИКАЛЬНЫЙ ТЕХНОЛОГИЧЕСКИЙ ПРОЦЕСС, КОТОРЫЙ НЕ ИМЕЕТ АНАЛОГОВ В МИРЕ.</p> <p class="steps_desc">COSMOPET PRODUCTION IS BASED ON A UNIQUE TECHNOLOGICAL PROCESS WHICH HAS NO ANALOGUES IN THE WORLD.</p>
{% endif %} {% endif %}
</div> </div>
<div class="steps_title">{{ function('pll_e', 'ЭТАПЫ ПРОИЗВОДСТВА') }}</div> <div class="steps_title">{{ function('pll_e', 'PRODUCTION STAGES') }}</div>
<div class="production_steps_row"> <div class="production_steps_row">
{% if steps_1[0] is defined %} {% if steps_1[0] is defined %}
@ -181,7 +181,7 @@
<section class="feed_production"> <section class="feed_production">
<div class="container"> <div class="container">
<div class="section_title">{{ function('pll_e', 'Этапы производства корма') }}</div> <div class="section_title">{{ function('pll_e', 'Stages of feed production') }}</div>
<div class="feed_steps__row"> <div class="feed_steps__row">
{% for item in steps_2 %} {% for item in steps_2 %}

@ -57,7 +57,7 @@
<div class="swiper-wrapper"> <div class="swiper-wrapper">
{% for i in 1..14 %} {% for i in 1..14 %}
<div class="swiper-slide"> <div class="swiper-slide">
<img src="/wp-content/themes/cosmopet/static/img/pets/tag_cosmopet_{{ i }}.jpg" alt="Cosmopet image {{ i }}" class="discount_cosmodog-img"> <img src="/wp-content/themes/cosmopet/static/img/pets/pet_{{ i }}.jpg" alt="Cosmopet image {{ i }}" class="discount_cosmodog-img">
</div> </div>
{% endfor %} {% endfor %}
</div> </div>

Loading…
Cancel
Save