| 1 |
<?php |
| 2 |
|
| 3 |
namespace UltimateStoreKit\Modules\FlorenceGrid; |
| 4 |
|
| 5 |
use UltimateStoreKit\Base\Ultimate_Store_Kit_Module_Base; |
| 6 |
|
| 7 |
if (!defined('ABSPATH')) { |
| 8 |
exit; |
| 9 |
} // Exit if accessed directly |
| 10 |
|
| 11 |
class Module extends Ultimate_Store_Kit_Module_Base { |
| 12 |
public static function is_active() { |
| 13 |
return class_exists('woocommerce'); |
| 14 |
} |
| 15 |
|
| 16 |
public function get_name() { |
| 17 |
return 'usk-florence-grid'; |
| 18 |
} |
| 19 |
|
| 20 |
public function get_widgets() { |
| 21 |
return ['Florence_Grid']; |
| 22 |
} |
| 23 |
|
| 24 |
public function add_product_post_class($classes) { |
| 25 |
$classes[] = 'product'; |
| 26 |
|
| 27 |
return $classes; |
| 28 |
} |
| 29 |
|
| 30 |
public function add_products_post_class_filter() { |
| 31 |
add_filter('post_class', [$this, 'add_product_post_class']); |
| 32 |
} |
| 33 |
|
| 34 |
public function remove_products_post_class_filter() { |
| 35 |
remove_filter('post_class', [$this, 'add_product_post_class']); |
| 36 |
} |
| 37 |
|
| 38 |
public function register_wc_hooks() { |
| 39 |
wc()->frontend_includes(); |
| 40 |
} |
| 41 |
|
| 42 |
public $wcqv_plugin_dir_url; |
| 43 |
|
| 44 |
public function __construct() { |
| 45 |
|
| 46 |
parent::__construct(); |
| 47 |
|
| 48 |
if (!empty($_REQUEST['action']) && 'elementor' === $_REQUEST['action'] && is_admin()) { |
| 49 |
add_action('init', [$this, 'register_wc_hooks'], 5); |
| 50 |
} |
| 51 |
|
| 52 |
$this->wcqv_plugin_dir_url = BDTUSK_URL; |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
add_action('wp_enqueue_scripts', array($this, 'load_assets')); |
| 57 |
/** |
| 58 |
* Modal data |
| 59 |
*/ |
| 60 |
add_action('wp_ajax_nopriv_ultimate_store_kit_wc_product_quick_view_content', [$this, 'ultimate_store_kit_wc_product_quick_view_content']); |
| 61 |
add_action('wp_ajax_ultimate_store_kit_wc_product_quick_view_content', [$this, 'ultimate_store_kit_wc_product_quick_view_content']); |
| 62 |
|
| 63 |
add_action('ultimate_store_kit_wc_product_quick_view_product_sale_flash', 'woocommerce_show_product_sale_flash'); |
| 64 |
add_action('ultimate_store_kit_quick_florence_grid_view_product_images', [$this, 'ultimate_store_kit_quick_view_product_images']); |
| 65 |
add_action('ultimate_store_kit_quick_view_product_title', 'woocommerce_template_single_title'); |
| 66 |
add_action('ultimate_store_kit_quick_view_product_single_rating', 'woocommerce_template_single_rating'); |
| 67 |
add_action('ultimate_store_kit_quick_view_product_single_price', 'woocommerce_template_single_price'); |
| 68 |
add_action('ultimate_store_kit_quick_view_product_single_excerpt', 'woocommerce_template_single_excerpt'); |
| 69 |
add_action('ultimate_store_kit_quick_view_product_single_add_to_cart', 'woocommerce_template_single_add_to_cart'); |
| 70 |
add_action('ultimate_store_kit_quick_view_product_single_meta', 'woocommerce_template_single_meta'); |
| 71 |
} |
| 72 |
|
| 73 |
public function load_assets() { |
| 74 |
// wp_register_script( 'frontend_js', BDTUSK_URL . '/assets/js/widgets/frontend.js', array( 'jquery' ), '1.0', true ); |
| 75 |
// wp_enqueue_script( 'frontend_js' ); |
| 76 |
|
| 77 |
wp_enqueue_script('wc-add-to-cart-variation'); |
| 78 |
wp_enqueue_script('thickbox'); |
| 79 |
|
| 80 |
wp_enqueue_script('prettyPhoto'); |
| 81 |
wp_enqueue_style('woocommerce_prettyPhoto_css'); |
| 82 |
} |
| 83 |
|
| 84 |
|
| 85 |
public function ultimate_store_kit_wc_product_quick_view_content() { |
| 86 |
$product_id = isset($_POST['product_id']) ? sanitize_text_field($_POST['product_id']) : ''; |
| 87 |
ultimate_store_kit_wc_product_quick_view_content($product_id); |
| 88 |
} |
| 89 |
|
| 90 |
public function ultimate_store_kit_quick_view_product_images() { |
| 91 |
ultimate_store_kit_quick_view_product_images(); |
| 92 |
} |
| 93 |
} |
| 94 |
|