PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.5
ShopBuilder – WooCommerce Builder For Elementor v3.2.5
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
← All changes | app/Modules/VariationGallery/GalleryAdmin.php +1 -45 3.4.03.2.5 View file →
@@ -32,54 +32,10 @@
32 32 add_action( 'woocommerce_product_after_variable_attributes', [ $this, 'gallery_admin_html' ], 10, 3 );
33 33 add_action( 'woocommerce_save_product_variation', [ $this, 'save_variation_gallery' ] );
34 34 add_action( 'add_meta_boxes', [ $this, 'add_metabox' ] );
35 35 add_action( 'save_post', [ $this, 'save_metabox' ] );
36 -
37 - // Invalidate cached variation galleries when product data or images change.
38 - add_action( 'woocommerce_update_product', [ $this, 'flush_product_gallery_cache' ] );
39 - add_action( 'woocommerce_save_product_variation', [ $this, 'flush_variation_parent_cache' ] );
40 - add_action( 'delete_attachment', [ $this, 'flush_attachment_gallery_cache' ] );
41 36 }
42 -
43 37 /**
44 - * Flush all cached gallery transients for a saved product.
45 - *
46 - * @param int $product_id Product ID.
47 - *
48 - * @return void
49 - */
50 - public function flush_product_gallery_cache( $product_id ) {
51 - GalleryFns::flush_product_gallery_transients( $product_id );
52 - }
53 -
54 - /**
55 - * Flush the parent product default-gallery transient when a variation is saved.
56 - *
57 - * The variation's own transient is already cleared in save_variation_gallery();
58 - * this also clears the parent product default-images cache.
59 - *
60 - * @param int $variation_id Variation ID.
61 - *
62 - * @return void
63 - */
64 - public function flush_variation_parent_cache( $variation_id ) {
65 - $parent_id = wp_get_post_parent_id( $variation_id );
66 - if ( $parent_id ) {
67 - GalleryFns::delete_transients( $parent_id, 'default-images' );
68 - }
69 - }
70 -
71 - /**
72 - * Flush cached variation galleries referencing a deleted attachment.
73 - *
74 - * @param int $attachment_id Attachment ID being deleted.
75 - *
76 - * @return void
77 - */
78 - public function flush_attachment_gallery_cache( $attachment_id ) {
79 - GalleryFns::flush_attachment_gallery_transients( $attachment_id );
80 - }
81 - /**
82 38 * Adds a custom meta box to the WooCommerce product edit page.
83 39 */
84 40 public function add_metabox() {
85 41 add_meta_box(
@@ -102,9 +58,9 @@
102 58 <p>
103 59 <label for="custom_checkbox">
104 60 <input type="checkbox" id="rtsb_vg_disable_valiation_gallery" name="rtsb_vg_disable_valiation_gallery" value="yes" <?php checked( $value, 'yes' ); ?> />
105 61 <?php esc_html_e( 'Disable Variation Gallery', 'shopbuilder' ); ?>
106 - </label><hr/>
62 + </label><br/>
107 63 <span><?php esc_html_e( 'Disable variation gallery for this product', 'shopbuilder' ); ?> </span>
108 64 </p>
109 65 <?php
110 66 }