| @@ -16,9 +16,9 @@ | ||
| 16 | 16 | |
| 17 | 17 | public function __construct() { |
| 18 | 18 | add_action( 'wp_enqueue_scripts', [ $this, 'enqueue' ] ); |
| 19 | 19 | |
| 20 | - // Gallery Plugin Support rtwpvg_disable_enqueue_scripts | |
| 20 | + // Gallery Plugin Support rtwpvg_disable_enqueue_scripts. | |
| 21 | 21 | add_filter( 'rtwpvg_disable_enqueue_scripts', '__return_false', 11 ); |
| 22 | 22 | |
| 23 | 23 | // Template. |
| 24 | 24 | |
| @@ -49,9 +49,9 @@ | ||
| 49 | 49 | * @return void |
| 50 | 50 | * @since 1.0.0 |
| 51 | 51 | */ |
| 52 | 52 | public function quick_view_action_template() { |
| 53 | - | |
| 53 | + wp_enqueue_style( 'elementor-frontend' ); | |
| 54 | 54 | // Image. |
| 55 | 55 | add_action( 'rtsb/wcqv/product/image', 'woocommerce_show_product_sale_flash', 10 ); |
| 56 | 56 | add_action( 'rtsb/wcqv/product/image', 'woocommerce_show_product_images', 20 ); |
| 57 | 57 | |
| @@ -64,17 +64,17 @@ | ||
| 64 | 64 | add_action( 'rtsb/wcqv/product/summary', 'woocommerce_template_single_meta', 30 ); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | public function product_quick_view_ajax() { |
| 68 | - $product_id = absint( $_REQUEST['product_id'] ); | |
| 68 | + $product_id = isset( $_REQUEST['product_id'] ) ? absint( $_REQUEST['product_id'] ) : 0; // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 69 | 69 | |
| 70 | - if ( empty( $product_id ) ) { | |
| 70 | + if ( empty( $product_id ) || 'publish' !== get_post_status( $product_id ) ) { | |
| 71 | 71 | wp_send_json_error( esc_html__( 'Product Id not found', 'shopbuilder' ) ); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | global $sitepress; |
| 75 | 75 | |
| 76 | - $lang = isset( $_REQUEST['lang'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['lang'] ) ) : ''; | |
| 76 | + $lang = isset( $_REQUEST['lang'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['lang'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 77 | 77 | if ( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) { |
| 78 | 78 | $sitepress->switch_lang( $lang, true ); |
| 79 | 79 | } |
| 80 | 80 | |
| @@ -85,10 +85,10 @@ | ||
| 85 | 85 | if ( defined( 'RTWPVG_VERSION' ) ) { |
| 86 | 86 | remove_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 ); |
| 87 | 87 | } |
| 88 | 88 | if ( ! defined( 'RTWPVG_VERSION' ) ) { |
| 89 | - add_action( 'woocommerce_product_thumbnails', [ $this, 'woocommerce_product_thumbnails_before' ], 1 ); | |
| 90 | - add_action( 'woocommerce_product_thumbnails', [ $this, 'woocommerce_product_thumbnails_after' ], 25 ); | |
| 89 | + // add_action( 'woocommerce_product_thumbnails', [ $this, 'woocommerce_product_thumbnails_before' ], 1 ); | |
| 90 | + // add_action( 'woocommerce_product_thumbnails', [ $this, 'woocommerce_product_thumbnails_after' ], 25 ); | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | ob_start(); |
| 94 | 94 | Fns::load_template( 'quick-view/content' ); |
| @@ -202,14 +202,15 @@ | ||
| 202 | 202 | $icon_html = '<i class="rtsb-icon rtsb-icon-eye"></i>'; |
| 203 | 203 | // get product type. |
| 204 | 204 | $product_type = $product->get_type(); |
| 205 | 205 | $params = [ |
| 206 | - 'classes' => $classes, | |
| 207 | - 'product_id' => $product->get_id(), | |
| 208 | - 'product_type' => $product_type, | |
| 209 | - 'button_text' => $button_text, | |
| 210 | - 'left_text' => apply_filters( 'rtsb/module/quick_view/button_left_text', '' ), | |
| 211 | - 'right_text' => apply_filters( 'rtsb/module/quick_view/button_right_text', '' ), | |
| 206 | + 'classes' => $classes, | |
| 207 | + 'product_id' => $product->get_id(), | |
| 208 | + 'product_type' => $product_type, | |
| 209 | + 'button_text' => $button_text, | |
| 210 | + 'has_button_text' => ! empty( Fns::get_option( 'modules', 'quick_view', 'button_text', '' ) ), | |
| 211 | + 'left_text' => apply_filters( 'rtsb/module/quick_view/button_left_text', '' ), | |
| 212 | + 'right_text' => apply_filters( 'rtsb/module/quick_view/button_right_text', '' ), | |
| 212 | 213 | ]; |
| 213 | 214 | // let third party developer filter options. |
| 214 | 215 | $atts = apply_filters( 'rtsb/module/quick_view/button_params', $params ); |
| 215 | 216 | // set fragment options. |
| @@ -227,9 +228,8 @@ | ||
| 227 | 228 | * |
| 228 | 229 | * @return string [HTML] |
| 229 | 230 | */ |
| 230 | 231 | public function button_shortcode( $atts, $content = '' ) { |
| 231 | - $this->enqueue(); | |
| 232 | 232 | global $product; |
| 233 | 233 | if ( ! $product instanceof WC_Product ) { |
| 234 | 234 | return ''; |
| 235 | 235 | } |
| @@ -240,8 +240,19 @@ | ||
| 240 | 240 | return ob_get_clean(); |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | public function enqueue() { |
| 244 | + | |
| 245 | + wp_enqueue_style( 'elementor-icons-fa-regular' ); | |
| 246 | + | |
| 247 | + wp_enqueue_style( 'elementor-icons-fa-solid' ); | |
| 248 | + wp_enqueue_style( 'elementor-icons-shared-0' ); | |
| 249 | + // wp_enqueue_style( 'elementor-frontend' ); | |
| 250 | + | |
| 251 | + if ( ! class_exists( 'WooProductVariationGallery' ) && current_theme_supports( 'wc-product-gallery-slider' ) ) { | |
| 252 | + wp_enqueue_script( 'flexslider' ); | |
| 253 | + } | |
| 254 | + | |
| 244 | 255 | wp_enqueue_script( 'wc-add-to-cart-variation' ); |
| 245 | 256 | if ( version_compare( WC()->version, '3.0.0', '>=' ) ) { |
| 246 | 257 | if ( current_theme_supports( 'wc-product-gallery-zoom' ) ) { |
| 247 | 258 | wp_enqueue_script( 'zoom' ); |