← All changes
|
app/Controllers/ThemesSupport/Astra/WidgetsSupport.php
+254
-339
2.1.11
→
1.1.4
View file →
| @@ -1,339 +1,254 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * Main ProductDescription class. | |
| 5 | - * | |
| 6 | - * @package RadiusTheme\SB | |
| 7 | - */ | |
| 8 | - | |
| 9 | -namespace RadiusTheme\SB\Controllers\ThemesSupport\Astra; | |
| 10 | - | |
| 11 | -// Do not allow directly accessing this file. | |
| 12 | -use Rtwpvsp\Controllers\ShopPage; | |
| 13 | - | |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 15 | - exit( 'This script cannot be accessed directly.' ); | |
| 16 | -} | |
| 17 | - | |
| 18 | -/** | |
| 19 | - * Product Description class | |
| 20 | - */ | |
| 21 | -class WidgetsSupport { | |
| 22 | - | |
| 23 | - /** | |
| 24 | - * The single instance of the class. | |
| 25 | - * | |
| 26 | - * @var object | |
| 27 | - */ | |
| 28 | - protected static $instance = null; | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * The single instance of the class. | |
| 32 | - * | |
| 33 | - * @var object | |
| 34 | - */ | |
| 35 | - private $widgets; | |
| 36 | - | |
| 37 | - /** | |
| 38 | - * Construct function | |
| 39 | - */ | |
| 40 | - private function __construct() { | |
| 41 | - } | |
| 42 | - | |
| 43 | - /** | |
| 44 | - * Get class instance. | |
| 45 | - * | |
| 46 | - * @return object Instance. | |
| 47 | - */ | |
| 48 | - public static function instance( $widgets ) { | |
| 49 | - if ( ! self::$instance ) { | |
| 50 | - self::$instance = new self(); | |
| 51 | - } | |
| 52 | - self::$instance->widgets = $widgets; | |
| 53 | - | |
| 54 | - return self::$instance; | |
| 55 | - } | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * @param $html | |
| 59 | - * | |
| 60 | - * @return string | |
| 61 | - */ | |
| 62 | - public function astra_flash_sale_html_remove( $html ) { | |
| 63 | - return ''; | |
| 64 | - } | |
| 65 | - | |
| 66 | - /** | |
| 67 | - * Astra Wrapper | |
| 68 | - * | |
| 69 | - * @return void | |
| 70 | - */ | |
| 71 | - public function astra_woo_shop_thumbnail_wrap_start() { | |
| 72 | - echo '<div class="astra-shop-thumbnail-wrap rtsb-image-wrapper">'; | |
| 73 | - } | |
| 74 | - | |
| 75 | - /** | |
| 76 | - * Product Loop content Modify. | |
| 77 | - * | |
| 78 | - * @return void | |
| 79 | - */ | |
| 80 | - public function astra_product_loop() { | |
| 81 | - $controllers = $this->widgets->get_settings_for_display(); | |
| 82 | - | |
| 83 | - if ( ! apply_filters( 'astra_woo_shop_product_structure_override', false ) ) { | |
| 84 | - // Remove some hooks. | |
| 85 | - remove_action( 'woocommerce_before_shop_loop_item', 'astra_woo_shop_thumbnail_wrap_start', 6 ); | |
| 86 | - remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 ); | |
| 87 | - remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 ); | |
| 88 | - remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); | |
| 89 | - remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); | |
| 90 | - | |
| 91 | - // Adding some hooks. | |
| 92 | - add_action( 'woocommerce_before_shop_loop_item', [ $this, 'astra_woo_shop_thumbnail_wrap_start' ], 6 ); | |
| 93 | - add_action( 'woocommerce_after_shop_loop_item', 'astra_woo_shop_thumbnail_wrap_end', 8 ); | |
| 94 | - add_action( 'woocommerce_after_shop_loop_item', 'astra_woo_woocommerce_shop_product_content' ); | |
| 95 | - add_action( 'astra_woo_shop_before_summary_wrap', [ $this->widgets, 'product_content_wrapper' ], 6 ); | |
| 96 | - add_action( 'astra_woo_shop_after_summary_wrap', [ $this->widgets, 'div_close' ], 6 ); | |
| 97 | - | |
| 98 | - if ( empty( $controllers['show_flash_sale'] ) ) { | |
| 99 | - if ( ! defined( 'ASTRA_EXT_VER' ) || ( defined( 'ASTRA_EXT_VER' ) && ! \Astra_Ext_Extension::is_active( 'woocommerce' ) ) ) { | |
| 100 | - add_filter( 'astra_addon_shop_cards_buttons_html', [ $this, 'astra_flash_sale_html_remove' ] ); | |
| 101 | - } | |
| 102 | - } | |
| 103 | - | |
| 104 | - } | |
| 105 | - $this->widgets->apply_hooks_set_default(); | |
| 106 | - | |
| 107 | - // Variation Swatch fix | |
| 108 | - if ( class_exists( 'WooProductVariationSwatches' ) ) { | |
| 109 | - $swatches_position = rtwpvs()->get_option( 'archive_swatches_position' ); | |
| 110 | - if ( 'before_title_and_price' == $swatches_position && class_exists( ShopPage::class ) ) { | |
| 111 | - remove_action( 'woocommerce_before_shop_loop_item_title', [ | |
| 112 | - ShopPage::class, | |
| 113 | - 'archive_variation_swatches', | |
| 114 | - ], 35 ); | |
| 115 | - add_action( 'astra_woo_shop_title_before', [ | |
| 116 | - ShopPage::class, | |
| 117 | - 'archive_variation_swatches', | |
| 118 | - ], 35 ); | |
| 119 | - } | |
| 120 | - | |
| 121 | - } | |
| 122 | - | |
| 123 | - // Remove Action Button. | |
| 124 | - add_filter( 'rtsb/module/wishlist/show_button', '__return_false' ); | |
| 125 | - add_filter( 'rtsb/module/quick_view/show_button', '__return_false' ); | |
| 126 | - add_filter( 'rtsb/module/compare/show_button', '__return_false' ); | |
| 127 | - | |
| 128 | - } | |
| 129 | - | |
| 130 | - /** | |
| 131 | - * Product Content Reset. | |
| 132 | - * | |
| 133 | - * @return void | |
| 134 | - */ | |
| 135 | - public function astra_product_loop_reset_default() { | |
| 136 | - $controllers = $this->widgets->get_settings_for_display(); | |
| 137 | - | |
| 138 | - if ( ! apply_filters( 'astra_woo_shop_product_structure_override', false ) ) { | |
| 139 | - // Remove Product Content Wrapper. | |
| 140 | - remove_action( 'astra_woo_shop_before_summary_wrap', [ $this->widgets, 'product_content_wrapper' ], 6 ); | |
| 141 | - remove_action( 'astra_woo_shop_after_summary_wrap', [ $this->widgets, 'div_close' ], 6 ); | |
| 142 | - if ( empty( $controllers['show_flash_sale'] ) ) { | |
| 143 | - if ( ! defined( 'ASTRA_EXT_VER' ) || ( defined( 'ASTRA_EXT_VER' ) && ! \Astra_Ext_Extension::is_active( 'woocommerce' ) ) ) { | |
| 144 | - remove_filter( 'astra_addon_shop_cards_buttons_html', [ $this, 'astra_flash_sale_html_remove' ] ); | |
| 145 | - } | |
| 146 | - } | |
| 147 | - } | |
| 148 | - } | |
| 149 | - | |
| 150 | - /** | |
| 151 | - * The function name comes from the widget base name "rtsb-products-archive". This is for theme support prefix with render. | |
| 152 | - * | |
| 153 | - * @return void | |
| 154 | - */ | |
| 155 | - public function render_rtsb_products_archive() { | |
| 156 | - $this->astra_product_loop(); | |
| 157 | - } | |
| 158 | - | |
| 159 | - /** | |
| 160 | - * . | |
| 161 | - * | |
| 162 | - * @return void | |
| 163 | - */ | |
| 164 | - public function render_reset_rtsb_products_archive() { | |
| 165 | - $this->astra_product_loop_reset_default(); | |
| 166 | - } | |
| 167 | - | |
| 168 | - /** | |
| 169 | - * The function name comes from the widget base name "rtsb-products-archive". This is for theme support prefix with render. | |
| 170 | - * | |
| 171 | - * @return void | |
| 172 | - */ | |
| 173 | - public function render_rtsb_upsells_product() { | |
| 174 | - $this->astra_product_loop(); | |
| 175 | - } | |
| 176 | - | |
| 177 | - /** | |
| 178 | - * Reset Hooks. | |
| 179 | - * | |
| 180 | - * @return void | |
| 181 | - */ | |
| 182 | - public function render_reset_rtsb_upsells_product() { | |
| 183 | - $this->astra_product_loop_reset_default(); | |
| 184 | - } | |
| 185 | - | |
| 186 | - /** | |
| 187 | - * Related Product. | |
| 188 | - * | |
| 189 | - * @return void | |
| 190 | - */ | |
| 191 | - public function render_rtsb_related_product() { | |
| 192 | - $this->astra_product_loop(); | |
| 193 | - } | |
| 194 | - | |
| 195 | - /** | |
| 196 | - * Related Product. | |
| 197 | - * | |
| 198 | - * @return void | |
| 199 | - */ | |
| 200 | - public function render_reset_rtsb_related_product() { | |
| 201 | - $this->astra_product_loop_reset_default(); | |
| 202 | - } | |
| 203 | - | |
| 204 | - /** | |
| 205 | - * Cross Sell Product. | |
| 206 | - * | |
| 207 | - * @return void | |
| 208 | - */ | |
| 209 | - public function render_rtsb_cross_sells() { | |
| 210 | - $this->astra_product_loop(); | |
| 211 | - } | |
| 212 | - | |
| 213 | - /** | |
| 214 | - * Cross Sell Product. | |
| 215 | - * | |
| 216 | - * @return void | |
| 217 | - */ | |
| 218 | - public function render_reset_rtsb_cross_sells() { | |
| 219 | - $this->astra_product_loop_reset_default(); | |
| 220 | - } | |
| 221 | - | |
| 222 | - /** | |
| 223 | - * Cross Sell Product. | |
| 224 | - * | |
| 225 | - * @return void | |
| 226 | - */ | |
| 227 | - public function render_rtsb_product_onsale() { | |
| 228 | - add_filter( 'woocommerce_sale_flash', array( \Astra_Woocommerce::get_instance(), 'get_sale_flash_markup' ), 10, 3 ); | |
| 229 | - } | |
| 230 | - /** | |
| 231 | - * Cross Sell Product. | |
| 232 | - * | |
| 233 | - * @return void | |
| 234 | - */ | |
| 235 | - public function render_rtsb_product_stock() { | |
| 236 | - remove_filter( 'woocommerce_get_stock_html', 'astra_woo_product_in_stock', 10, 2 ); | |
| 237 | - } | |
| 238 | - | |
| 239 | - /** | |
| 240 | - * The function name comes from the widget base name "rtsb-products-archive". This is for theme support prefix with widget_controls. | |
| 241 | - * | |
| 242 | - * @return void | |
| 243 | - */ | |
| 244 | - public function widget_controls_rtsb_product_tabs() { | |
| 245 | - add_filter( 'rtsb/elements/elementor/widgets/controls/rtsb-product-tabs', [ $this, 'product_tabs_widget_controls_support' ] ); | |
| 246 | - } | |
| 247 | - | |
| 248 | - /** | |
| 249 | - * Widget Field. | |
| 250 | - * | |
| 251 | - * @return array | |
| 252 | - */ | |
| 253 | - public function product_tabs_widget_controls_support( $fields ) { | |
| 254 | - $fields['nav_active_border_color']['selectors'] = array_merge( | |
| 255 | - $fields['nav_active_border_color']['selectors'], | |
| 256 | - [ | |
| 257 | - '{{WRAPPER}} .woocommerce-tabs ul.tabs li.active:before' => 'background: {{VALUE}}', | |
| 258 | - ] | |
| 259 | - ); | |
| 260 | - $fields['nav_active_hover_border_color']['selectors'] = array_merge( | |
| 261 | - $fields['nav_active_hover_border_color']['selectors'], | |
| 262 | - [ | |
| 263 | - '{{WRAPPER}} .woocommerce-tabs ul.tabs li.active:hover:before' => 'background: {{VALUE}}', | |
| 264 | - ] | |
| 265 | - ); | |
| 266 | - | |
| 267 | - return $fields; | |
| 268 | - } | |
| 269 | - | |
| 270 | - /** | |
| 271 | - * The function name comes from the widget base name "rtsb-products-archive". This is for theme support prefix with "widget_controls". | |
| 272 | - * | |
| 273 | - * @return void | |
| 274 | - */ | |
| 275 | - public function widget_controls_rtsb_products_archive() { | |
| 276 | - add_filter( 'rtsb/elements/elementor/widgets/controls/rtsb-products-archive', [ $this, 'product_loop_widget_controls_support' ], 11 ); | |
| 277 | - } | |
| 278 | - | |
| 279 | - /** | |
| 280 | - * Widget Field. | |
| 281 | - * | |
| 282 | - * @return array | |
| 283 | - */ | |
| 284 | - public function product_loop_widget_controls_support( $fields ) { | |
| 285 | - if ( $this->widgets->has_pagination ) { | |
| 286 | - $fields['prev_icon']['default'] = [ | |
| 287 | - 'value' => 'fas fa-long-arrow-alt-left', | |
| 288 | - 'library' => 'fa-solid', | |
| 289 | - ]; | |
| 290 | - $fields['next_icon']['default'] = [ | |
| 291 | - 'value' => 'fas fa-long-arrow-alt-right', | |
| 292 | - 'library' => 'fa-solid', | |
| 293 | - ]; | |
| 294 | - } | |
| 295 | - | |
| 296 | - return $fields; | |
| 297 | - } | |
| 298 | - | |
| 299 | - /** | |
| 300 | - * The function name comes from the widget base name "rtsb-products-archive". This is for theme support prefix with widget_controls. | |
| 301 | - * | |
| 302 | - * @return void | |
| 303 | - */ | |
| 304 | - public function widget_controls_rtsb_related_product() { | |
| 305 | - add_filter( 'rtsb/elements/elementor/widgets/controls/rtsb-related-product', [ $this, 'widget_controls_flash_sale' ] ); | |
| 306 | - } | |
| 307 | - | |
| 308 | - /** | |
| 309 | - * @return void | |
| 310 | - */ | |
| 311 | - public function widget_controls_rtsb_upsells_product() { | |
| 312 | - add_filter( 'rtsb/elements/elementor/widgets/controls/rtsb-upsells-product', [ $this, 'widget_controls_flash_sale' ] ); | |
| 313 | - } | |
| 314 | - /** | |
| 315 | - * @return void | |
| 316 | - */ | |
| 317 | - public function widget_controls_rtsb_cross_sells() { | |
| 318 | - add_filter( 'rtsb/elements/elementor/widgets/controls/rtsb-cross-sells', [ $this, 'widget_controls_flash_sale' ] ); | |
| 319 | - } | |
| 320 | - /** | |
| 321 | - * Widget Field. | |
| 322 | - * | |
| 323 | - * @return array | |
| 324 | - */ | |
| 325 | - public function widget_controls_flash_sale( $fields ) { | |
| 326 | - $selector = '{{WRAPPER}} .products .product .ast-onsale-card'; | |
| 327 | - $fields['flash_sale_typography']['selector'] = $selector; | |
| 328 | - $fields['product_flash_sale_color']['selectors'][ $selector ] = 'color: {{VALUE}};'; | |
| 329 | - $fields['flash_sale_bg_color']['selectors'][ $selector ] = 'background-color: {{VALUE}};'; | |
| 330 | - $fields['flash_sale_badge_width']['selectors'][ $selector ] = 'width: {{SIZE}}{{UNIT}};display:flex; justify-content: center;'; | |
| 331 | - $fields['flash_sale_badge_height']['selectors'][ $selector ] = 'height: {{SIZE}}{{UNIT}};align-items:center;'; | |
| 332 | - $fields['flash_sale_badge_border_radius']['selectors'][ $selector ] = 'border-radius: {{SIZE}}{{UNIT}};'; | |
| 333 | - | |
| 334 | - return $fields; | |
| 335 | - } | |
| 336 | - | |
| 337 | - | |
| 338 | -} | |
| 339 | - | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Main ProductDescription class. | |
| 5 | + * | |
| 6 | + * @package RadiusTheme\SB | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace RadiusTheme\SB\Controllers\ThemesSupport\Astra; | |
| 10 | + | |
| 11 | +// Do not allow directly accessing this file. | |
| 12 | +use Rtwpvsp\Controllers\ShopPage; | |
| 13 | + | |
| 14 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 15 | + exit( 'This script cannot be accessed directly.' ); | |
| 16 | +} | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * Product Description class | |
| 20 | + */ | |
| 21 | +class WidgetsSupport { | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * The single instance of the class. | |
| 25 | + * | |
| 26 | + * @var object | |
| 27 | + */ | |
| 28 | + protected static $instance = null; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * The single instance of the class. | |
| 32 | + * | |
| 33 | + * @var object | |
| 34 | + */ | |
| 35 | + private $widgets; | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * Construct function | |
| 39 | + */ | |
| 40 | + private function __construct() {} | |
| 41 | + /** | |
| 42 | + * Get class instance. | |
| 43 | + * | |
| 44 | + * @return object Instance. | |
| 45 | + */ | |
| 46 | + public static function instance( $widgets ) { | |
| 47 | + if ( ! self::$instance ) { | |
| 48 | + self::$instance = new self(); | |
| 49 | + } | |
| 50 | + self::$instance->widgets = $widgets; | |
| 51 | + return self::$instance; | |
| 52 | + } | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * Astra Wrapper | |
| 56 | + * | |
| 57 | + * @return void | |
| 58 | + */ | |
| 59 | + public function astra_woo_shop_thumbnail_wrap_start() { | |
| 60 | + echo '<div class="astra-shop-thumbnail-wrap rtsb-image-wrapper">'; | |
| 61 | + } | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * Product Loop content Modify. | |
| 65 | + * | |
| 66 | + * @return void | |
| 67 | + */ | |
| 68 | + public function astra_product_loop() { | |
| 69 | + if ( ! apply_filters( 'astra_woo_shop_product_structure_override', false ) ) { | |
| 70 | + // Remove some hooks. | |
| 71 | + remove_action( 'woocommerce_before_shop_loop_item', 'astra_woo_shop_thumbnail_wrap_start', 6 ); | |
| 72 | + remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 ); | |
| 73 | + remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 ); | |
| 74 | + remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); | |
| 75 | + remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); | |
| 76 | + | |
| 77 | + // Adding some hooks. | |
| 78 | + add_action( 'woocommerce_before_shop_loop_item', [ $this, 'astra_woo_shop_thumbnail_wrap_start' ], 6 ); | |
| 79 | + add_action( 'woocommerce_after_shop_loop_item', 'astra_woo_shop_thumbnail_wrap_end', 8 ); | |
| 80 | + add_action( 'woocommerce_after_shop_loop_item', 'astra_woo_woocommerce_shop_product_content' ); | |
| 81 | + add_action( 'astra_woo_shop_before_summary_wrap', [ $this->widgets, 'product_content_wrapper' ], 6 ); | |
| 82 | + add_action( 'astra_woo_shop_after_summary_wrap', [ $this->widgets, 'div_close' ], 6 ); | |
| 83 | + } | |
| 84 | + $this->widgets->apply_hooks_set_default(); | |
| 85 | + | |
| 86 | + // Variation Swatch fix | |
| 87 | + if ( class_exists('WooProductVariationSwatches') ) { | |
| 88 | + $swatches_position = rtwpvs()->get_option( 'archive_swatches_position' ); | |
| 89 | + if( 'before_title_and_price' == $swatches_position && class_exists( ShopPage::class ) ){ | |
| 90 | + remove_action('woocommerce_before_shop_loop_item_title', [ | |
| 91 | + ShopPage::class, | |
| 92 | + 'archive_variation_swatches', | |
| 93 | + ], 35); | |
| 94 | + add_action('astra_woo_shop_title_before', [ | |
| 95 | + ShopPage::class, | |
| 96 | + 'archive_variation_swatches', | |
| 97 | + ], 35); | |
| 98 | + } | |
| 99 | + | |
| 100 | + } | |
| 101 | + | |
| 102 | + | |
| 103 | + // Remove Action Button. | |
| 104 | + add_filter( 'rtsb/module/wishlist/show_button', '__return_false' ); | |
| 105 | + add_filter( 'rtsb/module/quick_view/show_button', '__return_false' ); | |
| 106 | + add_filter( 'rtsb/module/compare/show_button', '__return_false' ); | |
| 107 | + | |
| 108 | + } | |
| 109 | + /** | |
| 110 | + * Product Content Reset. | |
| 111 | + * | |
| 112 | + * @return void | |
| 113 | + */ | |
| 114 | + public function astra_product_loop_reset_default() { | |
| 115 | + if ( ! apply_filters( 'astra_woo_shop_product_structure_override', false ) ) { | |
| 116 | + // Remove Product Content Wrapper. | |
| 117 | + remove_action( 'astra_woo_shop_before_summary_wrap', [ $this->widgets, 'product_content_wrapper' ], 6 ); | |
| 118 | + remove_action( 'astra_woo_shop_after_summary_wrap', [ $this->widgets, 'div_close' ], 6 ); | |
| 119 | + } | |
| 120 | + } | |
| 121 | + /** | |
| 122 | + * The function name comes from the widget base name "rtsb-products-archive". This is for theme support prefix with render. | |
| 123 | + * | |
| 124 | + * @return void | |
| 125 | + */ | |
| 126 | + public function render_rtsb_products_archive() { | |
| 127 | + $this->astra_product_loop(); | |
| 128 | + } | |
| 129 | + /** | |
| 130 | + * . | |
| 131 | + * | |
| 132 | + * @return void | |
| 133 | + */ | |
| 134 | + public function render_reset_rtsb_products_archive() { | |
| 135 | + $this->astra_product_loop_reset_default(); | |
| 136 | + } | |
| 137 | + /** | |
| 138 | + * The function name comes from the widget base name "rtsb-products-archive". This is for theme support prefix with render. | |
| 139 | + * | |
| 140 | + * @return void | |
| 141 | + */ | |
| 142 | + public function render_rtsb_upsells_product() { | |
| 143 | + $this->astra_product_loop(); | |
| 144 | + } | |
| 145 | + /** | |
| 146 | + * Reset Hooks. | |
| 147 | + * | |
| 148 | + * @return void | |
| 149 | + */ | |
| 150 | + public function render_reset_rtsb_upsells_product() { | |
| 151 | + $this->astra_product_loop_reset_default(); | |
| 152 | + } | |
| 153 | + | |
| 154 | + /** | |
| 155 | + * Related Product. | |
| 156 | + * | |
| 157 | + * @return void | |
| 158 | + */ | |
| 159 | + public function render_rtsb_related_product() { | |
| 160 | + $this->astra_product_loop(); | |
| 161 | + } | |
| 162 | + /** | |
| 163 | + * Related Product. | |
| 164 | + * | |
| 165 | + * @return void | |
| 166 | + */ | |
| 167 | + public function render_reset_rtsb_related_product() { | |
| 168 | + $this->astra_product_loop_reset_default(); | |
| 169 | + } | |
| 170 | + /** | |
| 171 | + * Cross Sell Product. | |
| 172 | + * | |
| 173 | + * @return void | |
| 174 | + */ | |
| 175 | + public function render_rtsb_cross_sells() { | |
| 176 | + $this->astra_product_loop(); | |
| 177 | + } | |
| 178 | + /** | |
| 179 | + * Cross Sell Product. | |
| 180 | + * | |
| 181 | + * @return void | |
| 182 | + */ | |
| 183 | + public function render_reset_rtsb_cross_sells() { | |
| 184 | + $this->astra_product_loop_reset_default(); | |
| 185 | + } | |
| 186 | + | |
| 187 | + /** | |
| 188 | + * Cross Sell Product. | |
| 189 | + * | |
| 190 | + * @return void | |
| 191 | + */ | |
| 192 | + public function render_rtsb_product_onsale() { | |
| 193 | + add_filter( 'woocommerce_sale_flash', array( \Astra_Woocommerce::get_instance(), 'get_sale_flash_markup' ), 10, 3 ); | |
| 194 | + } | |
| 195 | + | |
| 196 | + /** | |
| 197 | + * The function name comes from the widget base name "rtsb-products-archive". This is for theme support prefix with widget_controls. | |
| 198 | + * | |
| 199 | + * @return void | |
| 200 | + */ | |
| 201 | + public function widget_controls_rtsb_product_tabs() { | |
| 202 | + add_filter( 'rtsb/elements/elementor/single/rtsb-product-tabs', [ $this, 'product_tabs_widget_controls_support' ] ); | |
| 203 | + } | |
| 204 | + /** | |
| 205 | + * Widget Field. | |
| 206 | + * | |
| 207 | + * @return array | |
| 208 | + */ | |
| 209 | + public function product_tabs_widget_controls_support( $fields ) { | |
| 210 | + $fields['nav_active_border_color']['selectors'] = array_merge( | |
| 211 | + $fields['nav_active_border_color']['selectors'], | |
| 212 | + [ | |
| 213 | + '{{WRAPPER}} .woocommerce-tabs ul.tabs li.active:before' => 'background: {{VALUE}}', | |
| 214 | + ] | |
| 215 | + ); | |
| 216 | + $fields['nav_active_hover_border_color']['selectors'] = array_merge( | |
| 217 | + $fields['nav_active_hover_border_color']['selectors'], | |
| 218 | + [ | |
| 219 | + '{{WRAPPER}} .woocommerce-tabs ul.tabs li.active:hover:before' => 'background: {{VALUE}}', | |
| 220 | + ] | |
| 221 | + ); | |
| 222 | + return $fields; | |
| 223 | + } | |
| 224 | + /** | |
| 225 | + * The function name comes from the widget base name "rtsb-products-archive". This is for theme support prefix with "widget_controls". | |
| 226 | + * | |
| 227 | + * @return void | |
| 228 | + */ | |
| 229 | + public function widget_controls_rtsb_products_archive() { | |
| 230 | + add_filter( 'rtsb/elements/elementor/rtsb_product_loop/rtsb-products-archive', [ $this, 'product_loop_widget_controls_support' ], 11 ); | |
| 231 | + } | |
| 232 | + /** | |
| 233 | + * Widget Field. | |
| 234 | + * | |
| 235 | + * @return array | |
| 236 | + */ | |
| 237 | + public function product_loop_widget_controls_support( $fields ) { | |
| 238 | + if ( $this->widgets->has_pagination ) { | |
| 239 | + $fields['prev_icon']['default'] = [ | |
| 240 | + 'value' => 'fas fa-long-arrow-alt-left', | |
| 241 | + 'library' => 'fa-solid', | |
| 242 | + ]; | |
| 243 | + $fields['next_icon']['default'] = [ | |
| 244 | + 'value' => 'fas fa-long-arrow-alt-right', | |
| 245 | + 'library' => 'fa-solid', | |
| 246 | + ]; | |
| 247 | + } | |
| 248 | + return $fields; | |
| 249 | + } | |
| 250 | + | |
| 251 | + | |
| 252 | +} | |
| 253 | + | |
| 254 | +// woocommerce_pagination_args | |