← All changes
|
app/Controllers/ThemesSupport/Astra/WidgetsSupport.php
+47
-20
2.2.2
→
3.2.6
View file →
| @@ -62,8 +62,9 @@ | ||
| 62 | 62 | public function astra_flash_sale_html_remove( $html ) { |
| 63 | 63 | return ''; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | + | |
| 66 | 67 | /** |
| 67 | 68 | * Astra Wrapper |
| 68 | 69 | * |
| 69 | 70 | * @return void |
| @@ -99,9 +100,8 @@ | ||
| 99 | 100 | if ( ! defined( 'ASTRA_EXT_VER' ) || ( defined( 'ASTRA_EXT_VER' ) && ! \Astra_Ext_Extension::is_active( 'woocommerce' ) ) ) { |
| 100 | 101 | add_filter( 'astra_addon_shop_cards_buttons_html', [ $this, 'astra_flash_sale_html_remove' ] ); |
| 101 | 102 | } |
| 102 | 103 | } |
| 103 | - | |
| 104 | 104 | } |
| 105 | 105 | $this->widgets->apply_hooks_set_default(); |
| 106 | 106 | |
| 107 | 107 | // Variation Swatch fix |
| @@ -107,18 +107,25 @@ | ||
| 107 | 107 | // Variation Swatch fix |
| 108 | 108 | if ( class_exists( 'WooProductVariationSwatches' ) ) { |
| 109 | 109 | $swatches_position = rtwpvs()->get_option( 'archive_swatches_position' ); |
| 110 | 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 ); | |
| 111 | + remove_action( | |
| 112 | + 'woocommerce_before_shop_loop_item_title', | |
| 113 | + [ | |
| 114 | + ShopPage::class, | |
| 115 | + 'archive_variation_swatches', | |
| 116 | + ], | |
| 117 | + 35 | |
| 118 | + ); | |
| 119 | + add_action( | |
| 120 | + 'astra_woo_shop_title_before', | |
| 121 | + [ | |
| 122 | + ShopPage::class, | |
| 123 | + 'archive_variation_swatches', | |
| 124 | + ], | |
| 125 | + 35 | |
| 126 | + ); | |
| 119 | 127 | } |
| 120 | - | |
| 121 | 128 | } |
| 122 | 129 | |
| 123 | 130 | // Remove Action Button. |
| 124 | 131 | add_filter( 'rtsb/module/wishlist/show_button', '__return_false' ); |
| @@ -123,9 +130,8 @@ | ||
| 123 | 130 | // Remove Action Button. |
| 124 | 131 | add_filter( 'rtsb/module/wishlist/show_button', '__return_false' ); |
| 125 | 132 | add_filter( 'rtsb/module/quick_view/show_button', '__return_false' ); |
| 126 | 133 | add_filter( 'rtsb/module/compare/show_button', '__return_false' ); |
| 127 | - | |
| 128 | 134 | } |
| 129 | 135 | |
| 130 | 136 | /** |
| 131 | 137 | * Product Content Reset. |
| @@ -156,9 +162,8 @@ | ||
| 156 | 162 | $this->astra_product_loop(); |
| 157 | 163 | } |
| 158 | 164 | |
| 159 | 165 | /** |
| 160 | - * . | |
| 161 | 166 | * |
| 162 | 167 | * @return void |
| 163 | 168 | */ |
| 164 | 169 | public function render_reset_rtsb_products_archive() { |
| @@ -163,14 +168,21 @@ | ||
| 163 | 168 | */ |
| 164 | 169 | public function render_reset_rtsb_products_archive() { |
| 165 | 170 | $this->astra_product_loop_reset_default(); |
| 166 | 171 | } |
| 167 | - | |
| 168 | 172 | /** |
| 169 | 173 | * The function name comes from the widget base name "rtsb-products-archive". This is for theme support prefix with render. |
| 170 | 174 | * |
| 171 | 175 | * @return void |
| 172 | 176 | */ |
| 177 | + public function render_rtsb_product_rating() { | |
| 178 | + remove_filter( 'woocommerce_product_get_rating_html', [ \Astra_Woocommerce::get_instance(), 'rating_markup' ], 10 ); | |
| 179 | + } | |
| 180 | + /** | |
| 181 | + * The function name comes from the widget base name "rtsb-products-archive". This is for theme support prefix with render. | |
| 182 | + * | |
| 183 | + * @return void | |
| 184 | + */ | |
| 173 | 185 | public function render_rtsb_upsells_product() { |
| 174 | 186 | $this->astra_product_loop(); |
| 175 | 187 | } |
| 176 | 188 | |
| @@ -224,9 +236,9 @@ | ||
| 224 | 236 | * |
| 225 | 237 | * @return void |
| 226 | 238 | */ |
| 227 | 239 | public function render_rtsb_product_onsale() { |
| 228 | - add_filter( 'woocommerce_sale_flash', array( \Astra_Woocommerce::get_instance(), 'get_sale_flash_markup' ), 10, 3 ); | |
| 240 | + add_filter( 'woocommerce_sale_flash', [ \Astra_Woocommerce::get_instance(), 'get_sale_flash_markup' ], 10, 3 ); | |
| 229 | 241 | } |
| 230 | 242 | /** |
| 231 | 243 | * Cross Sell Product. |
| 232 | 244 | * |
| @@ -291,9 +303,27 @@ | ||
| 291 | 303 | 'value' => 'fas fa-long-arrow-alt-right', |
| 292 | 304 | 'library' => 'fa-solid', |
| 293 | 305 | ]; |
| 294 | 306 | } |
| 295 | - | |
| 307 | + $astra_onsale_card = '{{WRAPPER}} .products .product .ast-onsale-card'; | |
| 308 | + if ( ! empty( $fields['flash_sale_typography']['selector'] ) ) { | |
| 309 | + $fields['flash_sale_typography']['selector'] = $fields['flash_sale_typography']['selector'] . ',' . $astra_onsale_card; | |
| 310 | + } | |
| 311 | + if ( ! empty( $fields['product_flash_sale_color']['selectors'] ) ) { | |
| 312 | + $fields['product_flash_sale_color']['selectors'][ $astra_onsale_card ] = 'color: {{VALUE}};'; | |
| 313 | + } | |
| 314 | + if ( ! empty( $fields['flash_sale_bg_color']['selectors'] ) ) { | |
| 315 | + $fields['flash_sale_bg_color']['selectors'][ $astra_onsale_card ] = 'background-color: {{VALUE}};'; | |
| 316 | + } | |
| 317 | + if ( ! empty( $fields['flash_sale_badge_width']['selectors'] ) ) { | |
| 318 | + $fields['flash_sale_badge_width']['selectors'][ $astra_onsale_card ] = 'width: {{SIZE}}{{UNIT}}; text-align: center;'; | |
| 319 | + } | |
| 320 | + if ( ! empty( $fields['flash_sale_badge_height']['selectors'] ) ) { | |
| 321 | + $fields['flash_sale_badge_height']['selectors'][ $astra_onsale_card ] = 'height: {{SIZE}}{{UNIT}};'; | |
| 322 | + } | |
| 323 | + if ( ! empty( $fields['flash_sale_badge_border_radius']['selectors'] ) ) { | |
| 324 | + $fields['flash_sale_badge_border_radius']['selectors'][ $astra_onsale_card ] = 'border-radius: {{SIZE}}{{UNIT}};'; | |
| 325 | + } | |
| 296 | 326 | return $fields; |
| 297 | 327 | } |
| 298 | 328 | |
| 299 | 329 | /** |
| @@ -322,10 +352,10 @@ | ||
| 322 | 352 | * |
| 323 | 353 | * @return array |
| 324 | 354 | */ |
| 325 | 355 | public function widget_controls_flash_sale( $fields ) { |
| 326 | - $selector = '{{WRAPPER}} .products .product .ast-onsale-card'; | |
| 327 | - $fields['flash_sale_typography']['selector'] = $selector; | |
| 356 | + $selector = '{{WRAPPER}} .products .product .ast-onsale-card'; | |
| 357 | + $fields['flash_sale_typography']['selector'] = $selector; | |
| 328 | 358 | $fields['product_flash_sale_color']['selectors'][ $selector ] = 'color: {{VALUE}};'; |
| 329 | 359 | $fields['flash_sale_bg_color']['selectors'][ $selector ] = 'background-color: {{VALUE}};'; |
| 330 | 360 | $fields['flash_sale_badge_width']['selectors'][ $selector ] = 'width: {{SIZE}}{{UNIT}};display:flex; justify-content: center;'; |
| 331 | 361 | $fields['flash_sale_badge_height']['selectors'][ $selector ] = 'height: {{SIZE}}{{UNIT}};align-items:center;'; |
| @@ -332,8 +362,5 @@ | ||
| 332 | 362 | $fields['flash_sale_badge_border_radius']['selectors'][ $selector ] = 'border-radius: {{SIZE}}{{UNIT}};'; |
| 333 | 363 | |
| 334 | 364 | return $fields; |
| 335 | 365 | } |
| 336 | - | |
| 337 | - | |
| 338 | 366 | } |
| 339 | - | |