@@ -1650,7 +1650,16 @@ function ppom_generate_html_for_files( $file_names, $input_type, $item ) {
16501650
16511651// return html for images selected
16521652function ppom_generate_html_for_images ( $ images ) {
1653+ global $ post ;
16531654
1655+ static $ ppom_has_cart_block = null ;
1656+ if ( is_null ( $ ppom_has_cart_block ) ) {
1657+ $ ppom_has_cart_block = has_block ( 'woocommerce/cart ' , $ post );
1658+ }
1659+
1660+ if ( $ ppom_has_cart_block ) {
1661+ return ppom_get_image_name ( $ images );
1662+ }
16541663
16551664 $ ppom_html = '<table class="table table-bordered"> ' ;
16561665 foreach ( $ images as $ id => $ images_meta ) {
@@ -2359,7 +2368,7 @@ function ppom_get_conditional_data_attributes( $meta ) {
23592368
23602369 $ bound = isset ( $ conditions ['bound ' ] ) ? ppom_wpml_translate ( $ conditions ['bound ' ], 'PPOM ' ) : '' ;
23612370 $ visibility = isset ( $ conditions ['visibility ' ] ) ? ppom_wpml_translate ( $ conditions ['visibility ' ], 'PPOM ' ) : '' ;
2362-
2371+
23632372 $ conditions ['rules ' ] = array_filter (
23642373 $ conditions ['rules ' ],
23652374 function ( $ rule ) {
@@ -2559,3 +2568,29 @@ function ppom_posted_field_max_min_value_validation( $posted_fields, $field ) {
25592568
25602569 return '' ;
25612570}
2571+
2572+ /**
2573+ * Get image name from images array.
2574+ * @param mixed $images
2575+ * @return string
2576+ */
2577+ function ppom_get_image_name ( $ images ) {
2578+ $ updated_value = '' ;
2579+
2580+ if ( is_array ( $ images ) ) {
2581+ $ total_images = count ( $ images );
2582+
2583+ foreach ( $ images as $ image_key => $ image ) {
2584+ $ image_data = json_decode ( stripslashes ( $ image ), true );
2585+ if ( isset ( $ image_data ['raw ' ] ) ) {
2586+ $ updated_value .= $ image_data ['raw ' ];
2587+ }
2588+
2589+ if ( $ image_key < $ total_images - 1 ) {
2590+ $ updated_value .= ', ' ;
2591+ }
2592+ }
2593+ }
2594+
2595+ return $ updated_value ;
2596+ }
0 commit comments