Skip to content

Commit 09add22

Browse files
committed
Revert "fix: woocomerce gallary sync"
This reverts commit e34634e.
1 parent d60efc1 commit 09add22

File tree

3 files changed

+23
-84
lines changed

3 files changed

+23
-84
lines changed

includes/Admin/Forms/Post/Templates/Post_Form_Template_WooCommerce.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ public function after_update( $post_id, $form_id, $form_settings ) {
290290
public function handle_form_updates( $post_id, $form_id, $form_settings ) {
291291
$this->update_reviews( $post_id );
292292
$this->update_price( $post_id );
293+
$this->update_gallery_images( $post_id );
293294
$this->update_meta( $post_id );
294295
}
295296

@@ -304,6 +305,8 @@ public function update_reviews( $post_id ) {
304305
global $wpdb;
305306
$reviews = get_post_meta( $post_id, 'product_reviews', true );
306307
$status = ! empty( $reviews ) ? 'open' : 'closed';
308+
// wp_update_post( array( 'ID' => $post_id, 'comment_status' => $status ) );
309+
$comment_sql = "UPDATE {$wpdb->prefix}posts SET comment_status='{$status}' WHERE ID={$post_id} AND post_status='publish' AND post_type='product'";
307310
$wpdb->get_results( $wpdb->prepare( "UPDATE {$wpdb->prefix}posts SET comment_status=%s WHERE ID=%d AND post_status='publish' AND post_type='product'", $status, $post_id ) );
308311
}
309312

@@ -324,6 +327,26 @@ public function update_price( $post_id ) {
324327
}
325328
}
326329

330+
/**
331+
* Update image gallery
332+
*
333+
* @param int $post_id
334+
*
335+
* @return void
336+
*/
337+
public function update_gallery_images( $post_id ) {
338+
$images = get_post_meta( $post_id, '_product_image' );
339+
if ( ! empty( $images ) ) {
340+
if ( is_array( $images[0] ) ) {
341+
$images = $images[0];
342+
}
343+
if ( is_serialized( $images[0] ) ) {
344+
$images = maybe_unserialize( $images[0] );
345+
}
346+
update_post_meta( $post_id, '_product_image_gallery', implode( ',', $images ) );
347+
}
348+
}
349+
327350
/**
328351
* Fix for visibily not updating from frontend post
329352
*

includes/Integrations.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class Integrations {
2323
'WCMp' => 'WPUF_WCMp_Integration',
2424
'ACF' => 'WPUF_ACF_Compatibility',
2525
'Tribe__Events__Main' => 'Events_Calendar\Events_Calendar_Integration',
26-
'WooCommerce' => 'WPUF_WooCommerce_Gallery_Sync',
2726
];
2827

2928
public function __construct() {

includes/Integrations/WPUF_WooCommerce_Gallery_Sync.php

Lines changed: 0 additions & 83 deletions
This file was deleted.

0 commit comments

Comments
 (0)