PluginProbe ʕ •ᴥ•ʔ
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution / 4.9.2
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution v4.9.2
4.9.2 4.9.1 4.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.1 3.0.0 3.1.0 3.1.1 4.0.0 4.0.1 4.1.0 4.1.1 4.2.0 4.2.1 4.3.0 4.3.1 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.6.8 4.6.9 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.7.6 4.7.7 4.7.8 4.7.9 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.8.5 4.8.6 4.8.7 4.8.8 4.8.9 trunk 0.1.2-beta 0.1.3-beta 0.1.4-beta 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.5.0 1.5.1 1.6.0 1.6.1 1.7.0 1.8.0 1.8.1 1.9.0
shopengine / widgets / product-tabs / screens / default.php
shopengine / widgets / product-tabs / screens Last commit date
default.php 4 days ago
default.php
139 lines
1 <?php
2 defined('ABSPATH') || exit;
3 add_filter('woocommerce_product_tabs', function ($tabs) {
4
5 if(isset($tabs['description'])) {
6 $tabs['description']['callback'] = 'woocommerce_product_description_tab';
7 }
8
9 return $tabs;
10 }, 999);
11
12
13 \ShopEngine\Widgets\Widget_Helper::instance()->comment_template_filter_checker();
14
15
16 \ShopEngine\Widgets\Widget_Helper::instance()->wc_template_filter_by_match('woocommerce/single-product/tabs/tabs.php', 'templates/single-product/tabs/tabs.php');
17
18 $product = \ShopEngine\Widgets\Products::instance()->get_product($post_type);
19
20 $product_tabs = apply_filters('woocommerce_product_tabs', []);
21
22 $in_editor_mode = \ShopEngine\Core\Template_Cpt::TYPE == get_post_type();
23
24 if($in_editor_mode) {
25
26 global $product, $post;
27
28 $main_post = clone $post;
29
30 $product = \ShopEngine\Widgets\Products::instance()->get_product($post_type);
31 $post = get_post($product->get_id());
32
33 add_filter('the_content', [\ShopEngine\Widgets\Products::instance(), 'product_tab_content_preview']);
34
35 $product_tabs = woocommerce_default_product_tabs();
36 }
37
38 // Remove Auxin Shop template loader filter
39
40 if ( is_plugin_active('auxin-shop/auxin-shop.php') ) {
41
42 remove_filter('wc_get_template', 'auxshp_get_wc_template', 11, 2);
43 remove_filter( 'woocommerce_product_review_comment_form_args', 'auxshp_modern_form_ouput', 10, 1 );
44
45 // Remove Auxin Shop template loader filter
46 global $wp_filter;
47 if (isset($wp_filter['woocommerce_locate_template'])) {
48 foreach ($wp_filter['woocommerce_locate_template']->callbacks as $priority => $callbacks) {
49 foreach ($callbacks as $key => $callback) {
50 if (is_array($callback['function']) &&
51 is_object($callback['function'][0]) &&
52 get_class($callback['function'][0]) === 'AUXSHP_Template_Loader' &&
53 $callback['function'][1] === 'load_templates') {
54 unset($wp_filter['woocommerce_locate_template']->callbacks[$priority][$key]);
55 }
56 }
57 }
58 }
59 }
60
61 ?>
62
63 <div class="shopengine-product-tabs">
64 <?php
65 // Get widget settings
66 $settings = isset($settings) ? $settings : [];
67 $enable_attribute_links = isset($settings['shopengine_product_tabs_enable_attribute_links']) ? $settings['shopengine_product_tabs_enable_attribute_links'] : 'yes';
68 $link_target = isset($settings['shopengine_product_tabs_attribute_link_target']) ? $settings['shopengine_product_tabs_attribute_link_target'] : '';
69
70 // Add a temporary filter so attribute values link to the shop page with a filter query param
71 $shop_attribute_link_filter = null;
72
73 if ($enable_attribute_links === 'yes') {
74 $shop_attribute_link_filter = function($html, $attribute, $values) use ($link_target) {
75 if ( is_object($attribute) && method_exists($attribute, 'is_taxonomy') ) {
76 $shop_url = '';
77 if ( function_exists('wc_get_page_permalink') ) {
78 $shop_url = wc_get_page_permalink('shop');
79 }
80 if ( empty($shop_url) ) {
81 $shop_url = get_post_type_archive_link('product');
82 }
83
84 $linked = [];
85 $target_attr = $link_target === '_blank' ? ' target="_blank" rel="noopener"' : '';
86
87 if ( $attribute->is_taxonomy() ) {
88 // Handle taxonomy attributes (pa_color, pa_size, etc)
89 $taxonomy = $attribute->get_name(); // e.g. pa_color
90 foreach ($values as $v) {
91 if ( is_object($v) && isset($v->slug) ) {
92 $term_slug = $v->slug;
93 $term_name = $v->name;
94 } else {
95 $term_name = wp_strip_all_tags((string)$v);
96 $term_slug = sanitize_title($term_name);
97 }
98 $param_name = 'filter_' . $taxonomy;
99 $url = add_query_arg($param_name, $term_slug, $shop_url);
100 $linked[] = sprintf('<a href="%s" rel="tag"%s>%s</a>', esc_url($url), $target_attr, esc_html($term_name));
101 }
102 } else {
103 // Handle custom attributes (stored in postmeta)
104 $attr_name = $attribute->get_name(); // e.g. 'Material', 'Brand'
105 $slug = sanitize_title($attr_name);
106 foreach ($values as $v) {
107 $value_text = is_object($v) ? $v->name : wp_strip_all_tags((string)$v);
108 $value_slug = sanitize_title($value_text);
109 $param_name = 'filter_custom_' . $slug;
110 $url = add_query_arg($param_name, $value_slug, $shop_url);
111 $linked[] = sprintf('<a href="%s" rel="tag"%s>%s</a>', esc_url($url), $target_attr, esc_html($value_text));
112 }
113 }
114
115 return wpautop(wptexturize(implode(', ', $linked)));
116 }
117
118 return $html;
119 };
120
121 add_filter('woocommerce_attribute', $shop_attribute_link_filter, 10, 3);
122 }
123
124 woocommerce_output_product_data_tabs();
125
126 // Remove our temporary filter so it doesn't affect other outputs
127 if ($shop_attribute_link_filter !== null) {
128 remove_filter('woocommerce_attribute', $shop_attribute_link_filter, 10, 3);
129 }
130 ?>
131 </div>
132
133 <?php
134
135 if($in_editor_mode) {
136
137 $post = $main_post;
138 }
139