PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 1.10.3
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v1.10.3
2.3.2 2.3.1 2.3.0 2.2.8 2.2.7 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.11.1 1.11.2 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 1.9.10 1.9.11 All 60 releases
merchant / inc / compatibility / class-merchant-breakdance-builder.php

class-merchant-breakdance-builder.php in Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant 1.10.3, at inc/compatibility/class-merchant-breakdance-builder.php

350 lines 13.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 /**
8 * Breakdance Builder compatibility layer
9 */
10 if ( ! class_exists( 'Merchant_Breakdance_Builder' ) ) {
11 class Merchant_Breakdance_Builder {
12
13 /**
14 * Constructor.
15 */
16 public function __construct() {
17 if ( ( is_admin() && ! wp_doing_ajax() ) || ! merchant_is_breakdance_active() ) {
18 return;
19 }
20
21 // Quick View
22 if ( Merchant_Modules::is_module_active( Merchant_Quick_View::MODULE_ID ) ) {
23 $button_position = Merchant_Admin_Options::get( Merchant_Quick_View::MODULE_ID, 'button_position', 'overlay' );
24
25 if ( 'overlay' === $button_position ) {
26 $merchant_quick_view = Merchant_Quick_View::get_instance();
27 add_filter( 'breakdance_before_shop_loop_after_image', array( $merchant_quick_view, 'quick_view_button' ) );
28 remove_action( 'woocommerce_after_shop_loop_item', array( $merchant_quick_view, 'quick_view_button' ) );
29 }
30 }
31
32 if ( merchant_is_pro_active() ) {
33 // Variation Swatches
34 if ( Merchant_Modules::is_module_active( Merchant_Product_Swatches::MODULE_ID ) ) {
35 remove_action( 'breakdance_shop_loop_footer', 'woocommerce_template_loop_add_to_cart' );
36 }
37
38 // Wishlist
39 if ( Merchant_Modules::is_module_active( Merchant_Wishlist::MODULE_ID ) ) {
40 // Display on single product.
41 $display_on_single_product = Merchant_Admin_Options::get( Merchant_Wishlist::MODULE_ID, 'display_on_single_product', true );
42 if ( $display_on_single_product ) {
43 $wishlist = new Merchant_Pro_Wishlist( Merchant_Modules::get_module( Merchant_Wishlist::MODULE_ID ) );;
44
45 add_action( 'woocommerce_after_add_to_cart_form', array( $wishlist, 'wishlist_link' ) );
46 }
47 }
48
49
50 // Side/Floating Mini Cart
51 if ( Merchant_Modules::is_module_active( Merchant_Side_Cart::MODULE_ID ) || Merchant_Modules::is_module_active( Merchant_Floating_Mini_Cart::MODULE_ID ) ) {
52 remove_action( 'woocommerce_widget_cart_item_quantity', '\Breakdance\WooCommerce\addQuantityInputToMiniCart' );
53 }
54
55 // Product Audio
56 if ( Merchant_Modules::is_module_active( Merchant_Product_Audio::MODULE_ID ) || Merchant_Modules::is_module_active( Merchant_Product_Video::MODULE_ID ) ) {
57 add_action('woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail');
58
59 remove_action('woocommerce_before_shop_loop_item_title', '\Breakdance\WooCommerce\wrapThumbnailInADiv' );
60 }
61 }
62
63 // Custom CSS.
64 add_filter( 'merchant_custom_css', array( $this, 'frontend_custom_css' ) );
65 }
66
67 /**
68 * Frontend custom CSS.
69 *
70 * @param string $css The custom CSS.
71 * @return string $css The custom CSS.
72 */
73 public function frontend_custom_css( $css ) {
74 $css .= Merchant_Floating_Mini_Cart::get_module_custom_css();
75
76 // Quick View
77 if ( Merchant_Modules::is_module_active( Merchant_Quick_View::MODULE_ID ) ) {
78 $css .= '
79 .breakdance-woocommerce .products .product .merchant-quick-view-button {
80 padding: var(--bde-button-padding-base);
81 font-size: var(--bde-button-font-size);
82 line-height: var(--bde-button-line-height);
83 font-weight: var(--bde-button-font-weight);
84 border-radius: var(--bde-button-border-radius);
85 }
86 .breakdance-woocommerce .products .product .merchant-quick-view-position-before {
87 margin-bottom: 10px;
88 }
89 .breakdance-woocommerce .products .product .merchant-quick-view-position-after {
90 margin-top: 10px;
91 }
92 .breakdance-woocommerce .products .product .merchant-quick-view-position-overlay {
93 width: auto;
94 position: absolute;
95 }
96 .merchant-quick-view-modal .bde-quantity-button {
97 display: none !important;
98 }
99 .merchant-quick-view-modal .single_add_to_cart_button,
100 .merchant-quick-view-modal .merchant-bogo-add-to-cart,
101 .merchant-quick-view-modal .merchant-add-bundle-to-cart {
102 padding: var(--bde-button-padding-base);
103 font-size: var(--bde-button-font-size);
104 line-height: var(--bde-button-line-height);
105 font-weight: var(--bde-button-font-weight);
106 border-radius: var(--bde-button-border-radius);
107 }
108 .merchant-quick-view-modal input[type=number] {
109 width: 80px;
110 text-align: center;
111 padding: 10px;
112 }
113 .merchant-quick-view-modal .variations td.value,
114 .merchant-quick-view-modal .variations th.label {
115 display: block;
116 text-align: left;
117 margin: 7px 0;
118 }
119 .merchant-quick-view-modal .merchant-frequently-bought-together-bundle-product img {
120 max-width: none;
121 }
122 ';
123 }
124
125 if ( merchant_is_pro_active() ) {
126 // Variation Swatches
127 if ( Merchant_Modules::is_module_active( Merchant_Product_Swatches::MODULE_ID ) ) {
128 $css .= '
129 .breakdance-woocommerce .products .product a.merchant-variation-item {
130 width: auto;
131 }
132 .breakdance-woocommerce .products .product table.variations {
133 margin-bottom: 10px;
134 }
135 ';
136 }
137
138 // Wishlist
139 if ( Merchant_Modules::is_module_active( Merchant_Wishlist::MODULE_ID ) ) {
140 $css .= '
141 .breakdance-woocommerce .products .product .merchant-wishlist-button {
142 width: auto;
143 }
144 .single-product .merchant-wishlist-button {
145 position: static;
146 }
147 .single-product li .merchant-wishlist-button {
148 position: absolute;
149 }
150 .merchant-wishlist-button ~ .merchant-product-swatches .merchant-wishlist-button {
151 display: none !important;
152 }
153 ';
154 }
155
156 // Side/Floating Mini Cart
157 if ( Merchant_Modules::is_module_active( Merchant_Side_Cart::MODULE_ID ) || Merchant_Modules::is_module_active( Merchant_Floating_Mini_Cart::MODULE_ID ) ) {
158 $css .= '
159 .bde-mini-cart-offcanvas-footer .woocommerce-mini-cart__buttons a {
160 padding: var(--bde-button-padding-base);
161 font-size: var(--bde-button-font-size);
162 line-height: var(--bde-button-line-height);
163 font-weight: var(--bde-button-font-weight);
164 border-radius: var(--bde-button-border-radius);
165 }
166 .merchant-floating-side-mini-cart-widget .merchant-quantity-inner .bde-quantity-button {
167 display: none !important;
168 }
169 ';
170 }
171
172 // Sticky Add to Cart
173 if ( Merchant_Modules::is_module_active( Merchant_Sticky_Add_To_Cart::MODULE_ID ) ) {
174 $css .= '
175 .merchant-sticky-add-to-cart-item .button {
176 padding: var(--bde-button-padding-base);
177 font-size: var(--bde-button-font-size);
178 line-height: var(--bde-button-line-height);
179 font-weight: var(--bde-button-font-weight);
180 border-radius: var(--bde-button-border-radius);
181 }
182 .merchant-sticky-add-to-cart-item .quantity {
183 position: relative;
184 }
185 .merchant-sticky-add-to-cart-item .quantity input {
186 width: 80px;
187 padding: 10px 5px;
188 text-align: center;
189 }
190 .merchant-sticky-add-to-cart-item .quantity input::-webkit-outer-spin-button,
191 .merchant-sticky-add-to-cart-item .quantity input::-webkit-inner-spin-button {
192 -webkit-appearance: none;
193 margin: 0;
194 }
195 .merchant-sticky-add-to-cart-item .quantity input[type=number] {
196 -moz-appearance: textfield;
197 }
198 ';
199 }
200
201 // Recently Viewed Products
202 if ( Merchant_Modules::is_module_active( Merchant_Recently_Viewed_Products::MODULE_ID ) ) {
203 $css .= '
204 .merchant-recently-viewed-products-section {
205 width: 100%;
206 }
207 @media (max-width: 991px) and (min-width: 768px) {
208 .merchant-recently-viewed-products-section .merchant-carousel-wrapper li {
209 min-width: 100%;
210 }
211 }
212 ';
213 }
214
215 // Product Audio/Video
216 if ( Merchant_Modules::is_module_active( Merchant_Product_Audio::MODULE_ID ) || Merchant_Modules::is_module_active( Merchant_Product_Video::MODULE_ID ) ) {
217 $css .= '
218 .products .bde-woo-product-footer {
219 margin: 0;
220 }
221 ';
222 }
223
224 // Waitlist
225 if ( Merchant_Modules::is_module_active( Merchant_Wait_List::MODULE_ID ) ) {
226 $css .= '
227 #merchant-wait-list input {
228 padding: 12px;
229 margin-top: 10px;
230 }
231 #merchant-wait-list .merchant-wait-list-submit {
232 padding: var(--bde-button-padding-base);
233 font-size: var(--bde-button-font-size);
234 line-height: var(--bde-button-line-height);
235 font-weight: var(--bde-button-font-weight);
236 border-radius: var(--bde-button-border-radius);
237 }
238 ';
239 }
240
241 // Advanced Reviews
242 if ( Merchant_Modules::is_module_active( Merchant_Advanced_Reviews::MODULE_ID ) ) {
243 $css .= '
244 .merchant-adv-reviews-media-carousel {
245 max-width: 100%;
246 }
247 .merchant-adv-reviews .star-rating > span {
248 text-indent: -9999px;
249 }
250 .merchant-adv-reviews .star-rating:before,
251 .merchant-adv-reviews-modal-rating .stars a {
252 background: var(--mrc-adv-reviews-stars-bg-color, #777) !important;
253 }
254
255 .merchant-adv-reviews .star-rating span,
256 .merchant-adv-reviews-modal-rating .stars.selected a,
257 .merchant-adv-reviews-modal-rating .stars:hover a {
258 background: var(--mrc-adv-reviews-stars-color, #FFA441) !important;
259 }
260 .merchant-adv-reviews-modal .star-rating {
261 position: relative;
262 height: var(--bde-woo-ratings__star-size);
263 width: calc(var(--bde-woo-ratings__star-size) * 5 + 16px);
264 color: transparent;
265 font-size: 0;
266 display: flex;
267 flex-direction: row;
268 margin-right: auto;
269 }
270 .merchant-adv-reviews-modal .star-rating:before {
271 content: "";
272 position: absolute;
273 inset: 0;
274 background: var(--mrc-adv-reviews-stars-bg-color, #777) !important;
275 mask-image: var(--bde-woo-ratings__empty-star-svg), var(--bde-woo-ratings__empty-star-svg), var(--bde-woo-ratings__empty-star-svg), var(--bde-woo-ratings__empty-star-svg), var(--bde-woo-ratings__empty-star-svg);
276 mask-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
277 mask-position: 0 center, calc(var(--bde-woo-ratings__star-size) + 4px) center, calc(var(--bde-woo-ratings__star-size) * 2 + 8px) center, calc(var(--bde-woo-ratings__star-size) * 3 + 12px) center, calc(var(--bde-woo-ratings__star-size) * 4 + 16px) center;
278 mask-size: contain;
279 }
280 .merchant-adv-reviews-modal .star-rating span {
281 position: relative;
282 z-index: 1;
283 background: var(--mrc-adv-reviews-stars-color, #FFA441) !important;
284 mask-image: var(--bde-woo-ratings__filled-star-svg), var(--bde-woo-ratings__filled-star-svg), var(--bde-woo-ratings__filled-star-svg), var(--bde-woo-ratings__filled-star-svg), var(--bde-woo-ratings__filled-star-svg);
285 mask-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
286 mask-position: 0 center, calc(var(--bde-woo-ratings__star-size) + 4px) center, calc(var(--bde-woo-ratings__star-size) * 2 + 8px) center, calc(var(--bde-woo-ratings__star-size) * 3 + 12px) center, calc(var(--bde-woo-ratings__star-size) * 4 + 16px) center;
287 mask-size: contain;
288 text-indent: -9999px;
289 }
290 ';
291 }
292
293 // Login Popup
294 if ( ! is_user_logged_in() && Merchant_Modules::is_module_active( Merchant_Login_Popup::MODULE_ID ) ) {
295 $css .= '
296 .merchant-login-popup-content .button {
297 padding: var(--bde-button-padding-base);
298 font-size: var(--bde-button-font-size);
299 line-height: var(--bde-button-line-height);
300 font-weight: var(--bde-button-font-weight);
301 border-radius: var(--bde-button-border-radius);
302 }
303 ';
304 }
305
306 // Checkout
307 if ( Merchant_Modules::is_module_active( Merchant_Checkout::MODULE_ID ) ) {
308 $css .= '
309 .woocommerce-checkout .woocommerce,
310 .woocommerce-checkout .shop_table {
311 width: 100%;
312 }
313 .merchant-pro-multi-step-wrapper li {
314 list-style: none;
315 }
316 .merchant-pro-multi-step-wrapper .form-row {
317 display: flex;
318 flex-direction: column;
319 gap: 10px;
320 }
321 .merchant-pro-multi-step-wrapper .form-row input,
322 .merchant-pro-multi-step-wrapper .form-row select,
323 .merchant-pro-multi-step-wrapper .form-row textarea {
324 width: 100%;
325 padding: 10px 15px;
326 }
327 .merchant-pro-multi-step-wrapper tr th:last-child, .merchant-pro-multi-step-wrapper tr td:last-child {
328 text-align: right;
329 }
330 .merchant-pro-multi-step-wrapper #payment ul {
331 padding: 0;
332 }
333 @media only screen and (min-width: 992px) {
334 .merchant-pro-sc-layout-shopify .merchant-pro-sc-form {
335 gap: 0 !important;
336 }
337 }
338 ';
339 }
340 }
341
342 return $css;
343 }
344 }
345
346 add_action( 'init', function() {
347 new Merchant_Breakdance_Builder();
348 } );
349 }
350